Package org.infoglue.cms.entities.management

Examples of org.infoglue.cms.entities.management.ContentTypeDefinitionVO


        buttons.add(accessRightsButton);
      }

      if(this.contentVO.getContentTypeDefinitionId() != null)
      {
        ContentTypeDefinitionVO contentTypeDefinitionVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithId(this.contentVO.getContentTypeDefinitionId());
        if(contentTypeDefinitionVO != null && (contentTypeDefinitionVO.getName().equalsIgnoreCase("HTMLTemplate") || contentTypeDefinitionVO.getName().equalsIgnoreCase("PageTemplate") || contentTypeDefinitionVO.getName().equalsIgnoreCase("PagePartTemplate")))
        {
          buttons.add(getComponentAccessRightsButton());
          buttons.add(getDeployComponentButton());
        }
      }
View Full Code Here


        buttons.add(accessRightsButton);
      }

      if(this.contentVO.getContentTypeDefinitionId() != null)
      {
        ContentTypeDefinitionVO contentTypeDefinitionVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithId(this.contentVO.getContentTypeDefinitionId());
        if(contentTypeDefinitionVO != null && (contentTypeDefinitionVO.getName().equalsIgnoreCase("HTMLTemplate") || contentTypeDefinitionVO.getName().equalsIgnoreCase("PageTemplate") || contentTypeDefinitionVO.getName().equalsIgnoreCase("PagePartTemplate")))
        {
          buttons.add(getComponentAccessRightsButton());
          buttons.add(getDeployComponentButton());
        }
      }
