Package org.infoglue.cms.entities.content

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


        List initialDigitalAssets = new ArrayList();
         
        Iterator digitalAssetsIterator = digitalAssets.iterator();
        while(digitalAssetsIterator.hasNext())
        {
          DigitalAsset digitalAsset = (DigitalAsset)digitalAssetsIterator.next();
         
          List initialContentVersions = new ArrayList();
          initialContentVersions.add(contentVersion);
          digitalAsset.setContentVersions(initialContentVersions);
 
          db.create(digitalAsset);
         
          initialDigitalAssets.add(digitalAsset);
        }
View Full Code Here


            db.begin();

            byte[] serial = portletRegistry.getBytes();
            InputStream is = new ByteArrayInputStream(serial);

            DigitalAsset da = PortletAssetController.getPortletAssetController().getPortletRegistryAsset(db);
            if (da == null)
            {
              logger.info("Creating new " + PortletEntityRegistryServiceDBImpl.PORTLET_REGISTRY_CONTENT_NAME);

                String filePath = CmsPropertyHandler.getDigitalAssetPath();
                DigitalAssetVO newAsset = new DigitalAssetVO();
                newAsset.setAssetContentType("text/xml");
                newAsset.setAssetKey(PortletEntityRegistryServiceDBImpl.PORTLET_REGISTRY_CONTENT_NAME);
                newAsset.setAssetFileName(PortletEntityRegistryServiceDBImpl.PORTLET_REGISTRY_CONTENT_NAME);
                newAsset.setAssetFilePath(filePath);
                newAsset.setAssetFileSize(new Integer(serial.length));

                da = PortletAssetController.getPortletAssetController().create(db, newAsset, is);
                logger.warn(PortletEntityRegistryServiceDBImpl.PORTLET_REGISTRY_CONTENT_NAME + " stored as id=" + da.getId());
            }
            else
            {
                logger.info("Updating " + PortletEntityRegistryServiceDBImpl.PORTLET_REGISTRY_CONTENT_NAME);

                DigitalAssetVO daVO = da.getValueObject();
                daVO.setAssetFileSize(new Integer(serial.length));

                PortletAssetController.update(daVO, is);
            }
           
View Full Code Here

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

     public static DigitalAssetVO create(DigitalAssetVO digitalAssetVO, InputStream is, List<ContentVersion> contentVersions, Database db) throws SystemException, Exception
     {
    DigitalAsset digitalAsset = null;
   
    digitalAsset = new DigitalAssetImpl();
    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());
   
    for(ContentVersion cv : contentVersions)
      cv.getDigitalAssets().add(digitalAsset);
           
        return digitalAsset.getValueObject();
     }
