Package org.infoglue.cms.entities.management

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


    if(allowLocalizedSortAndVisibilityProperties == null)
    {
      try
      {
        allowLocalizedSortAndVisibilityProperties = false;
        ContentTypeDefinitionVO metaInfoCTDVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithName("Meta info");
        if(metaInfoCTDVO != null)
        {
          List<ContentTypeAttribute> attributes =  ContentTypeDefinitionController.getController().getContentTypeAttributes(metaInfoCTDVO.getSchemaValue());
          for(ContentTypeAttribute attribute : attributes)
          {
            if(attribute.getName().equalsIgnoreCase("SortOrder") || attribute.getName().equalsIgnoreCase("HideInNavigation"))
            {
              allowLocalizedSortAndVisibilityProperties = true;
View Full Code Here


   */
  protected void execute() throws WorkflowException
  {
    try
    {
        final ContentTypeDefinitionVO contentTypeDefinitionVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithName(name, getDatabase());
        if(contentTypeDefinitionVO == null)
        {
        throwException(name + " is not a definied content type.");
        }
      setParameter(CONTENT_TYPE_DEFINITION_PARAMETER, contentTypeDefinitionVO);
View Full Code Here

 
  private ContentTypeDefinitionVO contentTypeDefinitionVO;
 
  public DeleteContentTypeDefinitionAction()
  {
    this(new ContentTypeDefinitionVO());
  }
View Full Code Here

    public ContentVersionVO update(Integer contentId, Integer languageId, ContentVersionVO contentVersionVO, InfoGluePrincipal principal, boolean skipValidate, Database db, boolean skipSiteNodeVersionUpdate) throws Exception
    {
      ContentVersionVO updatedContentVersionVO;

      ContentVO contentVO = ContentController.getContentController().getContentVOWithId(contentId, db);
      ContentTypeDefinitionVO contentTypeDefinitionVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithId(contentVO.getContentTypeDefinitionId(), db);
      String languageCode = null;
      if(principal != null && principal.getName() != null)
        languageCode = CmsPropertyHandler.getPreferredLanguageCode(principal.getName());
      ConstraintExceptionBuffer ceb = contentVersionVO.validateAdvanced(contentTypeDefinitionVO, languageCode);
        logger.info("Skipping validate:" + skipValidate);
      if(!skipValidate)
        ceb.throwIfNotEmpty();

      MediumContentVersionImpl contentVersion = null;
        Integer contentVersionIdToUpdate = contentVersionVO.getId();

    contentVersionVO.setModifiedDateTime(new Date());
        if(contentVersionVO.getId() == null)
      {
        logger.info("Creating the entity because there was no version at all for: " + contentId + " " + languageId);
        contentVersion = createMedium(contentId, languageId, contentVersionVO, db);
      }
      else
      {
      ContentVersionVO oldContentVersionVO = ContentVersionController.getContentVersionController().getContentVersionVOWithId(contentVersionVO.getId(), db);
      ContentVersionVO latestContentVersionVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(oldContentVersionVO.getContentId(), oldContentVersionVO.getLanguageId(), db);
          if(!oldContentVersionVO.getStateId().equals(ContentVersionVO.WORKING_STATE) && !latestContentVersionVO.getStateId().equals(ContentVersionVO.WORKING_STATE))
      {
        List<EventVO> events = new ArrayList<EventVO>();
        contentVersion = ContentStateController.changeState(oldContentVersionVO.getId(), contentVO, ContentVersionVO.WORKING_STATE, (contentVersionVO.getVersionComment().equals("No comment") ? "new working version" : contentVersionVO.getVersionComment()), false, null, principal, oldContentVersionVO.getContentId(), db, events);
        contentVersion.setVersionValue(contentVersionVO.getVersionValue());
        /*
        List<String> changedAttributes = getChangedAttributeNames(oldContentVersionVO, contentVersionVO);
        System.out.println("changedAttributes in contentversioncontroller:" + changedAttributes);
            Map extraInfoMap = new HashMap();
            String csList = StringUtils.join(changedAttributes.toArray(), ",");
            extraInfoMap.put("changedAttributeNames", csList);
          CacheController.setExtraInfo(ContentVersionImpl.class.getName(), contentVersion.getId().toString(), extraInfoMap);
        */
      }
      else
      {
        if(latestContentVersionVO.getStateId().equals(ContentVersionVO.WORKING_STATE))
        {
          oldContentVersionVO = contentVersionVO;
          contentVersionIdToUpdate = latestContentVersionVO.getId();
        }

          List<String> changedAttributes = getChangedAttributeNames(oldContentVersionVO, contentVersionVO);
            Map<String,String> extraInfoMap = new HashMap<String,String>();
            String csList = StringUtils.join(changedAttributes.toArray(), ",");
            //logger.info("csList:" + csList);
            extraInfoMap.put("changedAttributeNames", csList);
          CacheController.setExtraInfo(ContentVersionImpl.class.getName(), contentVersionVO.getId().toString(), extraInfoMap);
        contentVersion = ContentVersionController.getContentVersionController().getMediumContentVersionWithId(contentVersionIdToUpdate, db);
        //contentVersionVO.setModifiedDateTime(DateHelper.getSecondPreciseDate());
        Integer existingContentId = contentVersion.getValueObject().getContentId();
        contentVersionVO.setContentId(existingContentId);
        contentVersionVO.setLanguageId(contentVersion.getValueObject().getLanguageId());
        contentVersion.setValueObject(contentVersionVO);
        contentVersion.setContentVersionId(contentVersionIdToUpdate);
        contentVersion.setStateId(ContentVersionVO.WORKING_STATE);
      }
      }

        SiteNodeVersionVO latestSiteNodeVersionVO = null;
      if(principal != null && contentTypeDefinitionVO.getName().equalsIgnoreCase("Meta info") && !skipSiteNodeVersionUpdate)
      {
          SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithMetaInfoContentId(db, contentId);
        //SiteNode siteNode = SiteNodeController.getController().getSiteNodeWithMetaInfoContentId(db, contentId);
      if(siteNodeVO.getMetaInfoContentId() != null && siteNodeVO.getMetaInfoContentId().equals(contentId))
      {
View Full Code Here

  public ContentVersionVO update(Integer contentVersionId, ContentVersionVO contentVersionVO, InfoGluePrincipal principal, Database db) throws Exception
  {
    ContentVersion contentVersion = getMediumContentVersionWithId(contentVersionId, db);

    ContentVO contentVO = ContentController.getContentController().getContentVOWithId(contentVersion.getValueObject().getContentId(), db);
    ContentTypeDefinitionVO contentTypeDefinitionVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithId(contentVO.getContentTypeDefinitionId(), db);

    contentVersion.setValueObject(contentVersionVO);
    contentVersion.getValueObject().setContentId(contentVO.getContentId());

    SiteNodeVersion latestSiteNodeVersion = null;
    if(principal != null && contentTypeDefinitionVO.getName().equalsIgnoreCase("Meta info"))
    {
      SiteNodeVO siteNode = SiteNodeController.getController().getSiteNodeVOWithMetaInfoContentId(db, contentVO.getContentId());
      if(siteNode.getMetaInfoContentId() != null && siteNode.getMetaInfoContentId().equals(contentVO.getContentId()))
      {
        latestSiteNodeVersion = SiteNodeVersionController.getController().getLatestMediumSiteNodeVersion(db, siteNode.getId(), false);
View Full Code Here

    Iterator<ContentVersionVO> contentVersionsIterator = contentVersions.iterator();
      while(contentVersionsIterator.hasNext())
      {
        ContentVersionVO contentVersion = contentVersionsIterator.next();
         
            ContentTypeDefinitionVO contentTypeDefinitionVO = null;
            if(contentVO.getContentTypeDefinitionId() != null)
            {
              try
              {
                contentTypeDefinitionVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithId(contentVO.getContentTypeDefinitionId(), db);
              }
              catch (Exception e)
              {
               
                logger.error("No existing content type for: " + ContentController.getContentController().getContentPath(contentVO.getId()) + ":" + contentVO.getId());
        }
            }
           
            if(includeMetaInfo || (!includeMetaInfo && (contentTypeDefinitionVO == null || !contentTypeDefinitionVO.getName().equalsIgnoreCase("Meta info"))))
            {
            if(contentVersion.getStateId().equals(ContentVersionVO.WORKING_STATE))
              contentVersionVOList.add(contentVersion);
            }
           
          List relatedEntities = RegistryController.getController().getMatchingRegistryVOListForReferencingEntity(ContentVersion.class.getName(), contentVersion.getId().toString(), db);
         
          Iterator relatedEntitiesIterator = relatedEntities.iterator();
          while(relatedEntitiesIterator.hasNext())
          {
              RegistryVO registryVO = (RegistryVO)relatedEntitiesIterator.next();
              logger.info("registryVO:" + registryVO.getEntityName() + ":" + registryVO.getEntityId());
              if(registryVO.getEntityName().equals(SiteNode.class.getName()) && !checkedSiteNodes.contains(new Integer(registryVO.getEntityId())))
              {
                  try
                  {
                    SiteNodeVO relatedSiteNode = SiteNodeController.getController().getSiteNodeVOWithId(new Integer(registryVO.getEntityId()), db);
                    SiteNodeVersionVO relatedSiteNodeVersion = SiteNodeVersionController.getController().getLatestSiteNodeVersionVO(db, new Integer(registryVO.getEntityId()));
                    //SiteNodeVersionVO relatedSiteNodeVersion = SiteNodeVersionController.getController().getLatestActiveSiteNodeVersionIfInState(relatedSiteNode, stateId, db);
                    if(relatedSiteNodeVersion != null && contentVO.getRepositoryId().intValue() == relatedSiteNode.getRepositoryId().intValue())
                    {
                      if(relatedSiteNodeVersion.getStateId().equals(SiteNodeVersionVO.WORKING_STATE))
                        siteNodeVersionVOList.add(relatedSiteNodeVersion);
                    }
                  }
                  catch(Exception e)
                  {
                      logger.warn("The related siteNode with id:" + registryVO.getEntityId() + " could not be loaded.", e);
                  }
                 
              checkedSiteNodes.add(new Integer(registryVO.getEntityId()));
              }
              else if(registryVO.getEntityName().equals(Content.class.getName()) && !checkedContents.contains(new Integer(registryVO.getEntityId())))
              {
                  try
                  {
                    ContentVO relatedContentVO = ContentController.getContentController().getContentVOWithId(new Integer(registryVO.getEntityId()), db);
                    ContentTypeDefinitionVO relatedContentTypeDefinitionVO = null;
                    if(relatedContentVO.getContentTypeDefinitionId() != null)
                      relatedContentTypeDefinitionVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithId(relatedContentVO.getContentTypeDefinitionId(), db);
                   
                    if(includeMetaInfo || (!includeMetaInfo && (relatedContentTypeDefinitionVO == null || !relatedContentTypeDefinitionVO.getName().equalsIgnoreCase("Meta info"))))
                    {
                    List<ContentVersionVO> relatedContentVersions = ContentVersionController.getContentVersionController().getLatestContentVersionVOListPerLanguage(relatedContentVO.getId(), db);
                   
                      //List<ContentVersionVO> relatedContentVersions = ContentVersionController.getContentVersionController().getLatestContentVersionIdsPerLanguage(relatedContentVO.getId(), stateId, db);
                      //List<ContentVersionVO> relatedContentVersions = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVOIfInState(relatedContentVO.getId(), stateId, db);
View Full Code Here

 
      this.contentVersionVO = this.getContentVersionVO();
      if(this.contentVersionVO == null)
      {
        ContentVO contentVO = ContentController.getContentController().getContentVOWithId(contentId);
        ContentTypeDefinitionVO contentTypeDefinitionVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithId(contentVO.getContentTypeDefinitionId());
 
        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(contentTypeDefinitionVO, true);
        Iterator contentTypeAttributesIterator = contentTypeAttributes.iterator();
View Full Code Here

      super.initialize(this.contentVersionId, this.contentId, this.languageId);
      this.contentVersionVO = this.getContentVersionVO();
      if(this.contentVersionVO == null)
      {
        ContentVO contentVO = ContentController.getContentController().getContentVOWithId(contentId);
        ContentTypeDefinitionVO contentTypeDefinitionVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithId(contentVO.getContentTypeDefinitionId());
     
        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(contentTypeDefinitionVO, true);
        Iterator contentTypeAttributesIterator = contentTypeAttributes.iterator();
View Full Code Here

        Element root = doc.addElement("definitions");
      TransactionHistoryController transactionHistoryController = TransactionHistoryController.getController();
     
      for(Iterator i=contentTypeDefinitions.iterator();i.hasNext();)
      {
        ContentTypeDefinitionVO vo = (ContentTypeDefinitionVO) i.next();
        if(vo.getType().compareTo(ContentTypeDefinitionVO.CONTENT)==0)
        {
            TransactionHistoryVO transactionHistoryVO = transactionHistoryController.getLatestTransactionHistoryVOForEntity(ContentTypeDefinitionImpl.class, vo.getContentTypeDefinitionId());
           
          Element definition = DocumentHelper.createElement("definition");
          definition
          .addAttribute("id", "" + vo.getContentTypeDefinitionId())
          .addAttribute("type", "" + vo.getType())
          .addAttribute("name", vo.getName())
        ;
         
          if(transactionHistoryVO!=null)
              definition.addAttribute("mod", formatDate(transactionHistoryVO.getTransactionDateTime()));
         
          Element schemaValue = definition.addElement("schemaValue");
          schemaValue.addCDATA(vo.getSchemaValue());
          root.add(definition);
        }
      }
    return out(getFormattedDocument(doc));
     
View Full Code Here

    if(criterias.hasContentTypeDefinitionVOsCriteria() && criterias.getContentTypeDefinitions().size() > 0)
    {
      logger.debug(" CRITERA[content type definition]");
      for(final Iterator i=criterias.getContentTypeDefinitions().iterator(); i.hasNext(); )
      {
        final ContentTypeDefinitionVO contentTypeDefinitionVO = (ContentTypeDefinitionVO) i.next();
        expressions.add(MessageFormat.format(getC_CONTENT_TYPE_CLAUSE(), new Object[] { getBindingVariable() }));
        bindings.add(contentTypeDefinitionVO.getId());
      }
      return "(" + joinCollection(expressions, SPACE + OR + SPACE) + ")";
    }
    return "";
  }
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.