Package com.dotmarketing.portlets.virtuallinks.model

Examples of com.dotmarketing.portlets.virtuallinks.model.VirtualLink


          else{
            return realLink;
          }
        }
       
        VirtualLink vl = null;
        try{
          vl = VirtualLinkFactory.getVirtualLinkByURL(url);
        }
        catch(DotHibernateException dhe){
          Logger.debug(VirtualLinksCache.class, "failed to find: " + url)
        }
       

    if(vl != null && InodeUtils.isSet(vl.getInode()))
    {
      addPathToCache(vl);
    } else {

            cache.put(sanitizeKey(url), WebKeys.Cache.CACHE_NOT_FOUND, getPrimaryGroup());
            return null;
    }

        return vl.getUri();

    }
View Full Code Here


      DotCacheAdministrator cache = CacheLocator.getCacheAdministrator();
      List<VirtualLink> vls = VirtualLinkFactory.getVirtualLinks();
        Iterator<VirtualLink> iter = vls.iterator();
        Logger.debug(VirtualLinksCache.class, " mapping " + vls.size() + " virtual link(s) ");
        while (iter.hasNext()) {
            VirtualLink vl = (VirtualLink) iter.next();
            if (vl != null && InodeUtils.isSet(vl.getInode()))
            {
              Logger.debug(VirtualLinksCache.class, "mapping: " + vl.getUrl() + " -> " + vl.getUri());
                cache.put(sanitizeKey(vl.getUrl()), vl.getUri(), getPrimaryGroup());
            }
        }
    }  
View Full Code Here

    HTMLPage page = (HTMLPage) InodeFactory.getChildOfClass(c, HTMLPage.class);
    if (InodeUtils.isSet(page.getIdentifier())) {
      cfform.setHtmlPage(page.getIdentifier());
    }
   
    VirtualLink vl = (VirtualLink) InodeFactory.getChildOfClass(c, VirtualLink.class);
    if (InodeUtils.isSet(vl.getInode())) {
      cfform.setTrackBackLinkInode(vl.getInode());
    }
    req.setAttribute(WebKeys.COMMUNICATION_EDIT_FORM, cfform);
  }
View Full Code Here

        }
      }
    }
   
    // wipe the old VirtualLink entries
    VirtualLink vl = (VirtualLink) InodeFactory.getChildOfClass(c, VirtualLink.class);
    if (InodeUtils.isSet(vl.getInode()))
      c.deleteChild(vl);
   
    //try to get the Communication's virtual link
    if (InodeUtils.isSet(cfform.getTrackBackLinkInode())) {
      vl = VirtualLinkFactory.getVirtualLink(String.valueOf(cfform.getTrackBackLinkInode()));
      if (InodeUtils.isSet(vl.getInode())) {
        c.addChild(vl);
        c.setTrackBackLinkInode(vl.getInode());
      }
    }
       
    //add message
    SessionMessages.add(req, "message", "message.communications.saved");
View Full Code Here

    }
        return list;
    }

    public static VirtualLink newInstance() {
        VirtualLink vl = new VirtualLink();
        vl.setActive(true);
        return vl;

    }
View Full Code Here

          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());
          }
          else{
            if (UtilMethods.isSet(url)) {
              listTemp = virtualLinkAPI.getVirtualLinks(null, url, orderby);
            } else {
              listTemp = virtualLinkAPI.getVirtualLinks(null, hosts, orderby);
            }

          }

          Iterator listvs = listTemp.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))){
                list.add(next);
              }
            }
               
          }else{
            while (listvs .hasNext()) {
              VirtualLink next = (VirtualLink) listvs .next();
              if (next.getUrl().startsWith("/") && APILocator.getUserAPI().isCMSAdmin(user)){
                list.add(next);
              }
            }
          }
         