View Full Code Here

      return "success";
  }
 
  public String doSimple() throws Exception
  {
    DigitalAsset digitalAsset = PortletAssetController.getPortletAssetController().getPortletRegistryAsset();
    if(digitalAsset == null)
    {
      DigitalAssetVO newAsset = new DigitalAssetVO();
      newAsset.setAssetContentType("text/xml");
      newAsset.setAssetKey("portletentityregistry.xml");
      newAsset.setAssetFileName("portletentityregistry.xml");
      newAsset.setAssetFilePath("None");
      newAsset.setAssetFileSize(new Integer(new Long("4").intValue()));
      InputStream is = new ByteArrayInputStream("".getBytes());
      digitalAsset = PortletAssetController.create(newAsset, is);
      is.close();
    }
     
    if(digitalAsset != null)
    {
      InputStream is = digitalAsset.getAssetBlob();
      portletRegistry = FileHelper.getStreamAsString(is);
        return "successSimple";
    }
    else
      return ERROR;
View Full Code Here

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

        log.info("Storing Digital Asset (portlet) " + fileName);
        InputStream is = new FileInputStream(file);
View Full Code Here

    public static DigitalAsset create(DigitalAssetVO digitalAssetVO, InputStream is) throws SystemException
    {
        Database db = CastorDatabaseService.getDatabase();

        DigitalAsset digitalAsset = null;

        beginTransaction(db);
       
        try
        {
            digitalAsset = new DigitalAssetImpl();
            digitalAsset.setValueObject(digitalAssetVO);
            digitalAsset.setAssetBlob(is);

            db.create(digitalAsset);

            commitTransaction(db);
        }
View Full Code Here

          Iterator assetsIterator = assets.iterator();
          if(assetsIterator.hasNext())
          {
            File skinsDir = new File(CmsPropertyHandler.getContextRootPath() + File.separator + "css" + File.separator + "skins");
             
            DigitalAsset da = (DigitalAsset)assetsIterator.next();
            String themeName = da.getAssetFileName();
           
            File zip = new File(CmsPropertyHandler.getContextRootPath() + File.separator + "css" + File.separator + "skins" + File.separator + da.getAssetFileName());
            logger.info("Caching " + themeName + " at " + skinsDir);
            InputStream is = da.getAssetBlob();
 
            FileOutputStream os = new FileOutputStream(zip);
                  BufferedOutputStream bos = new BufferedOutputStream(os);
                  int num = copyStream(is, bos);
                  bos.close();
View Full Code Here

          Collection assets = userProperties.getDigitalAssets();
          logger.info("assets:" + assets.size());
          Iterator assetsIterator = assets.iterator();
          while(assetsIterator.hasNext())
          {
              DigitalAsset digitalAsset = (DigitalAsset)assetsIterator.next();
              logger.info("digitalAsset:" + digitalAsset.getAssetKey());
              if(digitalAsset.getAssetKey().equalsIgnoreCase(assetKey))
              {
                  SiteNode siteNode = SiteNodeController.getController().getSiteNodeWithId(siteNodeId, db);
                  assetUrl = DigitalAssetDeliveryController.getDigitalAssetDeliveryController().getAssetUrl(digitalAsset, siteNode.getRepository(), deliveryContext);
                  logger.info("assetUrl:" + assetUrl);
                  break;
              }
          }
      }
    }
   
    if(assetUrl.equals(""))
    { 
      List roles = infoGluePrincipal.getRoles();
      Iterator rolesIterator = roles.iterator();
      while(rolesIterator.hasNext())
      {
        InfoGlueRole role = (InfoGlueRole)rolesIterator.next();
       
        Collection rolePropertiesList = RolePropertiesController.getController().getRolePropertiesList(role.getName(), languageId, db, true);
        Iterator rolePropertiesListIterator = rolePropertiesList.iterator();
        while(rolePropertiesListIterator.hasNext())
        {
          RoleProperties roleProperties = (RoleProperties)rolePropertiesListIterator.next();
         
          if(roleProperties != null && roleProperties.getLanguage().getLanguageId().equals(languageId))
          {
              Collection assets = roleProperties.getDigitalAssets();
              Iterator assetsIterator = assets.iterator();
              while(assetsIterator.hasNext())
              {
                  DigitalAsset digitalAsset = (DigitalAsset)assetsIterator.next();
                  if(digitalAsset.getAssetKey().equalsIgnoreCase(assetKey))
                  {
                      SiteNode siteNode = SiteNodeController.getController().getSiteNodeWithId(siteNodeId, db);
                      assetUrl = DigitalAssetDeliveryController.getDigitalAssetDeliveryController().getAssetUrl(digitalAsset, siteNode.getRepository(), deliveryContext);
                      break;
                  }
              }
          }
        }
                 
      }
     
      if(assetUrl.equals("") && useLanguageFallback)
      {
        LanguageVO masterLanguageVO = LanguageDeliveryController.getLanguageDeliveryController().getMasterLanguageForSiteNode(db, siteNodeId);
        if(!masterLanguageVO.getLanguageId().equals(languageId))
          return getPrincipalAssetUrl(db, infoGluePrincipal, assetKey, masterLanguageVO.getLanguageId(), siteNodeId, useLanguageFallback, deliveryContext);
      }
    }

    if(assetUrl.equals(""))
    { 
      List groups = infoGluePrincipal.getGroups();
      Iterator groupsIterator = groups.iterator();
      while(groupsIterator.hasNext())
      {
        InfoGlueGroup group = (InfoGlueGroup)groupsIterator.next();
       
        Collection groupPropertiesList = GroupPropertiesController.getController().getGroupPropertiesList(group.getName(), languageId, db, true);
        Iterator groupPropertiesListIterator = groupPropertiesList.iterator();
        while(groupPropertiesListIterator.hasNext())
        {
          GroupProperties groupProperties = (GroupProperties)groupPropertiesListIterator.next();
         
          if(groupProperties != null && groupProperties.getLanguage().getLanguageId().equals(languageId))
          {
              Collection assets = groupProperties.getDigitalAssets();
              Iterator assetsIterator = assets.iterator();
              while(assetsIterator.hasNext())
              {
                  DigitalAsset digitalAsset = (DigitalAsset)assetsIterator.next();
                  if(digitalAsset.getAssetKey().equalsIgnoreCase(assetKey))
                  {
                      SiteNode siteNode = SiteNodeController.getController().getSiteNodeWithId(siteNodeId, db);
                      assetUrl = DigitalAssetDeliveryController.getDigitalAssetDeliveryController().getAssetUrl(digitalAsset, siteNode.getRepository(), deliveryContext);
                      break;
                  }
View Full Code Here

      {
          Collection assets = userProperties.getDigitalAssets();
          Iterator assetsIterator = assets.iterator();
          while(assetsIterator.hasNext())
          {
              DigitalAsset digitalAsset = (DigitalAsset)assetsIterator.next();
              if(digitalAsset.getAssetKey().equalsIgnoreCase(assetKey))
              {
                  SiteNode siteNode = SiteNodeController.getController().getSiteNodeWithId(siteNodeId, db);
                  assetUrl = DigitalAssetDeliveryController.getDigitalAssetDeliveryController().getAssetThumbnailUrl(digitalAsset, siteNode.getRepository(), width, height, deliveryContext);
                  break;
              }
          }
      }
    }
   
    if(assetUrl.equals(""))
    { 
      List roles = infoGluePrincipal.getRoles();
      Iterator rolesIterator = roles.iterator();
      while(rolesIterator.hasNext())
      {
        InfoGlueRole role = (InfoGlueRole)rolesIterator.next();
       
        Collection rolePropertiesList = RolePropertiesController.getController().getRolePropertiesList(role.getName(), languageId, db, true);
        Iterator rolePropertiesListIterator = rolePropertiesList.iterator();
        while(rolePropertiesListIterator.hasNext())
        {
          RoleProperties roleProperties = (RoleProperties)rolePropertiesListIterator.next();
         
          if(roleProperties != null && roleProperties.getLanguage().getLanguageId().equals(languageId))
          {
              Collection assets = roleProperties.getDigitalAssets();
              Iterator assetsIterator = assets.iterator();
              while(assetsIterator.hasNext())
              {
                  DigitalAsset digitalAsset = (DigitalAsset)assetsIterator.next();
                  if(digitalAsset.getAssetKey().equalsIgnoreCase(assetKey))
                  {
                      SiteNode siteNode = SiteNodeController.getController().getSiteNodeWithId(siteNodeId, db);
                      assetUrl = DigitalAssetDeliveryController.getDigitalAssetDeliveryController().getAssetThumbnailUrl(digitalAsset, siteNode.getRepository(), width, height, deliveryContext);
                      break;
                  }
              }
          }
        }
                 
      }
     
      if(assetUrl.equals("") && useLanguageFallback)
      {
        LanguageVO masterLanguageVO = LanguageDeliveryController.getLanguageDeliveryController().getMasterLanguageForSiteNode(db, siteNodeId);
        if(!masterLanguageVO.getLanguageId().equals(languageId))
          return getPrincipalThumbnailAssetUrl(db, infoGluePrincipal, assetKey, masterLanguageVO.getLanguageId(), siteNodeId, useLanguageFallback, width, height, deliveryContext);
      }
    }
 
    if(assetUrl.equals(""))
    { 
      List groups = infoGluePrincipal.getGroups();
      Iterator groupsIterator = groups.iterator();
      while(groupsIterator.hasNext())
      {
        InfoGlueGroup group = (InfoGlueGroup)groupsIterator.next();
       
        Collection groupPropertiesList = GroupPropertiesController.getController().getGroupPropertiesList(group.getName(), languageId, db, true);
        Iterator groupPropertiesListIterator = groupPropertiesList.iterator();
        while(groupPropertiesListIterator.hasNext())
        {
          GroupProperties groupProperties = (GroupProperties)groupPropertiesListIterator.next();
         
          if(groupProperties != null && groupProperties.getLanguage().getLanguageId().equals(languageId))
          {
              Collection assets = groupProperties.getDigitalAssets();
              Iterator assetsIterator = assets.iterator();
              while(assetsIterator.hasNext())
              {
                  DigitalAsset digitalAsset = (DigitalAsset)assetsIterator.next();
                  if(digitalAsset.getAssetKey().equalsIgnoreCase(assetKey))
                  {
                      SiteNode siteNode = SiteNodeController.getController().getSiteNodeWithId(siteNodeId, db);
                      assetUrl = DigitalAssetDeliveryController.getDigitalAssetDeliveryController().getAssetThumbnailUrl(digitalAsset, siteNode.getRepository(), width, height, deliveryContext);
                      break;
                  }
View Full Code Here

        try
    {
      db.begin();

      DigitalAsset da = PortletAssetController.getDigitalAssetWithId(digitalAssetId, db);
      if (da == null)
      {
        return "error";
      }

      String webappsDir = PORTLET_BASE;
      if (webappsDir == null || webappsDir.length() == 0)
      {
        String tomcat_home = System.getProperty("CATALINA_HOME");
        if (tomcat_home == null)
        {
          tomcat_home = System.getProperty("TOMCAT_HOME");
        }
        if (tomcat_home != null)
        {
          webappsDir = new File(tomcat_home, "webapps").getAbsolutePath();
        }
      }

      String containerName = (String) getRequest().getAttribute(PortalServletDispatcher.PORTLET_CONTAINER_NAME);

      // Deploy portlet
      String warName = da.getAssetFileName();
      log.info("Deploying portlet " + warName + " at " + webappsDir);
      InputStream is = da.getAssetBlob();
      boolean deployed = Deploy.deployArchive(webappsDir, warName, is, containerName);
      is.close();
      if (deployed)
      {
        log.debug("Successful portlet deployment!");
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.