Package org.infoglue.cms.entities.content

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


    logger.info("newContentVersionId:" + newContentVersionId);
    logger.info("newAssetKey:" + newAssetKey);
   
    DigitalAsset oldDigitalAsset = getDigitalAsset(originalContentVersionId, oldAssetKey, db);
   
    ContentVersion contentVersion = ContentVersionController.getContentVersionController().getContentVersionWithId(newContentVersionId, db);
    Collection contentVersions = new ArrayList();
    contentVersions.add(contentVersion);
    logger.info("Added contentVersion:" + contentVersion.getId());
      
    DigitalAssetVO digitalAssetVO = new DigitalAssetVO();
    digitalAssetVO.setAssetContentType(oldDigitalAsset.getAssetContentType());
    digitalAssetVO.setAssetFileName(oldDigitalAsset.getAssetFileName());
    digitalAssetVO.setAssetFilePath(oldDigitalAsset.getAssetFilePath());
View Full Code Here


  public void createByCopy(Integer originalContentVersionId, MediumContentVersionImpl cv, Map<Integer,Integer> assetIdMap, Database db) throws ConstraintException, SystemException
  {
    logger.info("Creating by copying....");
    logger.info("originalContentVersionId:" + originalContentVersionId);
    //logger.info("newContentVersionId:" + newContentVersionId);
    ContentVersion oldContentVersion = ContentVersionController.getContentVersionController().getMediumContentVersionWithId(originalContentVersionId, db);
   
    Collection<DigitalAsset> assets = oldContentVersion.getDigitalAssets();
    logger.info("assets:" + assets);
    for(DigitalAsset oldDigitalAsset : assets)
    {
      //ContentVersion contentVersion = ContentVersionController.getContentVersionController().getContentVersionWithId(newContentVersionId, db);

      if(assetIdMap.containsKey(oldDigitalAsset.getId()))
      {
        logger.info("The asset was allready copied by another version - let's just connect the new one");
        MediumDigitalAssetImpl newDigitalAsset = getMediumDigitalAssetWithId(assetIdMap.get(oldDigitalAsset.getId()), db);
        newDigitalAsset.getContentVersions().add(cv);
      }
      else
      {
        Collection contentVersions = new ArrayList();
        contentVersions.add(cv);

        try
        {
          String filePath = getDigitalAssetFilePath(oldDigitalAsset.getValueObject(), db);
          File oldAssetFile = new File(filePath);
         
          logger.info("Creating asset for:" + oldDigitalAsset.getAssetKey() + ":" + oldContentVersion.getId() + "/" + cv.getId());
          DigitalAssetVO digitalAssetVO = new DigitalAssetVO();
          digitalAssetVO.setAssetContentType(oldDigitalAsset.getAssetContentType());
          digitalAssetVO.setAssetFileName(oldDigitalAsset.getAssetFileName());
          digitalAssetVO.setAssetFilePath(oldDigitalAsset.getAssetFilePath());
          digitalAssetVO.setAssetFileSize(oldDigitalAsset.getAssetFileSize());
View Full Code Here

 
  public DigitalAsset getDigitalAsset(Integer contentVersionId, String assetKey, Database db) throws SystemException
  {
    DigitalAsset digitalAsset = null;
   
    ContentVersion contentVersion = ContentVersionController.getContentVersionController().getContentVersionWithId(contentVersionId, db);
    Collection digitalAssets = contentVersion.getDigitalAssets();
    Iterator assetIterator = digitalAssets.iterator();
    while(assetIterator.hasNext())
    {
      DigitalAsset currentDigitalAsset = (DigitalAsset)assetIterator.next();
      if(currentDigitalAsset.getAssetKey().equals(assetKey))
View Full Code Here

        {
      DigitalAsset mediumDigitalAsset = getMediumDigitalAssetWithIdReadOnly(digitalAssetId, db);

      if(mediumDigitalAsset.getContentVersions() != null && mediumDigitalAsset.getContentVersions().size() > 0)
      {
        ContentVersion cv = (ContentVersion)mediumDigitalAsset.getContentVersions().iterator().next();
        if(cv != null)
          contentId = cv.getValueObject().getContentId();
      }
        
      rollbackTransaction(db);
        }
        catch(Exception e)
View Full Code Here

      Integer contentId = null;

      DigitalAsset mediumDigitalAsset = getMediumDigitalAssetWithIdReadOnly(digitalAssetId, db);
    if(mediumDigitalAsset.getContentVersions() != null && mediumDigitalAsset.getContentVersions().size() > 0)
    {
      ContentVersion cv = (ContentVersion)mediumDigitalAsset.getContentVersions().iterator().next();
      if(cv != null)
        contentId = cv.getValueObject().getContentId();
    }
   
    return contentId;
  }
View Full Code Here

      if(contentId == null || languageId == null)
      {
        DigitalAsset asset = DigitalAssetController.getMediumDigitalAssetWithIdReadOnly(digitalAssetVO.getId(), db);
        if(asset.getContentVersions() != null && asset.getContentVersions().size() > 0)
        {
          ContentVersion cv = (ContentVersion)asset.getContentVersions().iterator().next();
          contentId = cv.getValueObject().getContentId();
          languageId = cv.getValueObject().getLanguageId();
        }
      }
      folderName = "" + (contentId / 1000);
    }
View Full Code Here

      if(contentId == null || languageId == null)
      {
        DigitalAsset asset = DigitalAssetController.getMediumDigitalAssetWithIdReadOnly(digitalAssetVO.getId(), db);
        if(asset.getContentVersions() != null && asset.getContentVersions().size() > 0)
        {
          ContentVersion cv = (ContentVersion)asset.getContentVersions().iterator().next();
          contentId = cv.getValueObject().getContentId();
          languageId = cv.getValueObject().getLanguageId();
        }
      }

      String assetFileName = digitalAssetVO.getAssetFileName();
      String suffix = "";
View Full Code Here

  public EventVO getContentVersionEvent(Integer contentVersionId)
  {
    EventVO eventVO = null;
    try
    {
      ContentVersion contentVersion = ContentVersionController.getContentVersionController().getContentVersionWithId(contentVersionId);
      List events = EventController.getEventVOListForEntity(ContentVersion.class.getName(), contentVersion.getId());
      if(events != null && events.size() > 0)
        eventVO = (EventVO)events.get(0);
    }
    catch(Exception e)
    {
View Full Code Here

    Content content = contentVersion.getOwningContent();
    Collection contentVersions = content.getContentVersions();
    Iterator contentVersionsIterator = contentVersions.iterator();
    while(contentVersionsIterator.hasNext())
    {
      ContentVersion currentContentVersion = (ContentVersion)contentVersionsIterator.next();
      if(currentContentVersion.getValueObject().getLanguageId().intValue() == language.intValue())
      {
        if(currentContentVersion.getValueObject().getId().intValue() > contentVersionId.intValue())
        {
          numberOfNewerVersions++;
        }
      }
    }
View Full Code Here

       
    beginTransaction(db);
       
    try
        {       
      ContentVersion contentVersion = this.getContentVersionWithId(contentVersionId, db);
        Language language = LanguageController.getController().getLanguageWithId(languageId, db);
     
      contentVersion.setLanguage((LanguageImpl)language);
     
      commitTransaction(db);           
        }
        catch(Exception e)
        {
View Full Code Here

TOP

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

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.