Package org.infoglue.cms.entities.management

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


      }
     
      for(int i=0; i<contentTypeDefinitionIds.length; i++)
      {
        Integer contentTypeDefinitionId = new Integer(contentTypeDefinitionIds[i]);
        ContentTypeDefinition contentTypeDefinition = ContentTypeDefinitionController.getController().getContentTypeDefinitionWithId(contentTypeDefinitionId, db);
        RoleContentTypeDefinitionImpl roleContentTypeDefinitionImpl = new RoleContentTypeDefinitionImpl();
        roleContentTypeDefinitionImpl.setRoleName(roleName);
        roleContentTypeDefinitionImpl.setContentTypeDefinition(contentTypeDefinition);
        db.create(roleContentTypeDefinitionImpl);
      }
View Full Code Here


          this.languageId = masterLanguage.getLanguageId();
          }
          else
            skipInitialLanguage = true;
         
        ContentTypeDefinition contentTypeDefinition = ContentTypeDefinitionController.getController().getContentTypeDefinitionWithName("Meta info", db);
        this.metaInfoContentTypeDefinitionId = contentTypeDefinition.getId();
       
        SiteNodeVO siteNode = SiteNodeController.getController().getSiteNodeVOWithId(this.siteNodeId, db);

        if(this.changeStateToWorking != null && this.changeStateToWorking.equalsIgnoreCase("true"))
        {
View Full Code Here

    if(getContentVO() != null && getContentVersionVO() != null)
    {
      try
      {
        final ContentTypeDefinitionController ctdController = ContentTypeDefinitionController.getController();
        final ContentTypeDefinition ctd = ctdController.getContentTypeDefinitionWithId(getContentVO().getContentTypeDefinitionId(), getDatabase());
        final Collection contentTypeAttributes = ctdController.getContentTypeAttributes(ctd.getValueObject(), true);
        for(final Iterator i=contentTypeAttributes.iterator(); i.hasNext(); )
        {
          final ContentTypeAttribute attribute = (ContentTypeAttribute) i.next();
          values.put(attribute.getName(), ContentVersionController.getContentVersionController().getAttributeValue(getContentVersionVO(), attribute.getName(), false));
        }
View Full Code Here

  private void updateContentTypeDefinitions(Collection contentTypeDefinitions, Map categoryIdMap)
  {
    Iterator contentTypeDefinitionsIterator = contentTypeDefinitions.iterator();
    while(contentTypeDefinitionsIterator.hasNext())
    {
      ContentTypeDefinition contentTypeDefinition = (ContentTypeDefinition)contentTypeDefinitionsIterator.next();
      String schema = contentTypeDefinition.getSchemaValue();
      Iterator categoryIdMapIterator = categoryIdMap.keySet().iterator();
      while(categoryIdMapIterator.hasNext())
      {
        Integer oldId = (Integer)categoryIdMapIterator.next();
        Integer newId = (Integer)categoryIdMap.get(oldId);
        schema = schema.replaceAll("<categoryId>" + oldId + "</categoryId>", "<categoryId>new_" + newId + "</categoryId>");
      }
      schema = schema.replaceAll("<categoryId>new_", "<categoryId>");
      contentTypeDefinition.setSchemaValue(schema);
    }
  }
View Full Code Here

 
  private List createContents(Content content, Map idMap, Map contentTypeDefinitionIdMap, List allContents, Collection contentTypeDefinitions, Map categoryIdMap, int version, Database db, String onlyLatestVersions, boolean isCopyAction, Map<String,String> replaceMap) throws Exception
  {
      //logger.info("createContents:" + content.getName() + ":" + content.getId());

    ContentTypeDefinition contentTypeDefinition = null;
   
      Integer originalContentId = content.getContentId();
      if(version == 2)
      {
        Integer contentTypeDefinitionId = ((ContentImpl)content).getContentTypeDefinitionId();
       
        if(contentTypeDefinitionId != null)
      {
          if(!isCopyAction)
          {
            if(contentTypeDefinitionIdMap.containsKey(contentTypeDefinitionId))
              contentTypeDefinitionId = (Integer)contentTypeDefinitionIdMap.get(contentTypeDefinitionId);
           
            ContentTypeDefinition originalContentTypeDefinition = null;
            Iterator contentTypeDefinitionsIterator = contentTypeDefinitions.iterator();
            while(contentTypeDefinitionsIterator.hasNext())
            {
              ContentTypeDefinition contentTypeDefinitionCandidate = (ContentTypeDefinition)contentTypeDefinitionsIterator.next();           
              if(contentTypeDefinitionCandidate.getId().intValue() == contentTypeDefinitionId.intValue())
              {
                originalContentTypeDefinition = contentTypeDefinitionCandidate;
                break;
              }
            }
 
            if(originalContentTypeDefinition != null)
            {
              contentTypeDefinition = ContentTypeDefinitionController.getController().getContentTypeDefinitionWithName(originalContentTypeDefinition.getName(), db);
 
              if(contentTypeDefinition == null)
            {
                Integer before = originalContentTypeDefinition.getId();
                db.create(originalContentTypeDefinition);
                contentTypeDefinition = originalContentTypeDefinition;
                Integer after = originalContentTypeDefinition.getId();
                contentTypeDefinitionIdMap.put(before, after);
              }
         
              content.setContentTypeDefinition((ContentTypeDefinitionImpl)contentTypeDefinition);
 
            }
            else
            {
              logger.error("The content " + content.getName() + " had a content type not found amongst the listed ones:" + contentTypeDefinitionId);
            }
          }
          else
          {
            contentTypeDefinition = ContentTypeDefinitionController.getController().getContentTypeDefinitionWithId(contentTypeDefinitionId, db);
            content.setContentTypeDefinition((ContentTypeDefinitionImpl)contentTypeDefinition);
          }
        }
        else
          logger.warn("The content " + content.getName() + " had no content type at all");
      }
      else if(version == 1)
      {
      ContentTypeDefinition originalContentTypeDefinition = content.getContentTypeDefinition();
      if(originalContentTypeDefinition != null)
      {
          contentTypeDefinition = ContentTypeDefinitionController.getController().getContentTypeDefinitionWithName(originalContentTypeDefinition.getName(), db);
        if(contentTypeDefinition == null)
        {
            db.create(originalContentTypeDefinition);
            contentTypeDefinition = originalContentTypeDefinition;
        }
View Full Code Here

      ContentVersionVO oldContentVersion = contentVersion; //ContentVersionController.getContentVersionController().getContentVersionWithId(contentVersionVO.getContentVersionId(), db);
      // OPTIMIZ
//      Content oldContent = oldContentVersion.getOwningContent();
      ContentVO oldContentVO = ContentController.getContentController().getSmallContentVOWithId(contentVersion.getContentId(), db);
      ContentTypeDefinition ctd = ContentTypeDefinitionController.getController().getContentTypeDefinitionWithId(oldContentVO.getContentTypeDefinitionId(), db);
      if(ctd != null && ctd.getName().equalsIgnoreCase("Meta info"))
      {
          logger.info("It was a meta info so lets check it for other stuff as well");

          SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithMetaInfoContentId(db, oldContentVO.getContentId());
//          SiteNodeVersion siteNodeVersion = SiteNodeVersionController.getController().getLatestActiveSiteNodeVersion(db, siteNodeVO.getId());
View Full Code Here

TOP

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

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.