Package org.infoglue.cms.entities.content

Examples of org.infoglue.cms.entities.content.ContentVO


      if(logger.isInfoEnabled())
        logger.info("children:" + children.size());
      Iterator<ContentVO> childrenIterator = children.iterator();
      while(childrenIterator.hasNext())
      {
        ContentVO contentVO = childrenIterator.next();
            contentChildren.add( new ContentResource(contentVO) );
      }
    }
    catch (Exception e)
    {
View Full Code Here


*/
public class ContentNodeVersionSupplier extends BaseNodeSupplier
{
  public ContentNodeVersionSupplier(Integer repositoryId, String userName) throws SystemException
  {
    ContentVO vo =null;
    try
    {
      vo = ContentControllerProxy.getController().getRootContentVO(repositoryId, userName);
      BaseNode rootNode =  new ContentNodeImpl();
      rootNode.setChildren(true);
      rootNode.setId(vo.getId());
      rootNode.setTitle(vo.getName());
      rootNode.setContainer(vo.getIsBranch().booleanValue())
      setRootNode(rootNode);
    }
    catch (ConstraintException e)
    {
    }
View Full Code Here

   
    // Do it in two loops to get sorting right
    Iterator i = l.iterator();
    while(i.hasNext())
    {
      ContentVO vo = (ContentVO) i.next();
      if (vo.getIsBranch().booleanValue())
      {
        BaseNode node =  new ContentNodeImpl();
        node.setId(vo.getId());
        node.setContainer(true);
       
        node.setChildren((vo.getChildCount().intValue() > 0)); //
       
        node.setTitle(vo.getName());
       
        ret.add(node);
      }
    }
    i = l.iterator();
    while(i.hasNext())
    {
      ContentVO vo = (ContentVO) i.next();
      if (!vo.getIsBranch().booleanValue())
      {
        // Betrakta dessa som container nodes
       
        BaseNode node =  new ContentNodeImpl();
        node.setId( new Integer(- vo.getId().intValue()) );
        node.setContainer(true);
        node.setTitle(vo.getName());
        node.setChildren((vo.getChildCount().intValue() > 0));
        ret.add(node);       
      }
    }
   
    return ret;
View Full Code Here

       
        //Getting deviatingComponents
        Object[] contentVOArray = (Object[])invokeOperation(targetEndpointAddress, "getComponents", "content", null, new Class[]{ContentVO.class, ContentVersionVO.class}, "infoglue", new Class[]{ContentVO.class, ContentVersionVO.class}, deploymentServerBean.getUser());
        List remoteContentVOList = Arrays.asList(contentVOArray);
        //List components = ContentController.getContentController().getContentVOWithContentTypeDefinition("HTMLTemplate");
        ContentVO localComponentContent = ContentController.getContentController().getContentVOWithId(this.contentId);
        logger.info("localComponentContent:" + localComponentContent.getName());
        logger.info("remoteContentVOList:" + remoteContentVOList.size());
      String localFullPath = ContentController.getContentController().getContentPath(localComponentContent.getId(), true, true);
      String localFullPath2 = ContentController.getContentController().getContentPath(localComponentContent.getId(), true, true).replaceFirst("/", " - /");
     
        boolean match = false;
        Iterator remoteContentVOListIterator = remoteContentVOList.iterator();
        while(remoteContentVOListIterator.hasNext())
        {
          ContentVO remoteContentVO = (ContentVO)remoteContentVOListIterator.next();
          logger.info("remoteContentVO:" + remoteContentVO.getName() + " - " + remoteContentVO.getFullPath());
          //logger.info("Versions:" + remoteContentVO.getContentVersion());
         
          if(localFullPath.equals(remoteContentVO.getFullPath()) || localFullPath2.equals(remoteContentVO.getFullPath()))
          {
            match = true;
           
            DeploymentCompareBean bean = new DeploymentCompareBean();
            bean.setRemoteVersion(remoteContentVO);
View Full Code Here

       
          for(ContentVersionVO incompleteContentVersionVO : componentContentVersionVOList) //The version is not populated with version value
          {
              if(incompleteContentVersionVO != null)
              {
                ContentVO contentVO = ContentController.getContentController().getSmallContentVOWithId(incompleteContentVersionVO.getContentId(), db, null);
               
                String groupNameDefault = "Unknown";
            String descriptionDefault = "Unknown";
            ContentVersionVO fullContentVersionVO = ContentVersionController.getContentVersionController().getContentVersionVOWithId(incompleteContentVersionVO.getId(), db);
            String groupNameAttribute = ContentVersionController.getContentVersionController().getAttributeValue(fullContentVersionVO, "GroupName", false);
                String descriptionAttribute = ContentVersionController.getContentVersionController().getAttributeValue(fullContentVersionVO, "Description", false);
                logger.info("GroupInfo ContentVersionId:" + incompleteContentVersionVO.getId() + " - " + groupNameAttribute);
            contentVO.getExtraProperties().put("GroupName", (groupNameAttribute == null ? groupNameDefault : groupNameAttribute));
            contentVO.getExtraProperties().put("Description", (descriptionAttribute == null ? descriptionDefault : descriptionAttribute));
 
                List<ContentVO> allComponents = templatesAndPagePartMap.get("all");
                if(allComponents == null)
                {
                  allComponents = new ArrayList<ContentVO>();
                  templatesAndPagePartMap.put("all", allComponents);
                }
                allComponents.add(contentVO);
                logger.info("Adding " + contentVO.getName() + " to group " + contentVO.getName());
               
                List<ContentVO> nameComponents = templatesAndPagePartMap.get(contentVO.getName());
                if(nameComponents == null)
                {
                  nameComponents = new ArrayList<ContentVO>();
                  templatesAndPagePartMap.put(contentVO.getName(), nameComponents);
                }
                nameComponents.add(contentVO);
 
                logger.info("Adding " + contentVO.getName() + " to group " + contentVO.getName());
                if(groupNameAttribute != null && !groupNameAttribute.equals(""))
                {
                  String[] groupNames = groupNameAttribute.split(",");
                  for(String groupName : groupNames)
                  {
                    List<ContentVO> groupComponents = templatesAndPagePartMap.get(groupName.trim());
                    if(groupComponents == null)
                    {
                      groupComponents = new ArrayList<ContentVO>();
                      templatesAndPagePartMap.put(groupName.trim(), groupComponents);
                    }
                    groupComponents.add(contentVO);
                    logger.info("Adding " + contentVO.getName() + " to " + groupName.trim());
                  }
                }
              }
          }
         
View Full Code Here

        {
          List<ContentVO> groupList = templatesAndPagePartMap.get(key);
          Iterator<ContentVO> groupListIterator = groupList.iterator();
          while(groupListIterator.hasNext())
          {
            ContentVO cvVO = groupListIterator.next();
            if(cvVO.getId().intValue() == contentId.intValue())
            {
              logger.info("Removing " + cvVO.getName() + " from group:" + key);
              groupListIterator.remove();
            }
          }
        }
      }
    }
    else
    {
      templatesAndPagePartMap = new HashMap<String,List<ContentVO>>();
      CacheController.cacheObject("componentContentsCache", cacheKey, templatesAndPagePartMap);
    }
   
    try
    {
        ContentVO contentVO = ContentController.getContentController().getContentVOWithId(contentId);
        if(contentVO != null)
        {
          LanguageVO masterLanguageVO = LanguageController.getController().getMasterLanguage(contentVO.getRepositoryId());
          ContentVersionVO contentVersionVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(contentId, masterLanguageVO.getId());
   
          String groupNameDefault = "Unknown";
        String descriptionDefault = "Unknown";
          String groupNameAttribute = ContentVersionController.getContentVersionController().getAttributeValue(contentVersionVO, "GroupName", false);
          String descriptionAttribute = ContentVersionController.getContentVersionController().getAttributeValue(contentVersionVO, "Description", false);
            logger.info("GroupInfo ContentVersionId:" + contentVersionVO.getId() + " - " + groupNameAttribute);
        contentVO.getExtraProperties().put("GroupName", (groupNameAttribute == null ? groupNameDefault : groupNameAttribute));
        contentVO.getExtraProperties().put("Description", (descriptionAttribute == null ? descriptionDefault : descriptionAttribute));
     
          List<ContentVO> allComponents = templatesAndPagePartMap.get("all");
          if(allComponents == null)
          {
            allComponents = new ArrayList<ContentVO>();
            templatesAndPagePartMap.put("all", allComponents);
          }
          allComponents.add(contentVO);
          logger.info("Adding " + contentVO.getName() + " to group " + contentVO.getName());
         
          List<ContentVO> nameComponents = templatesAndPagePartMap.get(contentVO.getName());
          if(nameComponents == null)
          {
            nameComponents = new ArrayList<ContentVO>();
            templatesAndPagePartMap.put(contentVO.getName(), nameComponents);
          }
          nameComponents.add(contentVO);
   
          logger.info("Adding " + contentVO.getName() + " to group " + contentVO.getName());
          if(groupNameAttribute != null && !groupNameAttribute.equals(""))
          {
              String[] groupNames = groupNameAttribute.split(",");
              for(String groupName : groupNames)
              {
                logger.info("groupName:" + groupName);
                List<ContentVO> groupComponents = templatesAndPagePartMap.get(groupName.trim());
                if(groupComponents == null)
                {
                  groupComponents = new ArrayList<ContentVO>();
                  templatesAndPagePartMap.put(groupName.trim(), groupComponents);
                }
                groupComponents.add(contentVO);
                logger.info("Adding " + contentVO.getName() + " to " + groupName.trim());
              }
          }
        }
    }
    catch (Exception e)
View Full Code Here

    List results = ContentControllerProxy.getController().getACContentVOList(principal, arguments);

      Iterator resultsIterator = results.iterator();
      while(resultsIterator.hasNext())
      {
          ContentVO contentVO = (ContentVO)resultsIterator.next();

      boolean isPartOfAllowedComponentNames = false;
      if(allowedComponentNames != null && allowedComponentNames.length > 0)
      {
        for(int i=0; i<allowedComponentNames.length; i++)
            {
                if(contentVO.getName().equals(allowedComponentNames[i]))
                  isPartOfAllowedComponentNames = true;
            }
      }
     
      boolean isPartOfAllowedComponentGroupNames = false;
      if(allowedComponentGroups != null && allowedComponentGroups.length > 0)
      {
        LanguageVO masterLanguageVO = LanguageController.getController().getMasterLanguage(contentVO.getRepositoryId());   

            ContentVersionVO contentVersionVO = ContentVersionController.getContentVersionController().getLatestContentVersionVO(contentVO.getContentId(), masterLanguageVO.getId());
            String groupName = null;
            if(contentVersionVO != null)
              groupName = ContentVersionController.getContentVersionController().getAttributeValue(contentVersionVO, "GroupName", false);

            for(int i=0; i<allowedComponentGroups.length; i++)
            {
              String allowedComponentGroup = allowedComponentGroups[i];
              if(groupName != null && groupName.indexOf(allowedComponentGroup) > -1)
                isPartOfAllowedComponentGroupNames = true;
            }
      }

      boolean isPartOfDisallowedComponentNames = false;
      if(disallowedComponentNames != null && disallowedComponentNames.length > 0)
      {
            for(int i=0; i<disallowedComponentNames.length; i++)
            {
                if(contentVO.getName().equals(disallowedComponentNames[i]))
                  isPartOfDisallowedComponentNames = true;
            }
      }

      if(disallowedComponentNames != null && disallowedComponentNames.length > 0 && isPartOfDisallowedComponentNames)
View Full Code Here

        if(unionList != null && unionList.size() > 0)
        {
          Iterator<ContentVO> resultsIterator = results.iterator();
          while(resultsIterator.hasNext())
          {
            ContentVO originalListContent = resultsIterator.next();
            boolean isInAllUnions = true;
            for(List<ContentVO> contentList : unionList)
            {
              if(contentList != null)
              {
                boolean isInUnions = false;
                for(ContentVO unionContent : contentList)
                {
                  if(unionContent.getName().equalsIgnoreCase(originalListContent.getName()))
                    isInUnions = true;
                }
               
                if(!isInUnions)
                  isInAllUnions = false;
              }
            }
           
            if(!isInAllUnions)
              resultsIterator.remove();
          }
        }
      }
     
      if(disallowedComponentNames != null && disallowedComponentNames.length > 0)
      {
            for(int i=0; i<disallowedComponentNames.length; i++)
            {
                String disallowedComponentName = disallowedComponentNames[i];
                for(ContentVO contentVO : results)
                {
                  if(contentVO.getName().equals(disallowedComponentName))
                  {
                    logger.info("Removing disallowed:" + contentVO.getName());
                    results.remove(contentVO);
                    break;
                  }
                }
            }
      }
      if(logger.isInfoEnabled())
        t.printElapsedTime("Collecting from groups took");
     
      List<ContentVO> authorizedComponents = new ArrayList<ContentVO>();
      for(ContentVO contentVO : results)
      {
        boolean hasAccess = AccessRightController.getController().getIsPrincipalAuthorized(db, principal, "Component.Select", "" + contentVO.getId(), false);
        if(hasAccess)
          authorizedComponents.add(contentVO);
      }
      if(logger.isInfoEnabled())
        t.printElapsedTime("Checking access rights for components took");
      return authorizedComponents;
    }
    else
    {
      List<ContentVO> results = ContentControllerProxy.getController().getACContentVOList(principal, arguments, "Component.Select", db);
 
        Iterator resultsIterator = results.iterator();
        while(resultsIterator.hasNext())
        {
            ContentVO contentVO = (ContentVO)resultsIterator.next();
 
        boolean isPartOfAllowedComponentNames = false;
        if(allowedComponentNames != null && allowedComponentNames.length > 0)
        {
          for(int i=0; i<allowedComponentNames.length; i++)
              {
                  if(contentVO.getName().equals(allowedComponentNames[i]))
                    isPartOfAllowedComponentNames = true;
              }
        }
       
        boolean isPartOfAllowedComponentGroupNames = false;
        if(allowedComponentGroups != null && allowedComponentGroups.length > 0 && contentVO.getRepositoryId() != null)
        {
          LanguageVO masterLanguageVO = LanguageController.getController().getMasterLanguage(contentVO.getRepositoryId(), db);
          if(masterLanguageVO != null)
          {
            //logger.info("masterLanguageVO for " + contentVO.getRepositoryId() + " is " + masterLanguageVO);
                ContentVersionVO contentVersionVO = ContentVersionController.getContentVersionController().getLatestContentVersionVO(contentVO.getContentId(), masterLanguageVO.getId(), db);
                String groupName = null;
                if(contentVersionVO != null)
                  groupName = ContentVersionController.getContentVersionController().getAttributeValue(contentVersionVO, "GroupName", false);
   
                for(int i=0; i<allowedComponentGroups.length; i++)
                {
                  String allowedComponentGroup = allowedComponentGroups[i];
                  if(groupName != null && groupName.indexOf(allowedComponentGroup) > -1)
                    isPartOfAllowedComponentGroupNames = true;
                }
          }
        }
 
        boolean isPartOfDisallowedComponentNames = false;
        if(disallowedComponentNames != null && disallowedComponentNames.length > 0)
        {
              for(int i=0; i<disallowedComponentNames.length; i++)
              {
                  if(contentVO.getName().equals(disallowedComponentNames[i]))
                    isPartOfDisallowedComponentNames = true;
              }
        }
 
        if(disallowedComponentNames != null && disallowedComponentNames.length > 0 && isPartOfDisallowedComponentNames)
View Full Code Here

         
        if(path.indexOf("/") == 0)
          path = path.substring(1);
       
        SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId(siteNodeId, db);
        ContentVO parentContentVO = ContentController.getContentController().getRootContent(db, siteNodeVO.getRepositoryId(), principal.getName(), true).getValueObject();
        if(method.equals("siteStructure"))
        {
          String siteNodePath = SiteNodeController.getController().getSiteNodePath(siteNodeVO.getId(), db);
          logger.info("siteNodePath:" + siteNodePath);
          parentContentVO = ContentController.getContentController().getContentVOWithPath(siteNodeVO.getRepositoryId(), path + siteNodePath, true, principal, db);
        }
        else if(method.equals("fixedPath"))
        {
          parentContentVO = ContentController.getContentController().getContentVOWithPath(siteNodeVO.getRepositoryId(), path, true, principal, db);
        }
       
        ContentVO autoContentVO = new ContentVO();
        autoContentVO.setName(siteNodeVO.getName() + " - " + componentPropertyDefinition.getName());
        autoContentVO.setCreatorName(principal.getName());
        autoContentVO.setIsBranch(false);

        StringBuffer sb = new StringBuffer();
        sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?><article xmlns=\"x-schema:ArticleSchema.xml\"><attributes>");
        List contentTypeAttributes = ContentTypeDefinitionController.getController().getContentTypeAttributes(createContentTypeDefinitionVO, true);
        Iterator contentTypeAttributesIterator = contentTypeAttributes.iterator();
        while(contentTypeAttributesIterator.hasNext())
        {
          ContentTypeAttribute contentTypeAttribute = (ContentTypeAttribute)contentTypeAttributesIterator.next();
          String initialValue = null;
          if(contentTypeAttribute.getContentTypeAttribute("initialData") != null && contentTypeAttribute.getContentTypeAttribute("initialData").getContentTypeAttributeParameterValue() != null)
          {
            initialValue = contentTypeAttribute.getContentTypeAttribute("initialData").getContentTypeAttributeParameterValue().getValue("label");
          }
         
          boolean skip = false;
          if(contentTypeAttribute.getContentTypeAttribute("enableRelationEditor") != null && contentTypeAttribute.getContentTypeAttribute("enableRelationEditor").getContentTypeAttributeParameterValue() != null && contentTypeAttribute.getContentTypeAttribute("enableRelationEditor").getContentTypeAttributeParameterValue().getValue("label").equals("true"))
          {
            skip = true;
          }
          if(contentTypeAttribute.getContentTypeAttribute("enableContentRelationEditor") != null && contentTypeAttribute.getContentTypeAttribute("enableContentRelationEditor").getContentTypeAttributeParameterValue() != null && contentTypeAttribute.getContentTypeAttribute("enableContentRelationEditor").getContentTypeAttributeParameterValue().getValue("label").equals("true"))
          {
            skip = true;
          }
          if(contentTypeAttribute.getContentTypeAttribute("enableStructureRelationEditor") != null && contentTypeAttribute.getContentTypeAttribute("enableStructureRelationEditor").getContentTypeAttributeParameterValue() != null && contentTypeAttribute.getContentTypeAttribute("enableStructureRelationEditor").getContentTypeAttributeParameterValue().getValue("label").equals("true"))
          {
            skip = true;
          }
          if(!skip)
          {
            if(initialValue == null || initialValue.trim().equals(""))
              initialValue = "State " + contentTypeAttribute.getName();
            sb.append("<" + contentTypeAttribute.getName() + "><![CDATA[" + initialValue + "]]></" + contentTypeAttribute.getName() + ">");
          }
          else
            logger.info("Skipping:" + contentTypeAttribute.getName());
        }
        sb.append("</attributes></article>");
       
        String defaultValue = sb.toString();

        ContentVersionVO autoContentVersionVO = new ContentVersionVO();
        autoContentVersionVO.setVersionComment("Automatically created");
        autoContentVersionVO.setVersionModifier(principal.getName());
        autoContentVersionVO.setVersionValue(defaultValue);
       
        autoContentVO = ContentController.getContentController().create(db, parentContentVO.getId(), createContentTypeDefinitionVO.getId(), siteNodeVO.getRepositoryId(), autoContentVO).getValueObject();
        ContentVersionController.getContentVersionController().create(autoContentVO.getId(), languageId, autoContentVersionVO, null, db);
       
        Locale locale = LanguageController.getController().getLocaleWithId(languageId, db);
        LanguageVO masterLanguageVO = LanguageController.getController().getMasterLanguage(siteNodeVO.getRepositoryId(), db);   

        String entity = "Content";
        Integer entityId  = new Integer(autoContentVO.getId());
        String propertyName = "" + componentPropertyDefinition.getName();
       
        ComponentController.getController().addComponentPropertyBinding(document, locale, siteNodeId, languageId, masterLanguageVO.getId(), entity, entityId, propertyName, newComponentId, path, assetKey, principal);
      }
    }
View Full Code Here

  {
    String template = null;
     
    try
    {
      ContentVO contentVO = NodeDeliveryController.getNodeDeliveryController(siteNodeId, languageId, new Integer(-1)).getBoundContent(principal, siteNodeId, languageId, true, "Meta information", DeliveryContext.getDeliveryContext());

      if(contentVO == null)
        throw new SystemException("There was no template bound to this page which makes it impossible to render.")
     
      ContentVersionVO contentVersionVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(contentVO.getId(), languageId);
      if(contentVersionVO == null)
      {
        SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId(siteNodeId);
        LanguageVO masterLanguage = LanguageController.getController().getMasterLanguage(siteNodeVO.getRepositoryId());
        contentVersionVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(contentVO.getId(), masterLanguage.getLanguageId());
      }
     
      template = ContentVersionController.getContentVersionController().getAttributeValue(contentVersionVO.getId(), "ComponentStructure", false);
     
      if(template == null)
View Full Code Here

TOP

Related Classes of org.infoglue.cms.entities.content.ContentVO

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.