Package org.infoglue.cms.controllers.kernel.impl.simple

Examples of org.infoglue.cms.controllers.kernel.impl.simple.ContentController


      if(parent.intValue() > -1)
      {
      Collection containerNodes = sup.getChildContainerNodes(parent);
      Collection childNodes = sup.getChildLeafNodes(parent);
     
      ContentController contentController = ContentController.getContentController();
      ContentVersionController contentVersionController = ContentVersionController.getContentVersionController();

      Iterator it = containerNodes.iterator();
      while (it.hasNext())
      {
        BaseNode theNode = (BaseNode) it.next();
        if (theNode.isContainer() && sup.hasChildren())
        {
          theNode.setChildren(sup.hasChildren(theNode.getId()));
        }
       
        // String src = theNode.hasChildren() ? action + "?repositoryId=" + repositoryId + urlArgSeparator + "parent=" + theNode.getId(): "";
        String src = action + "?repositoryId=" + repositoryId + urlArgSeparator + (sortLanguageId != null ? "sortLanguageId=" + sortLanguageId : "") + urlArgSeparator + "parent=" + theNode.getId();
        if(createAction && src.length() >0) src += urlArgSeparator + "createAction=true";
        if(createAction && src.length() >0) src += urlArgSeparator + "showLeafs=" + showLeafs;
        if(action.length()>0 && src.length() >0) src += urlArgSeparator + "action=" + action;
        String allowedContentTypeIdsUrlEncodedString = getAllowedContentTypeIdsAsUrlEncodedString();
        if(allowedContentTypeIdsUrlEncodedString.length()>0 && src.length() >0) src += urlArgSeparator + allowedContentTypeIdsUrlEncodedString;
         
            Element elm = root.addElement("tree");
            elm
              .addAttribute("id", "" + theNode.getId())
              .addAttribute("parent", "" + parent)
              .addAttribute("repositoryId", "" + repositoryId)
              .addAttribute("text", encode(theNode.getTitle()))
              .addAttribute("src", src)
              .addAttribute("isLocalized", (String)theNode.getParameters().get("isLocalized"))
              .addAttribute("isLanguageAvailable", (String)theNode.getParameters().get("isLanguageAvailable"))
              .addAttribute("isHidden", (String)theNode.getParameters().get("isHidden"))
              .addAttribute("type", TYPE_FOLDER)
              .addAttribute("hasChildren", "" + theNode.hasChildren());
           
            if(theNode.getParameters().containsKey("contentTypeDefinitionId"))
              elm.addAttribute("contentTypeDefinitionId", "" + theNode.getParameters().get("contentTypeDefinitionId"));
           
            if(theNode.getParameters().containsKey("isProtected"))
              elm.addAttribute("isProtected", (String)theNode.getParameters().get("isProtected"));

            if(theNode.getParameters().containsKey("stateId"))
              elm.addAttribute("stateId", (String)theNode.getParameters().get("stateId"));

            if(createAction) elm.addAttribute("action", makeAction(theNode));
      }
      
      it = childNodes.iterator();
      while (it.hasNext())
      {
        BaseNode theNode = (BaseNode) it.next();
       
        String text = theNode.getTitle();
        String action = makeAction(theNode);
            String type = TYPE_ITEM;
            Element elm = root.addElement("tree");
            elm
              .addAttribute("id", "" + theNode.getId())
              .addAttribute("parent", "" + parent)
              .addAttribute("repositoryId", "" + repositoryId)
              .addAttribute("text", encode(text))
              .addAttribute("type", type)
        ;

            if(theNode.getParameters().containsKey("contentTypeDefinitionId"))
              elm.addAttribute("contentTypeDefinitionId", "" + theNode.getParameters().get("contentTypeDefinitionId"));

            if(theNode.getParameters().containsKey("isProtected"))
              elm.addAttribute("isProtected", (String)theNode.getParameters().get("isProtected"));

            if(theNode.getParameters().containsKey("stateId"))
              elm.addAttribute("stateId", (String)theNode.getParameters().get("stateId"));

            if(createAction)
              elm.addAttribute("action", action);
            else
            {
              ContentVersionVO activeVersion = contentVersionController.getLatestActiveContentVersionVO(theNode.getId(), LanguageController.getController().getMasterLanguage(repositoryId).getLanguageId());
              if(activeVersion!=null && !useTemplate)
              {
                  elm.addAttribute("activeVersion", "" + activeVersion.getContentVersionId());
                  elm.addAttribute("activeVersionStateId", "" + activeVersion.getStateId());
                  elm.addAttribute("activeVersionModifier", "" + activeVersion.getVersionModifier());
              }
            }
           
            //TODO - this was a quickfix only
            if(!useTemplate && sup.getClass().getName().indexOf("Content") > -1)
            {
              if(theNode.getParameters().containsKey("contentTypeDefinitionId"))
                elm.addAttribute("contentTypeId", "" + theNode.getParameters().get("contentTypeDefinitionId"));
              else
              {
                try
                {
                    ContentTypeDefinitionVO contentTypeDefinitionVO = contentController.getContentTypeDefinition(theNode.getId());
                  if(contentTypeDefinitionVO != null)
                      elm.addAttribute("contentTypeId","" + contentTypeDefinitionVO.getContentTypeDefinitionId());
                }
                catch (Exception e)
                {
View Full Code Here


   * This is a method to get hold of the SiteNodeVersionController.
   */
 
  public ContentController getContentController()
  {
    return new ContentController();
  }
View Full Code Here

    return contentVersionVO;
  }

    public Element getContentElement(Integer contentId) throws Bug, Exception
    {
    ContentController contentController = ContentController.getContentController();
        ContentVO vo = contentController.getContentVOWithId(contentId);
        return getContentElement(vo);
    }
View Full Code Here

      if(parent.intValue() > -1)
      {
      Collection containerNodes = sup.getChildContainerNodes(parent);
      Collection childNodes = sup.getChildLeafNodes(parent);
     
      ContentController contentController = ContentController.getContentController();
      ContentVersionController contentVersionController = ContentVersionController.getContentVersionController();

      Iterator it = containerNodes.iterator();
      while (it.hasNext())
      {
        BaseNode theNode = (BaseNode) it.next();
        if (theNode.isContainer() && sup.hasChildren())
        {
          theNode.setChildren(sup.hasChildren(theNode.getId()));
        }
       
        String src = theNode.hasChildren() ? action + "?repositoryId=" + repositoryId + urlArgSeparator + "parent=" + theNode.getId(): "";
        if(createAction && src.length() >0) src += urlArgSeparator + "createAction=true";
        if(createAction && src.length() >0) src += urlArgSeparator + "showLeafs=" + showLeafs;
        if(action.length()>0 && src.length() >0) src += urlArgSeparator + "action=" + action;
        String allowedContentTypeIdsUrlEncodedString = getAllowedContentTypeIdsAsUrlEncodedString();
          if(allowedContentTypeIdsUrlEncodedString.length()>0 && src.length() >0) src += urlArgSeparator + allowedContentTypeIdsUrlEncodedString;
             
            Element elm = root.addElement("tree");
            elm
              .addAttribute("id", "" + theNode.getId())
              .addAttribute("parent", "" + parent)
              .addAttribute("repositoryId", "" + repositoryId)
              .addAttribute("text", theNode.getTitle())
              .addAttribute("src", src)
              .addAttribute("type", TYPE_FOLDER);
           
           
            if(createAction) elm.addAttribute("action", makeAction(theNode));
      }
     
      it = childNodes.iterator();
      while (it.hasNext())
      {
        BaseNode theNode = (BaseNode) it.next();
        String text = theNode.getTitle();
        String action = makeAction(theNode);
            String type = TYPE_ITEM;
            Element elm = root.addElement("tree");
            elm
              .addAttribute("id", "" + theNode.getId())
              .addAttribute("parent", "" + parent)
              .addAttribute("repositoryId", "" + repositoryId)
              .addAttribute("text", text)
              .addAttribute("type", type)
        ;
            if(createAction)
              elm.addAttribute("action", action);
            else
            {
              ContentVersionVO activeVersion = contentVersionController.getLatestActiveContentVersionVO(theNode.getId(), LanguageController.getController().getMasterLanguage(repositoryId).getLanguageId());
              if(activeVersion!=null && !useTemplate)
                  elm.addAttribute("activeVersion", "" + activeVersion.getContentVersionId());
            }
           
            if(!useTemplate)
              elm.addAttribute("contentTypeId","" + contentController.getContentTypeDefinition(theNode.getId()).getContentTypeDefinitionId());
      }
     
          out(getFormattedDocument(doc));
        return null;
      }
View Full Code Here

TOP

Related Classes of org.infoglue.cms.controllers.kernel.impl.simple.ContentController

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.