View Full Code Here

    /*
     * 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 ) {
View Full Code Here

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

  public VirtualLink copyVirtualLink(VirtualLink sourceVirtualLink, Host destinationHost) throws DotHibernateException {
    VirtualLink newVirtualLink = new VirtualLink();
    newVirtualLink.setActive(sourceVirtualLink.isActive());
    newVirtualLink.setTitle(sourceVirtualLink.getTitle());
    String[] sourceURL = sourceVirtualLink.getUrl().split(":");
    String sourceURI = sourceURL.length == 1?sourceURL[0]:sourceURL[1];
    newVirtualLink.setUrl(destinationHost.getHostname() + ":" + sourceURI);
    newVirtualLink.setUri(sourceVirtualLink.getUri());
    HibernateUtil.saveOrUpdate(newVirtualLink);
    return newVirtualLink;
  }
View Full Code Here


  private void _retrieveVirtualLink(ActionRequest req, ActionResponse res,PortletConfig config,ActionForm form)
  throws Exception {

        VirtualLink ml = (VirtualLink) InodeFactory.getInode(req.getParameter("inode"),VirtualLink.class);
        Logger.debug(this, "ML:" + ml.getInode());
        req.setAttribute(WebKeys.VIRTUAL_LINK_EDIT, ml);
 
  }
View Full Code Here

   
    if (completeUrl.trim().endsWith("/")) {
        completeUrl = completeUrl.trim().substring(0, completeUrl.trim().length() - 1);
    }
   
        VirtualLink vl = null;
        try{
          vl = VirtualLinkFactory.getVirtualLinkByURL(completeUrl);
          if(vl == null || !UtilMethods.isSet(vl.getIdentifier())){
            vl = new VirtualLink();
            vl.setUrl(completeUrl);
          }
        }
        catch(DotHibernateException dhe){
          vl = new VirtualLink();
          vl.setUrl(completeUrl);
          Logger.debug(VirtualLinksCache.class, "failed to find: " + completeUrl)
        }
       
        vl = virtualLinkAPI.checkVirtualLinkForEditPermissions(vl, user);
       
        if(vl == null){
          SessionMessages.add(req,"message", "message.virtuallink.nopermission.save");
      throw new Exception(WebKeys.USER_PERMISSIONS_EXCEPTION);
        }
   
    if (vl != null && InodeUtils.isSet(vl.getInode()) && !mlForm.getInode().equalsIgnoreCase(vl.getInode())) {
      //there is another virtual link with the same url... urls are unique
      SessionMessages.add(req,"message", "message.virtuallink.uniquelink.save");
      throw new Exception(WebKeys.UNIQUE_VIRTUAL_LINK_EXCEPTION);

    }
    else {
   
      VirtualLink ml = (VirtualLink) req.getAttribute(WebKeys.VIRTUAL_LINK_EDIT);
      //removes this URL from cache
      if (UtilMethods.isSet(ml.getUrl())) {
          VirtualLinksCache.removePathFromCache(ml.getUrl());       
      }
 
      BeanUtils.copyProperties(ml,form);
       
      ml.setUrl(completeUrl);

      String htmlPageInode = mlForm.getHtmlInode();
      if (InodeUtils.isSet(htmlPageInode)) {
        //it's an internal page
        HTMLPage htmlPage = (HTMLPage) InodeFactory.getInode(htmlPageInode+"",HTMLPage.class);
        Identifier identifier = APILocator.getIdentifierAPI().find(htmlPage);
        ml.setUri(identifier.getURI());
      }
 
      HibernateUtil.saveOrUpdate(ml);
      SessionMessages.add(req,"message", "message.virtuallink.save");
     
      //reset url to cache
      VirtualLinksCache.removePathFromCache(ml.getUrl());
        VirtualLinksCache.addPathToCache(ml);

      //VirtualLinkFactory
    }
    //wipe the subscriber list form bean
View Full Code Here

TOP

Related Classes of com.dotmarketing.portlets.virtuallinks.model.VirtualLink

Copyright © 2018 www.massapicom. 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.