View Full Code Here

            buttons.add(accessRightsButton);
          }
 
          if(this.contentVO.getContentTypeDefinitionId() != null)
          {
            ContentTypeDefinitionVO contentTypeDefinitionVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithId(this.contentVO.getContentTypeDefinitionId());
            if(contentTypeDefinitionVO != null && (contentTypeDefinitionVO.getName().equalsIgnoreCase("HTMLTemplate") || contentTypeDefinitionVO.getName().equalsIgnoreCase("PageTemplate") || contentTypeDefinitionVO.getName().equalsIgnoreCase("PagePartTemplate")))
            {
              List interceptionPointVOList = InterceptionPointController.getController().getInterceptionPointVOList("Component");
              if(interceptionPointVOList != null && interceptionPointVOList.size() > 0)
                buttons.add(getComponentAccessRightsButton());
             
View Full Code Here

          if(this.synchronizationMethod.equalsIgnoreCase("pull"))
          {
            Iterator remoteContentTypeDefinitionVOListIterator = remoteContentTypeDefinitionVOList.iterator();
            while(remoteContentTypeDefinitionVOListIterator.hasNext())
            {
              ContentTypeDefinitionVO remoteContentTypeDefinitionVO = (ContentTypeDefinitionVO)remoteContentTypeDefinitionVOListIterator.next();
              //logger.info("remoteContentTypeDefinitionVO:" + remoteContentTypeDefinitionVO.getName());
              ContentTypeDefinitionVO localContentTypeDefinitionVO = (ContentTypeDefinitionVO)ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithName(remoteContentTypeDefinitionVO.getName());
              DeploymentCompareBean bean = new DeploymentCompareBean();
              bean.setRemoteVersion(remoteContentTypeDefinitionVO);
              if(localContentTypeDefinitionVO != null)
              {
                //logger.info("localContentTypeDefinitionVO:" + localContentTypeDefinitionVO.getName());
                  bean.setLocalVersion(localContentTypeDefinitionVO);         
              }
              deviatingContentTypes.add(bean);
            }
          }
          else
          {
            logger.info("Getting what content types are not the same from a push perspective...");
            List localContentTypeDefinitionVOList = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOList();
            Iterator localContentTypeDefinitionVOListIterator = localContentTypeDefinitionVOList.iterator();
            while(localContentTypeDefinitionVOListIterator.hasNext())
            {
              ContentTypeDefinitionVO localContentTypeDefinitionVO = (ContentTypeDefinitionVO)localContentTypeDefinitionVOListIterator.next();
              Iterator remoteContentTypeDefinitionVOListIterator = remoteContentTypeDefinitionVOList.iterator();
              ContentTypeDefinitionVO remoteContentTypeDefinitionVO = null;
              while(remoteContentTypeDefinitionVOListIterator.hasNext())
              {
                ContentTypeDefinitionVO remoteContentTypeDefinitionVOCandidate = (ContentTypeDefinitionVO)remoteContentTypeDefinitionVOListIterator.next();
                //logger.info("remoteContentTypeDefinitionVO:" + remoteContentTypeDefinitionVO.getName());
                if(remoteContentTypeDefinitionVOCandidate.getName().equals(localContentTypeDefinitionVO.getName()))
                  remoteContentTypeDefinitionVO = remoteContentTypeDefinitionVOCandidate;
             
             
              DeploymentCompareBean bean = new DeploymentCompareBean();
              bean.setLocalVersion(localContentTypeDefinitionVO);
View Full Code Here

            //logger.info("Updating missingContentTypeName:" + missingContentTypeName);
   
              Iterator remoteContentTypeDefinitionVOListIterator = remoteContentTypeDefinitionVOList.iterator();
              while(remoteContentTypeDefinitionVOListIterator.hasNext())
              {
                ContentTypeDefinitionVO remoteContentTypeDefinitionVO = (ContentTypeDefinitionVO)remoteContentTypeDefinitionVOListIterator.next();
                //logger.info("remoteContentTypeDefinitionVO:" + remoteContentTypeDefinitionVO.getName());
                if(remoteContentTypeDefinitionVO.getName().equals(missingContentTypeName))
                {
                  ContentTypeDefinitionController.getController().create(remoteContentTypeDefinitionVO);
                }
              }
          }
        }
     
        String[] deviatingContentTypeNameArray = this.getRequest().getParameterValues("deviatedContentTypeName");
        //logger.info("deviatingContentTypeNameArray:" + deviatingContentTypeNameArray);
       
        if(deviatingContentTypeNameArray != null)
        {
          for(int i=0; i<deviatingContentTypeNameArray.length; i++)
          {
            String deviatingContentTypeName = deviatingContentTypeNameArray[i];
            //logger.info("Updating deviatingContentTypeName:" + deviatingContentTypeName);
   
              Iterator remoteContentTypeDefinitionVOListIterator = remoteContentTypeDefinitionVOList.iterator();
              while(remoteContentTypeDefinitionVOListIterator.hasNext())
              {
                ContentTypeDefinitionVO remoteContentTypeDefinitionVO = (ContentTypeDefinitionVO)remoteContentTypeDefinitionVOListIterator.next();
                //logger.info("remoteContentTypeDefinitionVO:" + remoteContentTypeDefinitionVO.getName());
                if(remoteContentTypeDefinitionVO.getName().equals(deviatingContentTypeName))
                {
                  ContentTypeDefinitionVO localContentTypeDefinitionVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithName(remoteContentTypeDefinitionVO.getName());
                  String newSchemaValue = localContentTypeDefinitionVO.getSchemaValue();
                 
                    String[] attributeNameArray = this.getRequest().getParameterValues(deviatingContentTypeName + "_attributeName");
                    //logger.info("attributeNameArray:" + attributeNameArray);
                    if(attributeNameArray != null)
                    {
                      for(int j=0; j<attributeNameArray.length; j++)
                      {
                        String attributeName = attributeNameArray[j];
                        //logger.info("  * Updating attributeName:" + attributeName);
                   
                      newSchemaValue = contentTypeDefinitionController.copyAttribute(remoteContentTypeDefinitionVO.getSchemaValue(), newSchemaValue, attributeName);
                    }
                    }               
 
                    String[] categoryNameArray = this.getRequest().getParameterValues(deviatingContentTypeName + "_categoryName");
                    //logger.info("categoryNameArray:" + categoryNameArray);
                    if(categoryNameArray != null)
                    {
                      for(int j=0; j<categoryNameArray.length; j++)
                      {
                        String categoryName = categoryNameArray[j];
                        //logger.info("  * Updating categoryName:" + categoryName);
                   
                      newSchemaValue = contentTypeDefinitionController.copyCategory(remoteContentTypeDefinitionVO.getSchemaValue(), newSchemaValue, categoryName);
                    }
                    } 
 
                    String[] assetKeyArray = this.getRequest().getParameterValues(deviatingContentTypeName + "_assetKey");
                    //logger.info("assetKeyArray:" + assetKeyArray);
                    if(assetKeyArray != null)
                    {
                      for(int j=0; j<assetKeyArray.length; j++)
                      {
                        String assetKey = assetKeyArray[j];
                        //logger.info("  * Updating assetKey:" + assetKey);
                   
                      newSchemaValue = contentTypeDefinitionController.copyAssetKey(remoteContentTypeDefinitionVO.getSchemaValue(), newSchemaValue, assetKey);
                    }
                    }
                   
                  localContentTypeDefinitionVO.setSchemaValue(newSchemaValue);
                  ContentTypeDefinitionController.getController().update(localContentTypeDefinitionVO);
                }
              }
          }
        }
      }
      else
      {
        Map input = new HashMap();

        List contentTypeDefinitionVOList = new ArrayList();
        String[] missingContentTypeNameArray = this.getRequest().getParameterValues("missingContentTypeName");
        //logger.info("missingContentTypeNameArray:" + missingContentTypeNameArray);
       
        if(missingContentTypeNameArray != null)
        {
          for(int i=0; i<missingContentTypeNameArray.length; i++)
          {
            String missingContentTypeName = missingContentTypeNameArray[i];
            logger.info("Updating missingContentTypeName:" + missingContentTypeName);
            ContentTypeDefinitionVO localContentTypeDefinitionVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithName(missingContentTypeName);
            logger.info("Updating localContentTypeDefinitionVO:" + localContentTypeDefinitionVO);
            contentTypeDefinitionVOList.add(localContentTypeDefinitionVO);
          }
        }
     
        String[] deviatingContentTypeNameArray = this.getRequest().getParameterValues("deviatedContentTypeName");
        //logger.info("deviatingContentTypeNameArray:" + deviatingContentTypeNameArray);
       
        if(deviatingContentTypeNameArray != null)
        {
          for(int i=0; i<deviatingContentTypeNameArray.length; i++)
          {
            String deviatingContentTypeName = deviatingContentTypeNameArray[i];
            logger.info("Updating deviatingContentTypeName:" + deviatingContentTypeName);
            ContentTypeDefinitionVO localContentTypeDefinitionVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithName(deviatingContentTypeName);
            logger.info("Updating localContentTypeDefinitionVO as it was different:" + localContentTypeDefinitionVO);
            contentTypeDefinitionVOList.add(localContentTypeDefinitionVO);

            Map deviationArguments = new HashMap();

View Full Code Here

      String deploymentServerUrl = deploymentServerBean.getUrl();
     
      String targetEndpointAddress = deploymentServerUrl + "/services/RemoteDeploymentService";
      //logger.info("targetEndpointAddress:" + targetEndpointAddress);

      ContentTypeDefinitionVO contentTypeDefinitionVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithName("HTMLTemplate");

      if(this.synchronizationMethod == null || this.synchronizationMethod.equalsIgnoreCase("pull"))
      {
        Object[] contentVOArray = (Object[])invokeOperation(targetEndpointAddress, "getComponents", "content", null, new Class[]{ContentVO.class, ContentVersionVO.class}, "infoglue", deploymentServerBean.getUser());
        List remoteContentVOList = Arrays.asList(contentVOArray);
        Collections.sort(remoteContentVOList, new ReflectionComparator("name"));
 
        //Missing
        String[] missingRemoteContentIdArray = this.getRequest().getParameterValues("missingContentId");
        logger.info("missingRemoteContentIdArray:" + missingRemoteContentIdArray);
       
        List missingComponents = new ArrayList();
        if(missingRemoteContentIdArray != null)
        {
          for(int i=0; i<missingRemoteContentIdArray.length; i++)
          {
            String missingRemoteContentId = missingRemoteContentIdArray[i];
            logger.info("Updating remote component with missingRemoteContentId:" + missingRemoteContentId);
           
            Iterator remoteContentVOListIterator = remoteContentVOList.iterator();
            while(remoteContentVOListIterator.hasNext())
            {
              ContentVO remoteContentVO = (ContentVO)remoteContentVOListIterator.next();
              if(remoteContentVO.getId().toString().equals(missingRemoteContentId))
              {
                logger.info("Creating local copy of " + remoteContentVO.getName() + " - " + remoteContentVO.getFullPath());
               
                String fullPath = remoteContentVO.getFullPath();
                logger.info("fullPath:" + fullPath);
                int siteNodeEnd = fullPath.indexOf(" - /");
                String repositoryString = fullPath.substring(0, siteNodeEnd);
                String restString = fullPath.substring(siteNodeEnd + 4);
                logger.info("restString:" + restString);
                restString = restString.substring(0, restString.lastIndexOf("/"));
                logger.info("restString:" + restString);
                if(restString.indexOf("/") > -1)
                  restString = restString.substring(restString.indexOf("/") + 1);
                else
                  restString = "";
               
                logger.info("restString:" + restString);
               
                logger.info("repositoryString:" + repositoryString);
                logger.info("restString:" + restString);
                try
                {
                  RepositoryVO repositoryVO = RepositoryController.getController().getRepositoryVOWithName(repositoryString);
                  logger.info("repositoryVO:" + repositoryVO);
                  if(repositoryVO == null)
                  {
                    logger.warn("No repository found by name " + repositoryString + ". Looking for a default repository where other templates are located.");
                    List templates = ContentController.getContentController().getContentVOWithContentTypeDefinition("HTMLTemplate");
                    if(templates != null && templates.size() > 0)
                    {
                      ContentVO contentVO = (ContentVO)templates.get(0);
                      repositoryVO = RepositoryController.getController().getRepositoryVOWithId(contentVO.getRepositoryId());
                      logger.info("repositoryVO:" + repositoryVO);
                    }
                  }
                 
                  if(repositoryVO != null)
                  {
                    LanguageVO languageVO = LanguageController.getController().getMasterLanguage(repositoryVO.getRepositoryId());
 
                    ContentVO parentContent = ContentController.getContentController().getContentVOWithPath(repositoryVO.getId(), restString, true, this.getInfoGluePrincipal());
                    logger.info("parentContent:" + parentContent);
                    ContentVO newContentVO = ContentController.getContentController().create(parentContent.getId(), contentTypeDefinitionVO.getContentTypeDefinitionId(), parentContent.getRepositoryId(), remoteContentVO);
                    logger.info("Now we want to create the version also on:" + newContentVO.getName());
                    ContentVersionVO contentVersionVO = new ContentVersionVO();
                    contentVersionVO.setVersionComment("deployment");
                    contentVersionVO.setVersionModifier(this.getInfoGluePrincipal().getName());
                    if(remoteContentVO.getVersions() != null && remoteContentVO.getVersions().length > 0)
View Full Code Here

      }
     
      logger.warn("Precaching all HTMLTemplates and PagePartTemplates");
      try
      {
        ContentTypeDefinitionVO htmlTemplateContentType = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithName("HTMLTemplate", db);
        ContentTypeDefinitionVO pagePartTemplateContentType = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithName("PagePartTemplate", db);
       
        Timer t = new Timer();
        List<ContentVersionVO> componentContentVersionVOList = null;
        if(pagePartTemplateContentType != null)
        {
          componentContentVersionVOList = ContentControllerProxy.getController().getLatestContentVersionVOListByContentTypeIdForSmallCollections(new Integer[]{htmlTemplateContentType.getId(), pagePartTemplateContentType.getId()}, db);
          logger.info("Getting componentContentVersionVOList 1 " + componentContentVersionVOList.size() + " took: " + t.getElapsedTime());
          //componentContentVersionVOList = ContentControllerProxy.getController().getLatestContentVersionVOListByContentTypeId(new Integer[]{htmlTemplateContentType.getId(), pagePartTemplateContentType.getId()}, db);
          //logger.error("Getting componentContentVersionVOList 2 " + componentContentVersionVOList.size() + " took: " + t.getElapsedTime());
        }
        else
View Full Code Here

  public boolean getIsPagePartTemplate(ContentVO contentVO)
  {
    try
    {
      ContentTypeDefinitionVO ctdVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithId(contentVO.getContentTypeDefinitionId());
      if(ctdVO != null && ctdVO.getName().equalsIgnoreCase("PagePartTemplate"))
        return true;
      else
        return false;     
    }
    catch (Exception e)
View Full Code Here

        logger.info("componentPropertyDefinition vill ha en auto create:" + componentPropertyDefinition);
        String method = componentPropertyDefinition.getAutoCreateContentMethod();
        String path = componentPropertyDefinition.getAutoCreateContentPath();
        String allowedContentTypeNames = componentPropertyDefinition.getAllowedContentTypeNames();
        String allowedContentTypeName = allowedContentTypeNames.split(",")[0];
        ContentTypeDefinitionVO createContentTypeDefinitionVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithName(allowedContentTypeName, db);
        logger.info("method:" + method);
        logger.info("path:" + path);
        logger.info("createContentTypeDefinitionVO:" + createContentTypeDefinitionVO);
       
        if(createContentTypeDefinitionVO == null || method == null)
          continue;
         
        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);   
View Full Code Here

          ContentVO contentVO = (ContentVO) iterator.next();
          if(contentVO.getContentTypeDefinitionId() != null && !contentVO.getIsBranch().booleanValue())
          {
            try
            {
              ContentTypeDefinitionVO contentTypeDefinitionVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithId(contentVO.getContentTypeDefinitionId());
              boolean exists = false;
              for(int i=0; i<allowedContentTypeIds.length; i++)
              {
                  String allowedId = allowedContentTypeIds[i];
                 
                  if(allowedId.equalsIgnoreCase(contentTypeDefinitionVO.getId().toString()))
                {
                      exists = true;
                      break;
                }
              }
View Full Code Here

TOP

Related Classes of org.infoglue.cms.entities.management.ContentTypeDefinitionVO

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.