Package org.infoglue.cms.entities.content

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


    if(CmsPropertyHandler.getAssetFileNameForm().equals("contentId_languageId_assetKey"))
    {
      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();
        }
      }
View Full Code Here


                 
          Collection digitalAssetList = contentVersion.getDigitalAssets();
      Iterator assets = digitalAssetList.iterator();
      while (assets.hasNext())
            {
              DigitalAsset digitalAsset = (DigitalAsset)assets.next();
        assets.remove();
        db.remove(digitalAsset);
      }
     
          logger.info("Deleting contentVersion:" + contentVersion.getContentVersionId());
View Full Code Here

        Collection digitalAssets = contentVersion.getDigitalAssets();
      Iterator assetIterator = digitalAssets.iterator();
      while(assetIterator.hasNext())
      {
        DigitalAsset currentDigitalAsset = (DigitalAsset)assetIterator.next();
        if(currentDigitalAsset.getAssetKey().equals(assetKey))
        {
                currentDigitalAsset.getContentVersions().remove(contentVersion);
          assetIterator.remove();
                if(currentDigitalAsset.getContentVersions().size() == 0)
            db.remove(currentDigitalAsset);

                break;
        }
      }
View Full Code Here

       
        Collection digitalAssets = contentVersion.getDigitalAssets();
      Iterator assetIterator = digitalAssets.iterator();
      while(assetIterator.hasNext())
      {
        DigitalAsset currentDigitalAsset = (DigitalAsset)assetIterator.next();
        if(currentDigitalAsset.getAssetKey().equals(assetVO.getAssetKey()))
        {
          assetVO.setDigitalAssetId(currentDigitalAsset.getId());
          DigitalAssetController.update(assetVO, is, db);
          foundExistingAsset = true;
          break;
        }
      }
View Full Code Here

      }
      else
      {
        contentVersion = ContentVersionController.getContentVersionController().getContentVersionWithId(contentVersionVO.getId(), db);

        DigitalAsset digitalAsset = DigitalAssetController.getDigitalAssetWithId(digitalAssetVO.getId(), db);     
          contentVersion.getDigitalAssets().remove(digitalAsset);
          digitalAsset.getContentVersions().remove(contentVersion);
         
              logger.info("digitalAsset size after:" + digitalAsset.getContentVersions().size());
              if(digitalAsset.getContentVersions().size() == 0)
                db.remove(digitalAsset);
      }
         
          editedContentVersionVO = contentVersion.getValueObject();
         
View Full Code Here

     
        Iterator digitalAssetsIterator = digitalAssets.iterator();
      while(digitalAssetsIterator.hasNext())
      {
       
          DigitalAsset digitalAsset = (DigitalAsset)digitalAssetsIterator.next();
          logger.info("Make copy of reference to digitalAssets " + digitalAsset.getAssetKey());
          if(excludedAssetId == null || !digitalAsset.getId().equals(excludedAssetId))
          {
            newContentVersion.getDigitalAssets().add(digitalAsset);
            digitalAsset.getContentVersions().add(newContentVersion);
          }
          else
          {
            logger.info("Not copying the excluded asset:" + digitalAsset.getId());
          }
      }
      }
      else
      {
        Iterator digitalAssetsIterator = digitalAssets.iterator();
      while(digitalAssetsIterator.hasNext())
      {
          DigitalAsset digitalAsset = (DigitalAsset)digitalAssetsIterator.next();
          if(excludedAssetId == null || !digitalAsset.getId().equals(excludedAssetId))
          {
            logger.info("Copying digitalAssets " + digitalAsset.getAssetKey());
            DigitalAssetVO digitalAssetVO = digitalAsset.getValueObject();
           
            InputStream is = DigitalAssetController.getController().getAssetInputStream(digitalAsset, true);
     
            if(is == null && !allowBrokenAssets)
              throw new ConstraintException("DigitalAsset.assetBlob", "3308", "Broken asset found on content '" + originalContentVersion.getValueObject().getContentName() + "' with id " + originalContentVersion.getValueObject().getContentId());
           
              try
            {
                synchronized (is)
              {
                DigitalAssetController.create(digitalAssetVO, is, newContentVersion, db);
            }
            }
              catch (Exception e)
              {
            e.printStackTrace();
          }
            finally
            {
              if(is != null)
                is.close();
            }
          }
          else
          {
            logger.info("Not copying the excluded asset:" + digitalAsset.getId());
          }
        logger.info("digitalAssets:" + digitalAssets.size());
      }
      }
  } 
View Full Code Here

          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;
                    digitalAssetVO = asset.getValueObject();
                  }
                }
View Full Code Here

  {
    final Collection digitalAssets = getDigitalAssets();
    final Collection attachments   = new ArrayList();
    for(final Iterator i = digitalAssets.iterator(); i.hasNext(); )
    {
      final DigitalAsset digitalAsset = (DigitalAsset) i.next();
      attachments.add(new DigitalAssetAttachment(digitalAsset.getAssetFileName(), digitalAsset.getAssetContentType(), digitalAsset.getAssetBytes()));
    }
    return attachments;
  }
View Full Code Here

    if (assets != null && assets.size() > 0)
    {
      logger.info("Removing old instance of " + newFile.getName());
      for (Iterator it = assets.iterator(); it.hasNext();)
      {
        DigitalAsset oldAsset = (DigitalAsset) it.next();
        LabelController.delete(oldAsset.getId());
      }
    }

    logger.info("Storing Digital Asset (portlet) " + newFile.getName());
    InputStream is = new FileInputStream(newFile);
    DigitalAsset digitalAsset = LabelController.create(newAsset, is);
    is.close();
    logger.debug("Digital Asset stored as id = " + digitalAsset.getId());
   
      return doExecute();
    }
View Full Code Here

    if (assets != null && assets.size() > 0)
    {
      logger.info("Removing old instance of " + file.getName());
      for (Iterator it = assets.iterator(); it.hasNext();)
      {
        DigitalAsset oldAsset = (DigitalAsset) it.next();
        LabelController.delete(oldAsset.getId());
      }
    }

    logger.info("file:" + file + ":" + file.exists());
    if(file.exists())
View Full Code Here

TOP

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

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.