Package org.infoglue.cms.entities.content

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


   
    public DigitalAsset getPortletRegistry(Database db) throws SystemException
    {       
        String portletId = CmsPropertyHandler.getDigitalAssetPortletRegistryId();
       
        DigitalAsset da = null;
        if(portletId == null || portletId.equals("") || portletId.equalsIgnoreCase("@digitalAssetPortletRegistryId@"))
          return da;

        try
        {
View Full Code Here


  public DigitalAsset getPortletRegistryAsset() throws Exception
  {
        List das = PortletAssetController.getDigitalAssetByName(PortletEntityRegistryServiceDBImpl.PORTLET_REGISTRY_CONTENT_NAME);
        if (das != null && das.size() > 0)
        {
            DigitalAsset da = (DigitalAsset) das.get(0);
            logger.debug("Registry located as id=" + da.getId());
            return da;
        }
        else
        {
          logger.info("Portlet Registry not found");
View Full Code Here

  public DigitalAsset getPortletRegistryAsset(Database db) throws Exception
  {
        List das = PortletAssetController.getDigitalAssetByName(PortletEntityRegistryServiceDBImpl.PORTLET_REGISTRY_CONTENT_NAME, db);
        if (das != null && das.size() > 0)
        {
            DigitalAsset da = (DigitalAsset) das.get(0);
            logger.debug("Registry located as id=" + da.getId());
            return da;
        }
        else
        {
          logger.info("Portlet Registry not found");
View Full Code Here

    Timer t = new Timer();
    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

    if(CmsPropertyHandler.getAssetFileNameForm().equals("contentId_languageId_assetKey"))
    {
      if(contentId == null || languageId == null)
      {
        //Timer t = new Timer();
        DigitalAsset asset = DigitalAssetController.getMediumDigitalAssetWithIdReadOnly(digitalAssetVO.getId(), db);
        //logger.info("As no contentId was sent - we check for the first version we find that uses it. Should not matter which:" + asset.getContentVersions());
        if(asset.getContentVersions() != null && asset.getContentVersions().size() > 0)
        {
          ContentVersion cv = (ContentVersion)asset.getContentVersions().iterator().next();
          contentId = cv.getValueObject().getContentId();
          languageId = cv.getValueObject().getLanguageId();
        }
        //t.printElapsedTime("Finding content and language for an asset took");
      }
View Full Code Here

    try
    {
      File outputFileDir = new File(filePath);
      outputFileDir.mkdirs();

      DigitalAsset digitalAsset = DigitalAssetController.getDigitalAssetWithId(digitalAssetVO.getId(), db);
     
      String cmsBaseUrl = CmsPropertyHandler.getCmsFullBaseUrl();
      if(CmsPropertyHandler.getEnableDiskAssets().equals("true"))
      {
        HttpHelper httpHelper = new HttpHelper();
        httpHelper.downloadFile("" + cmsBaseUrl + "/DownloadProtectedAsset.action?digitalAssetId=" + digitalAssetVO.getId(), tmpOutputFile);
      }
     
      if(tmpOutputFile.exists())
      {
        if(logger.isInfoEnabled())
        {
          logger.info("Time for dumping file " + fileName + ":" + timer.getElapsedTime() + ":" + tmpOutputFile.exists() + ":" + tmpOutputFile.lastModified());
          logger.info("tmpOutputFile:" + tmpOutputFile.length() + ":" + tmpOutputFile.exists())
        }
       
        if(tmpOutputFile.length() == 0 || outputFile.exists())
        {
          if(logger.isInfoEnabled())
            logger.info("written file:" + tmpOutputFile.length() + " - removing temp and not renaming it...")
         
          tmpOutputFile.delete();
         
          if(logger.isInfoEnabled())
            logger.info("Time for deleting file " + timer.getElapsedTime());
        }
        else
        {
          logger.info("written file:" + tmpOutputFile.getAbsolutePath() + " - renaming it to " + outputFile.getAbsolutePath())

          logger.info("written file:" + tmpOutputFile.length() + " - renaming it to " + outputFile.getAbsolutePath())
          tmpOutputFile.renameTo(outputFile);
          logger.info("Time for renaming file " + timer.getElapsedTime());
       

      }
      else
      {
        InputStream inputStream = digitalAsset.getAssetBlob();
        if(inputStream != null)
        {
          synchronized(inputStream)
          {
            logger.info("reading inputStream and writing to disk....");
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();
        ThemeController.delete(oldAsset.getId());
      }
    }

    logger.info("Storing Digital Asset (Theme) " + newFile.getName());
    InputStream is = new FileInputStream(newFile);
    DigitalAsset digitalAsset = ThemeController.create(newAsset, is);
    is.close();
    logger.debug("Digital Asset stored as id = " + digitalAsset.getId());

    newFile.delete();
   
      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();
        ThemeController.delete(oldAsset.getId());
      }
    }
 
    if (hasDeliverWorking()) {
    for (String path : serverList) {
View Full Code Here

      * The asset is send in as an InputStream which castor inserts automatically.
      */

     public static DigitalAssetVO create(DigitalAssetVO digitalAssetVO, InputStream is, MediumContentVersionImpl contentVersion, Database db) throws SystemException, Exception
     {
    DigitalAsset digitalAsset = null;
   
    Collection contentVersions = new ArrayList();
    contentVersions.add(contentVersion);
    logger.info("Added contentVersion:" + contentVersion.getId());
 
    digitalAsset = new MediumDigitalAssetImpl();
    digitalAsset.setValueObject(digitalAssetVO.createCopy());
    if(CmsPropertyHandler.getEnableDiskAssets().equals("false"))
      digitalAsset.setAssetBlob(is);
    digitalAsset.setContentVersions(contentVersions);
   
    db.create(digitalAsset);
       
    //if(contentVersion.getDigitalAssets() == null)
    //    contentVersion.setDigitalAssets(new ArrayList());
   
    contentVersion.getDigitalAssets().add(digitalAsset);
           
        return digitalAsset.getValueObject();
     }
View Full Code Here

     public static DigitalAssetVO create(DigitalAssetVO digitalAssetVO, InputStream is, String entity, Integer entityId) throws ConstraintException, SystemException
     {
    Database db = CastorDatabaseService.getDatabase();
       
    DigitalAsset digitalAsset = null;
   
    beginTransaction(db);
   
    try
    {
        if(entity.equalsIgnoreCase("ContentVersion"))
        {
        ContentVersion contentVersion = ContentVersionController.getContentVersionController().getContentVersionWithId(entityId, db);
        Collection contentVersions = new ArrayList();
        contentVersions.add(contentVersion);
        logger.info("Added contentVersion:" + contentVersion.getId());
        
        digitalAsset = new DigitalAssetImpl();
        digitalAsset.setValueObject(digitalAssetVO);
        if(CmsPropertyHandler.getEnableDiskAssets().equals("false"))
          digitalAsset.setAssetBlob(is);
        digitalAsset.setContentVersions(contentVersions);

        db.create(digitalAsset);
         
        contentVersion.getDigitalAssets().add(digitalAsset);           
        }
        else if(entity.equalsIgnoreCase(UserProperties.class.getName()))
        {
        UserProperties userProperties = UserPropertiesController.getController().getUserPropertiesWithId(entityId, db);
        Collection userPropertiesList = new ArrayList();
        userPropertiesList.add(userProperties);
        logger.info("Added userProperties:" + userProperties.getId());
        
        digitalAsset = new DigitalAssetImpl();
        digitalAsset.setValueObject(digitalAssetVO);
        if(CmsPropertyHandler.getEnableDiskAssets().equals("false"))
          digitalAsset.setAssetBlob(is);
        digitalAsset.setUserProperties(userPropertiesList);
       
        db.create(digitalAsset);
         
        userProperties.getDigitalAssets().add(digitalAsset);           
        }
        else if(entity.equalsIgnoreCase(RoleProperties.class.getName()))
        {
            RoleProperties roleProperties = RolePropertiesController.getController().getRolePropertiesWithId(entityId, db);
        Collection rolePropertiesList = new ArrayList();
        rolePropertiesList.add(roleProperties);
        logger.info("Added roleProperties:" + roleProperties.getId());
        
        digitalAsset = new DigitalAssetImpl();
        digitalAsset.setValueObject(digitalAssetVO);
        if(CmsPropertyHandler.getEnableDiskAssets().equals("false"))
          digitalAsset.setAssetBlob(is);
        digitalAsset.setRoleProperties(rolePropertiesList);
       
        db.create(digitalAsset);
         
        roleProperties.getDigitalAssets().add(digitalAsset);                       
        }
        else if(entity.equalsIgnoreCase(GroupProperties.class.getName()))
        {
            GroupProperties groupProperties = GroupPropertiesController.getController().getGroupPropertiesWithId(entityId, db);
        Collection groupPropertiesList = new ArrayList();
        groupPropertiesList.add(groupProperties);
        logger.info("Added groupProperties:" + groupProperties.getId());
        
        digitalAsset = new DigitalAssetImpl();
        digitalAsset.setValueObject(digitalAssetVO);
        if(CmsPropertyHandler.getEnableDiskAssets().equals("false"))
          digitalAsset.setAssetBlob(is);
        digitalAsset.setGroupProperties(groupPropertiesList);
       
        db.create(digitalAsset);
         
        groupProperties.getDigitalAssets().add(digitalAsset);                       
        }
   
      commitTransaction(db);
    }
    catch(Exception e)
    {
      logger.error("An error occurred so we should not complete the transaction:" + e, e);
      rollbackTransaction(db);
      throw new SystemException(e.getMessage());
    }   
       
        return digitalAsset.getValueObject();
     }
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.