Package org.infoglue.cms.entities.content

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


            db.begin();

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

            DigitalAsset da = getPortletRegistry();
            if (da == null) {
                LOG.info("Creating new " + PORTLET_REGISTRY_CONTENT_NAME);

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

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

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

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


     * @see org.apache.pluto.portalImpl.services.portletentityregistry.PortletEntityRegistryService#load()
     */
    public void load() throws IOException {
        LOG.warn("Loading PortletEntityRegistry start...");
        try {
            DigitalAsset da = getPortletRegistry();
            if (da == null) {
                applications = new PortletApplicationEntityListImpl();
            } else {
                InputStream is = da.getAssetBlob();
                applications = builder.getPortletApplicationEntityList(is);
                is.close();
            }
            needRefresh = false;
            if (LOG.isDebugEnabled()) {
View Full Code Here

     */
    private DigitalAsset getPortletRegistry() throws Exception
    {
      // Try to get the portlet by id in order to optimize the db fetch (can take up to 5 minutes to get
      // the PORTLET_REGISTRY_CONTENT_NAME when getting it by name).
      DigitalAsset da = PortletAssetController.getPortletRegistry();
      if(da != null)
      {
        return da;
      }
     
      // Fallback: Try to get the portlet by name
        List das = PortletAssetController.getDigitalAssetByName(PORTLET_REGISTRY_CONTENT_NAME);
        if (das != null && das.size() > 0) {
            da = (DigitalAsset) das.get(0);
            LOG.debug("Registry located as id=" + da.getId());
            return da;
        } else {
            LOG.info("Portlet Registry not found");
        }
        return null;
View Full Code Here

        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

 
    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

      {
        File translationsDir = new File(CmsPropertyHandler.getContextRootPath() + File.separator + "translations");
       
        //logger.info("translationsDir:" + translationsDir);
       
        DigitalAsset da = (DigitalAsset)assetsIterator.next();
        String themeName = da.getAssetFileName();

        //logger.info("themeName:" + themeName);

        File presentationStringFile = new File(CmsPropertyHandler.getContextRootPath() + File.separator + "translations" + File.separator + da.getAssetFileName());
        logger.info("Caching " + presentationStringFile + " at " + translationsDir);
        InputStream is = da.getAssetBlob();

        FileOutputStream os = new FileOutputStream(presentationStringFile);
              BufferedOutputStream bos = new BufferedOutputStream(os);
              int num = copyStream(is, bos);
              bos.close();
View Full Code Here

        currentCount = 0;
       
        while(assetResults.hasMore() && currentCount < maxRows)
        {
          SmallDigitalAssetImpl smallAsset = (SmallDigitalAssetImpl)assetResults.next();
          DigitalAsset asset = DigitalAssetController.getMediumDigitalAssetWithId(smallAsset.getId(), db);
          logger.info("Found a asset matching " + searchString + ":" + asset.getId());
          Collection versions = asset.getContentVersions();
          Iterator versionsIterator = versions.iterator();
          while(versionsIterator.hasNext())
          {
            ContentVersion contentVersion = (ContentVersion)versionsIterator.next();
            if(contentVersion.getOwningContent().getId().intValue() != previousContentId.intValue() || contentVersion.getLanguage().getId().intValue() != previousLanguageId.intValue())
View Full Code Here

      {
        SmallDigitalAssetImpl smallAsset = (SmallDigitalAssetImpl)assetResults.next();
        //if(smallAsset.getAssetContentType().matches(assetTypeFilter))
        if(assetTypeFilter == null || assetTypeFilter.equals("*") || assetTypeFilter.indexOf(smallAsset.getAssetContentType()) > -1)
        {
          DigitalAsset asset = DigitalAssetController.getMediumDigitalAssetWithId(smallAsset.getId(), db);
          logger.info("Found a asset matching " + searchString + ":" + asset.getId());
          Collection versions = asset.getContentVersions();
          Iterator versionsIterator = versions.iterator();
          while(versionsIterator.hasNext())
          {
            ContentVersion contentVersion = (ContentVersion)versionsIterator.next();
            if(contentVersion.getValueObject().getContentId().intValue() != previousContentId.intValue() || contentVersion.getValueObject().getLanguageId().intValue() != previousLanguageId.intValue())
            {
                ContentVersion latestContentVersion = ContentVersionController.getContentVersionController().getLatestActiveContentVersion(contentVersion.getValueObject().getContentId(), contentVersion.getValueObject().getLanguageId(), db);
              if(latestContentVersion != null && latestContentVersion.getId().intValue() == contentVersion.getId().intValue())
              {
                asset.getValueObject().setContentPath(ContentController.getContentController().getContentPath(latestContentVersion.getValueObject().getContentId(), false, true, db));
                asset.getValueObject().setContentId(latestContentVersion.getValueObject().getContentId());

                String assetUrl = getDigitalAssetUrl(asset.getValueObject(), db);
                String assetThumbnailUrl = getDigitalAssetThumbnailUrl(asset.getValueObject().getId(), 100, 60, "ffffff", "center", "middle", 100, 60, 75, db);
                asset.getValueObject().setAssetUrl(assetUrl);
                asset.getValueObject().setAssetThumbnailUrl(assetThumbnailUrl);

                matchingAssets.add(asset.getValueObject());
                  previousContentId = contentVersion.getValueObject().getContentId();
                  previousLanguageId = contentVersion.getValueObject().getLanguageId();
                  currentCount++;
              }
            }           
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

    {
        Database db = CastorDatabaseService.getDatabase();
     
        String portletId = CmsPropertyHandler.getDigitalAssetPortletRegistryId();
       
        DigitalAsset da = null;
        if(portletId == null || portletId.equals("") || portletId.equalsIgnoreCase("@digitalAssetPortletRegistryId@"))
          return da;
         
        beginTransaction(db);
        try
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.