Examples of HostAPI


Examples of com.dotmarketing.portlets.contentlet.business.HostAPI

      roles = com.dotmarketing.business.APILocator.getRoleAPI().loadRolesForUser(user.getUserId()).toArray(new Role[0]);
    } catch (DotDataException e1) {
      Logger.error(BrowserAjax.class,e1.getMessage(),e1);
    }
        boolean respectFrontendRoles = userWebAPI.isLoggedToFrontend(ctx.getHttpServletRequest());
    HostAPI hostAPI = APILocator.getHostAPI();
    Host host = hostAPI.find(hostId, user, respectFrontendRoles);
    FolderAPI folderAPI = APILocator.getFolderAPI();
    List<Folder> folders = folderAPI.findSubFolders(host,user,false);
    List<Map<String, Object>> foldersToReturn = new ArrayList<Map<String,Object>>(folders.size());
    for (Folder f: folders){
      List permissions = new ArrayList();
View Full Code Here

Examples of com.dotmarketing.portlets.contentlet.business.HostAPI

  public List<Map<String, Object>> getHostSubfoldersByPermissions(String hostId, String requiredPermissions) throws PortalException, SystemException, DotDataException, DotSecurityException {
      UserWebAPI userWebAPI = WebAPILocator.getUserWebAPI();
      WebContext ctx = WebContextFactory.get();
        User user = userWebAPI.getLoggedInUser(ctx.getHttpServletRequest());
        boolean respectFrontendRoles = userWebAPI.isLoggedToFrontend(ctx.getHttpServletRequest());
    HostAPI hostAPI = APILocator.getHostAPI();
    Host host = hostAPI.find(hostId, user, respectFrontendRoles);
    FolderAPI folderAPI = APILocator.getFolderAPI();
    List<Folder> folders = folderAPI.findSubFolders(host,user,false);
    List<Map<String, Object>> foldersToReturn = new ArrayList<Map<String,Object>>(folders.size());
    for (Folder f: folders){
      if(UtilMethods.isSet(requiredPermissions)){
View Full Code Here

Examples of com.dotmarketing.portlets.contentlet.business.HostAPI

      if (InodeUtils.isSet(hostFolderId)) {
        UserWebAPI userWebAPI = WebAPILocator.getUserWebAPI();
        WebContext ctx = WebContextFactory.get();
        User user = userWebAPI.getLoggedInUser(ctx.getHttpServletRequest());
        boolean respectFrontendRoles = userWebAPI.isLoggedToFrontend(ctx.getHttpServletRequest());
        HostAPI hostAPI = APILocator.getHostAPI();
        Host host = hostAPI.find(hostFolderId, user, respectFrontendRoles);
        if(host != null) {
          return hostMap(host);
        }

        host = hostAPI.findByName(hostFolderId, user, respectFrontendRoles);
        if(host != null) {
          return hostMap(host);
        }

        FolderAPI folderAPI = APILocator.getFolderAPI();
View Full Code Here

Examples of com.dotmarketing.portlets.contentlet.business.HostAPI

      roles = com.dotmarketing.business.APILocator.getRoleAPI().loadRolesForUser(user.getUserId()).toArray(new Role[0]);
    } catch (DotDataException e1) {
      Logger.error(BrowserAjax.class,e1.getMessage(),e1);
    }
        boolean respectFrontendRoles = userWebAPI.isLoggedToFrontend(ctx.getHttpServletRequest());
    HostAPI hostAPI = APILocator.getHostAPI();
    Host host = hostAPI.find(hostId, user, respectFrontendRoles);
    FolderAPI folderAPI = APILocator.getFolderAPI();
    List<Folder> folders = folderAPI.findThemes(host, user, respectFrontendRoles);
    List<Map<String, Object>> foldersToReturn = new ArrayList<Map<String,Object>>(folders.size());
    for (Folder f: folders){
      List permissions = new ArrayList();
View Full Code Here

Examples of com.dotmarketing.portlets.contentlet.business.HostAPI

 
  @SuppressWarnings("unchecked")
  private Permissionable retrievePermissionable (String assetId) throws DotDataException, DotSecurityException {
   
    UserAPI userAPI = APILocator.getUserAPI();
    HostAPI hostAPI = APILocator.getHostAPI();
   
    Permissionable perm = null;
   
    //Determining the type
   
    //Host?
    perm = hostAPI.find(assetId, userAPI.getSystemUser(), false);
   
    if(perm == null) {
      //Content?
      ContentletAPI contAPI = APILocator.getContentletAPI();
      try {
View Full Code Here

Examples of com.dotmarketing.portlets.contentlet.business.HostAPI

 
  @SuppressWarnings("unchecked")
  private Permissionable retrievePermissionable (String assetId) throws DotDataException, DotSecurityException {
   
    UserAPI userAPI = APILocator.getUserAPI();
    HostAPI hostAPI = APILocator.getHostAPI();
   
    Permissionable perm = null;
   
    //Determining the type
   
    //Host?
    perm = hostAPI.find(assetId, userAPI.getSystemUser(), false);
   
    if(perm == null) {
      //Content?
      ContentletAPI contAPI = APILocator.getContentletAPI();
      try {
View Full Code Here

Examples of com.dotmarketing.portlets.contentlet.business.HostAPI

    return user;
  }

  private void sendEmail(User user, Map<String, Object> parameters) throws DotDataException, DotSecurityException {
   
    HostAPI hostAPI = APILocator.getHostAPI();
   
    // Get the default host cause there is no request
    Host currentHost = hostAPI.findDefaultHost(user, false);
   
    // The parameters to be validated
    Set<String> toValidate = parameters.keySet();

    try {
View Full Code Here

Examples of com.dotmarketing.portlets.contentlet.business.HostAPI

      RenderRequest req, RenderResponse res)
    throws Exception {

        Logger.debug(this, "Running ViewVirtualLinksAction!!!!");
        User user=(User)req.getAttribute("USER");
        HostAPI hostAPI = APILocator.getHostAPI();
        List<Host> hosts= hostAPI.getHostsWithPermission(PermissionAPI.PERMISSION_READ, false, user, false);
       
       
        VirtualLinkAPI.OrderBy orderby = VirtualLinkAPI.OrderBy.TITLE;
        String temp = req.getParameter("orderby");
        if ((temp!= null) && temp.equals("url"))
          orderby = VirtualLinkAPI.OrderBy.URL;
       
        com.liferay.portlet.RenderRequestImpl reqImpl = (com.liferay.portlet.RenderRequestImpl) req;
    HttpServletRequest httpReq = reqImpl.getHttpServletRequest();
        String hostId = (String) httpReq.getSession().getAttribute(WebKeys.CMS_SELECTED_HOST_ID);
        String url = null;
        if (UtilMethods.isSet(hostId)) {
          Host host = hostAPI.find(hostId, user, false);
          if (host != null){
            url = host.getHostname() + ":/";
          }
          else{
           
            url = "there is no host named this" + ":/";
          }
        }

    try {
      if (req.getWindowState().equals(WindowState.NORMAL)) {
        //get their lists
        List list = virtualLinkAPI.getVirtualLinks(null, url, orderby);
        //list =VirtualLinkFactory.checkListForCreateVirtualLinkspermission(list, user);
        req.setAttribute(WebKeys.VIRTUAL_LINK_VIEW_PORTLET, list);
        req.setAttribute("host_list", hosts);
            Logger.debug(this, "Going to: portlet.ext.virtuallinks.view");
        return mapping.findForward("portlet.ext.virtuallinks.view");
      }
      else {
             
        if (UtilMethods.isSet(req.getParameter("query"))){
          if(UtilMethods.isSet(req.getParameter("host_name"))){
            hostId =req.getParameter("host_name");
          }
          Host h = hostAPI.find(hostId, user, false);

          List<VirtualLink> listVar = virtualLinkAPI.getVirtualLinks(req.getParameter("query"), url, orderby);
          List<VirtualLink> listV = new ArrayList<VirtualLink>();
          Iterator listvs = listVar.iterator();
          if(h != null && InodeUtils.isSet(h.getInode()))
          {
            while (listvs .hasNext()) {
              VirtualLink next = (VirtualLink) listvs .next();
              if (next.getUrl().startsWith(h.getHostname()) || (next.getUrl().startsWith("/") && APILocator.getUserAPI().isCMSAdmin(user))){
                listV.add(next);
              }
            }
               
          }   
         
          else{
            while (listvs .hasNext()) {
              VirtualLink next = (VirtualLink) listvs .next();
              if (next.getUrl().startsWith("/") && APILocator.getUserAPI().isCMSAdmin(user)){
                listV.add(next);
              }
            }
          }
         
          //listV =VirtualLinkFactory.checkListForCreateVirtualLinkspermission(listV, user);
          int totalVLinksToDisplay = listV.size();
          req.setAttribute(WebKeys.VIRTUAL_LINK_LIST_VIEW, listV);
          req.setAttribute("host_list", hosts);
          return mapping.findForward("portlet.ext.virtuallinks.view_virtuallinks");
       
        }
        else{
         
          List<VirtualLink> listTemp = new ArrayList<VirtualLink>();
          List<VirtualLink> list = new ArrayList<VirtualLink>();
          Host h = hostAPI.find(hostId, user, false);
          if (InodeUtils.isSet(req.getParameter("inode"))) {
            HTMLPage htmlPage = (HTMLPage) InodeFactory.getInode(req.getParameter("inode"),HTMLPage.class);
            Identifier identifier = APILocator.getIdentifierAPI().find(htmlPage);
            listTemp = VirtualLinkFactory.getIncomingVirtualLinks(identifier.getURI());
          }
View Full Code Here

Examples of com.dotmarketing.portlets.contentlet.business.HostAPI

    String cmd = req.getParameter(Constants.CMD);
        Logger.debug(this, "Inside EditVirtualLinkAction cmd=" + cmd);
        
    //get the user
    User user = _getUser(req);
    HostAPI hostAPI = APILocator.getHostAPI();
   
      List<Host> hosts = hostAPI.getHostsWithPermission(com.dotmarketing.business.PermissionAPI.PERMISSION_CREATE_VIRTUAL_LINKS, false, user, false);
     
      req.setAttribute("host_list", hosts);
      req.setAttribute("isCMSAdministrator", new Boolean(APILocator.getRoleAPI().doesUserHaveRole(user, APILocator.getRoleAPI().loadCMSAdminRole().getId())));
     
    /*
     *  get the mainglist object, stick it in request
     * 
     */
    try {
          Logger.debug(this, "I'm retrieving the list");
      _retrieveVirtualLink(req, res, config, form);
    }
    catch (Exception ae) {
      _handleException(ae, req);
    }

    /*
     *  if we are saving,
     * 
     */
    if ((cmd != null) && cmd.equals(Constants.ADD)) {
      try {

        if (Validator.validate(req,form,mapping)) {
              Logger.debug(this, "I'm Saving the virtual link");
          _saveVirtualLink(req, res, config, form, user);
          _sendToReferral(req, res, "");
        }
      }
      catch (Exception ae) {
        if (!ae.getMessage().equals(WebKeys.UNIQUE_VIRTUAL_LINK_EXCEPTION)){
          _handleException(ae, req);
        }
      }
    }

    /*
     * deleting the list, return to listing page
     * 
     */
    else if ((cmd != null) && cmd.equals(Constants.DELETE)) {
      try {
            Logger.debug(this, "I'm deleting the virtual link");
        _deleteVirtualLink(req, res, config, form,user);

      }
      catch (Exception ae) {
        _handleException(ae, req);
      }
      _sendToReferral(req, res, "");
    }

    /*
     * Copy copy props from the db to the form bean
     *
     */
    if ((cmd != null) && cmd.equals(Constants.EDIT)) {
        VirtualLink vl = (VirtualLink) req.getAttribute(WebKeys.VIRTUAL_LINK_EDIT);
      BeanUtils.copyProperties(form, req.getAttribute(WebKeys.VIRTUAL_LINK_EDIT));
      String linkUrl = vl.getUrl();
      if (linkUrl != null) {
          String[] splittedLink = linkUrl.split(":");
          if (splittedLink.length > 1) {
              Host host = hostAPI.findByName(splittedLink[0], user, false);
                    if ( host != null ) {
                        ((VirtualLinkForm) form).setUrl( splittedLink[1] );
                        ((VirtualLinkForm) form).setHostId( host.getIdentifier() );
                    } else {
                        Logger.error( this, "Host not found OR Unexpected URL format for Vanity URL: " + linkUrl );
View Full Code Here

Examples of com.dotmarketing.portlets.contentlet.business.HostAPI

  public List<VirtualLink> getVirtualLinks(String title, List<Host> hosts, OrderBy orderby) {
    return virtualLinkFactory.getVirtualLinks(title, hosts, orderby);
  }

  public java.util.List<VirtualLink> checkListForCreateVirtualLinkspermission(java.util.List<VirtualLink> list,User user) throws DotDataException, DotSecurityException {
    HostAPI hostAPI=APILocator.getHostAPI();
    List <Host>  hosts = hostAPI.getHostsWithPermission(PERMISSION_CREATE_VIRTUAL_LINKS, false, user, false);
    List <VirtualLink> vlinks=new ArrayList<VirtualLink>();

    try {
      if(APILocator.getRoleAPI().doesUserHaveRole(user, APILocator.getRoleAPI().loadCMSAdminRole())){
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.