Package org.infoglue.cms.entities.content.impl.simple

Examples of org.infoglue.cms.entities.content.impl.simple.MediumContentVersionImpl


    */
   
    public MediumContentVersionImpl create(Integer contentId, Integer languageId, ContentVersionVO contentVersionVO, Integer oldContentVersionId, boolean allowBrokenAssets, boolean duplicateAssets, Integer excludedAssetId, Database db) throws ConstraintException, SystemException, Exception
    {
      Timer t = new Timer();   
      MediumContentVersionImpl contentVersion = new MediumContentVersionImpl();
    contentVersion.setValueObject(contentVersionVO);
    contentVersion.getValueObject().setLanguageId(languageId);
    contentVersion.getValueObject().setContentId(contentId);
    RequestAnalyser.getRequestAnalyser().registerComponentStatistics("create 2", t.getElapsedTime());
   
    db.create(contentVersion);
    RequestAnalyser.getRequestAnalyser().registerComponentStatistics("create 3.0", t.getElapsedTime());

View Full Code Here


        return contentVersion;
    }    

    public MediumContentVersionImpl createMedium(Integer contentId, Integer languageId, ContentVersionVO contentVersionVO, Database db) throws ConstraintException, SystemException, Exception
    {
      MediumContentVersionImpl contentVersion = new MediumContentVersionImpl();
    contentVersion.setValueObject(contentVersionVO);
    contentVersion.getValueObject().setLanguageId(languageId);
    contentVersion.getValueObject().setContentId(contentId);
   
    db.create(contentVersion);

        return contentVersion;
    }    
View Full Code Here

   
    public MediumContentVersionImpl createMedium(MediumContentVersionImpl oldContentVersion, Integer contentId, Integer languageId, ContentVersionVO contentVersionVO, Integer oldContentVersionId, boolean hasAssets, boolean allowBrokenAssets, boolean duplicateAssets, Integer excludedAssetId, Database db) throws ConstraintException, SystemException, Exception
    {
      //Beh�vs verkligen content h�r? M�t tiderna ocks�
      Timer t = new Timer();   
      MediumContentVersionImpl contentVersion = new MediumContentVersionImpl();
    contentVersion.setValueObject(contentVersionVO);
    contentVersion.getValueObject().setLanguageId(languageId);
    contentVersion.getValueObject().setContentId(contentId);
    RequestAnalyser.getRequestAnalyser().registerComponentStatistics("create 2", t.getElapsedTime());
   
    db.create(contentVersion);
    RequestAnalyser.getRequestAnalyser().registerComponentStatistics("create 3.1", t.getElapsedTime());
View Full Code Here

    {
      Database db = CastorDatabaseService.getDatabase();
        beginTransaction(db);
    try
        {
      MediumContentVersionImpl contentVersion = this.getMediumContentVersionWithId(contentVersionId, db);
       
        boolean foundExistingAsset = false;
       
        Collection digitalAssets = contentVersion.getDigitalAssets();
      Iterator assetIterator = digitalAssets.iterator();
      while(assetIterator.hasNext())
      {
        DigitalAsset currentDigitalAsset = (DigitalAsset)assetIterator.next();
        if(currentDigitalAsset.getAssetKey().equals(assetVO.getAssetKey()))
View Full Code Here

      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))
      {
          latestSiteNodeVersionVO = SiteNodeVersionController.getController().getLatestSiteNodeVersionVO(db, siteNodeVO.getId());
          latestSiteNodeVersionVO.setVersionModifier(contentVersionVO.getVersionModifier());
          latestSiteNodeVersionVO.setModifiedDateTime(DateHelper.getSecondPreciseDate());
          SiteNodeVersionControllerProxy.getSiteNodeVersionControllerProxy().acUpdate(principal, latestSiteNodeVersionVO, db);

        Map extraInfoMap = new HashMap();
          extraInfoMap.put("skipSiteNodeVersionUpdate", "true");
//            extraInfoMap.put("contentId", ""+contentVO.getId());
//            extraInfoMap.put("parentContentId", ""+contentVO.getParentContentId());
//            extraInfoMap.put("repositoryId", ""+contentVO.getRepositoryId());
        CacheController.setExtraInfo(SiteNodeVersionImpl.class.getName(), latestSiteNodeVersionVO.getId().toString(), extraInfoMap);
      }
    }

      registryController.updateContentVersionThreaded(contentVersion.getValueObject(), latestSiteNodeVersionVO);

      updatedContentVersionVO = contentVersion.getValueObject();
      return updatedContentVersionVO;
    }
View Full Code Here

      Iterator<SmallestContentVersionVO> contentVersionVOIdListIterator = contentVersionVOList.iterator();
      while(contentVersionVOIdListIterator.hasNext())
      {
        SmallestContentVersionVO contentVersionVO = contentVersionVOIdListIterator.next();
        //ContentVersion contentVersion = getContentVersionWithId(contentVersionVO.getContentVersionId(), db);
        MediumContentVersionImpl contentVersion = getMediumContentVersionWithId(contentVersionVO.getContentVersionId(), db);
        logger.info("Deleting the contentVersion " + contentVersion.getId() + " on content " + contentVersion.getOwningContent());
        delete(contentVersion, db, true);
      }
     
      commitRegistryAwareTransaction(db);
View Full Code Here

  /**
   * This method deletes the relation to a digital asset - not the asset itself.
   */
  public MediumContentVersionImpl checkStateAndChangeIfNeeded(Integer contentVersionId, InfoGluePrincipal principal, Database db) throws ConstraintException, SystemException, Bug
    {
    MediumContentVersionImpl contentVersion = null;
      ContentVersionVO contentVersionVO = ContentVersionController.getContentVersionController().getContentVersionVOWithId(contentVersionId, db);
      if(!contentVersionVO.getStateId().equals(ContentVersionVO.WORKING_STATE))
    {
      List events = new ArrayList();
      ContentVO contentVO = ContentController.getContentController().getContentVOWithId(contentVersionVO.getContentId(), db);
View Full Code Here

      Database db = CastorDatabaseService.getDatabase();
        beginTransaction(db);

        try
        {     
          MediumContentVersionImpl contentVersion = null;
          ContentVersionVO contentVersionVO = ContentVersionController.getContentVersionController().getContentVersionVOWithId(contentVersionId, db);
          DigitalAssetVO digitalAssetVO = DigitalAssetController.getController().getDigitalAssetVOWithId(digitalAssetId, db);
          if(!contentVersionVO.getStateId().equals(ContentVersionVO.WORKING_STATE))
      {
        List events = new ArrayList();
        ContentVO contentVO = ContentController.getContentController().getContentVOWithId(contentVersionVO.getContentId(), db);
        contentVersion = ContentStateController.changeState(contentVersionVO.getId(), contentVO, ContentVersionVO.WORKING_STATE, "new working version", false, null, principal, contentVersionVO.getContentId(), db, events);
        newContentVersionIdList.add(contentVersion.getId());
        digitalAssetVO = DigitalAssetController.getController().getLatestDigitalAssetVO(contentVersion.getId(), digitalAssetVO.getAssetKey(), db);
      }
         
          boolean duplicateAssetsBetweenVersions = CmsPropertyHandler.getDuplicateAssetsBetweenVersions();
          logger.info("duplicateAssetsBetweenVersions:" + duplicateAssetsBetweenVersions);
         
          if(!duplicateAssetsBetweenVersions)
          {
            DigitalAsset oldDigitalAsset = DigitalAssetController.getController().getMediumDigitalAssetWithId(digitalAssetId, db);
            logger.info("oldDigitalAsset:" + oldDigitalAsset.getContentVersions().size());
              if(oldDigitalAsset.getContentVersions().size() > 1)
            {
                logger.info("Creating new duplicate of this asset as there are other assets using this one:" + oldDigitalAsset.getId());
                logger.info("contentVersion:" + contentVersion);
                logger.info("oldDigitalAsset:" + oldDigitalAsset.getId());
                if(contentVersion == null)
                  contentVersion = ContentVersionController.getContentVersionController().getMediumContentVersionWithId(contentVersionId, db);
               
                boolean exists = false;
                logger.info("contentVersion:" + contentVersion.getId());
                for(MediumDigitalAssetImpl asset : (Collection<MediumDigitalAssetImpl>)contentVersion.getDigitalAssets())
                {
                  logger.info("asset:" + asset.getId() + "-" + asset.getAssetKey());
                  if(asset.getAssetKey().equals(oldDigitalAsset.getAssetKey()))
                  {
                    exists = true;
View Full Code Here

TOP

Related Classes of org.infoglue.cms.entities.content.impl.simple.MediumContentVersionImpl

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.