Package org.infoglue.cms.entities.content

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


      logger.info("Creating new asset:" + newName + ":" + length + ":" + contentType);
   
    Resource resource = null;
    try
    {
      DigitalAssetVO digitalAsset = null;
     
      List<DigitalAssetVO> assetVOList = DigitalAssetController.getController().getDigitalAssetVOList(this.contentVersion.getId());
      if(logger.isInfoEnabled())
        logger.info("assetVOList:" + assetVOList.size());
      for(DigitalAssetVO asset : assetVOList)
      {
        if(asset.getAssetFileName().equalsIgnoreCase(newName))
        {
          digitalAsset = asset;

          digitalAsset.setAssetContentType(contentType);
          digitalAsset.setAssetFileName(newName);
          digitalAsset.setAssetFilePath("");
          digitalAsset.setAssetFileSize(length.intValue());
          if(newName.lastIndexOf(".") > -1)
            digitalAsset.setAssetKey(newName.substring(0,newName.lastIndexOf(".")));
          else
            digitalAsset.setAssetKey(newName);
           
          digitalAsset = DigitalAssetController.update(digitalAsset, inputStream);
        }
      }

      if(digitalAsset == null)
      {
        digitalAsset = new DigitalAssetVO();
        digitalAsset.setAssetContentType(contentType);
        digitalAsset.setAssetFileName(newName);
        digitalAsset.setAssetFilePath("");
        digitalAsset.setAssetFileSize(length.intValue());
        if(newName.lastIndexOf(".") > -1)
          digitalAsset.setAssetKey(newName.substring(0,newName.lastIndexOf(".")));
        else
          digitalAsset.setAssetKey(newName);
         
        DigitalAssetVO asset = DigitalAssetController.create(digitalAsset, inputStream, this.contentVersion.getId(), getInfoGluePrincipal());
      }
      if(logger.isInfoEnabled())
        logger.info("digitalAsset:" + digitalAsset);
      resource = new DigitalAssetResource(digitalAsset, this.contentVersion);
    }
View Full Code Here


   
      if(this.contentVersionId != null)
      {
          List<Integer> newContentVersionIdList = new ArrayList<Integer>();
 
          DigitalAssetVO digitalAssetVO = ContentVersionController.getContentVersionController().checkStateAndChangeIfNeeded(contentVersionId, digitalAssetId, getInfoGluePrincipal(), newContentVersionIdList);
          digitalAssetVO.setAssetContentType(this.digitalAssetVO.getAssetContentType());
          digitalAssetVO.setAssetFileSize(this.digitalAssetVO.getAssetFileSize());
          //digitalAssetVO = DigitalAssetController.create(newAsset, is, this.contentVersionId, this.getInfoGluePrincipal(), newContentVersionIdList);
          if(newContentVersionIdList.size() > 0)
          {
            Integer newContentVersionId = newContentVersionIdList.get(0);
            logger.debug("newContentVersionId:" + newContentVersionId + ":" + this.contentVersionId);
            if(this.contentVersionId != newContentVersionId)
              this.refreshAll = true;
            setContentVersionId(newContentVersionId);
          }
         
          DigitalAssetVO updatedDigitalAssetVO = DigitalAssetController.update(digitalAssetVO, is);
      }
 
      if(is != null)
        is.close();
     
View Full Code Here

    if(toEncoding == null)
      toEncoding = "utf-8";
   
    this.digitalAssetKey = new String(digitalAssetKey.getBytes(fromEncoding), toEncoding);

      DigitalAssetVO newAsset = new DigitalAssetVO();
    newAsset.setAssetContentType(contentType);
    newAsset.setAssetKey(this.digitalAssetKey);
    newAsset.setAssetFileName(digitalAssetVO.getAssetFileName());
    newAsset.setAssetFilePath(digitalAssetVO.getAssetFilePath());
    newAsset.setAssetFileSize(new Integer(new Long(file.length()).intValue()));
    InputStream is = new FileInputStream(file);
   
    if(this.contentTypeDefinitionId != null && digitalAssetKey != null)
    {
      AssetKeyDefinition assetKeyDefinition = ContentTypeDefinitionController.getController().getDefinedAssetKey(contentTypeDefinitionVO, true, digitalAssetKey);
View Full Code Here

                  //String filePath = file.getParentFile().getPath();
                  String filePath = CmsPropertyHandler.getDigitalAssetPath();
                  fileSystemName = filePath + File.separator + tempFileName;
                  logger.info("fileSystemName:" + fileSystemName);
                 
                  DigitalAssetVO newAsset = new DigitalAssetVO();
            newAsset.setAssetContentType(contentType);
            newAsset.setAssetKey(digitalAssetKey);
            newAsset.setAssetFileName(fileName);
            newAsset.setAssetFilePath(filePath);
            newAsset.setAssetFileSize(new Integer(new Long(file.length()).intValue()));
            //is = new FileInputStream(renamedFile);
            logger.info("CmsPropertyHandler.getEnableDiskAssets():" + CmsPropertyHandler.getEnableDiskAssets());
            if(CmsPropertyHandler.getEnableDiskAssets().equals("false"))
            {
              logger.info("Trying to debug:" + file.getPath() + ":" + file.length());
              if(file.length() < 1000 && logger.isInfoEnabled())
              {
                try
                {
                  InputStream in = new FileInputStream(file);
                  byte[] b  = new byte[(int)file.length()];
                  int len = b.length;
                  int total = 0;
   
                  while (total < len) {
                    int result = in.read(b, total, len - total);
                    if (result == -1) {
                      break;
                    }
                    total += result;
                  }
                  in.close();
                  logger.info(new String(b, "UTF-8"));
                }
                catch (Exception e)
                {
                  e.printStackTrace();
                }
              }
             
              is = new FileInputStream(file);
            }
           
                  List existingAssetVOList = DigitalAssetController.getDigitalAssetVOList(contentVersionId);
                  Iterator existingAssetVOListIterator = existingAssetVOList.iterator();
                  while(existingAssetVOListIterator.hasNext())
                  {
                    DigitalAssetVO existingDigitalAssetVO = (DigitalAssetVO)existingAssetVOListIterator.next();
                    if(existingDigitalAssetVO.getAssetKey().equalsIgnoreCase(digitalAssetKey))
                    {
                  file.delete();
                  this.reasonKey = "tool.contenttool.fileUpload.fileUploadFailedOnAssetKeyExistingText";
                        this.uploadMaxSize = "\"" + digitalAssetKey + "\"";
                        this.getResponse().setContentType("text/html; charset=UTF-8");
View Full Code Here

    if(outputFormat.equalsIgnoreCase("gif"))
      assetContentType = "image/gif";
    if(outputFormat.equalsIgnoreCase("jpg"))
      assetContentType = "image/jpeg";
   
    DigitalAssetVO digitalAssetVO = new DigitalAssetVO();
    digitalAssetVO.setAssetContentType(assetContentType);
    digitalAssetVO.setAssetFileName(outputFile.getName());
    digitalAssetVO.setAssetFilePath(outputFile.getPath());
    digitalAssetVO.setAssetFileSize(new Integer((int)outputFile.length()));
    digitalAssetVO.setAssetKey(originalAssetVO.getAssetKey() + "_" + assetSuffix);
   
    InputStream is = new FileInputStream(outputFile);
   
      List<Integer> newContentVersionIdList = new ArrayList<Integer>();
      this.digitalAssetVO = DigitalAssetController.create(digitalAssetVO, is, this.contentVersionId, this.getInfoGluePrincipal(), newContentVersionIdList);
View Full Code Here

            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);
            }
           
            is.close();
View Full Code Here

  public SimpleContentXmlServiceAction() {
  }

  public String getDigitalAssetInfo() throws Exception {
    String ret = "";
    DigitalAssetVO digitalAssetVO = null;

    if (digitalAssetId != null) {
      digitalAssetVO = DigitalAssetController
          .getDigitalAssetVOWithId(digitalAssetId);
    } else {
      digitalAssetVO = DigitalAssetController.getDigitalAssetVO(
          contentId, languageId, digitalAssetKey, true);
    }

    ret = "<digitalAssetInfo>"
        + "<assetURL>"
        + DigitalAssetController.getDigitalAssetUrl(digitalAssetVO.getId())
        + "</assetURL>"
        + "<assetId>"
        + digitalAssetVO.getId()
        + "</assetId>"
        + "</digitalAssetInfo>";

    return ret;
  }
View Full Code Here

    String imageHref = null;
    try
    {
      ColorHelper ch = new ColorHelper();
      Color canvasColor = ch.getHexColor(canvasColorHexCode);
      DigitalAssetVO assetVO = DigitalAssetController.getDigitalAssetVO(contentId, languageId, assetKey, useLanguageFallback);
          
      imageHref = DigitalAssetController.getDigitalAssetThumbnailUrl(assetVO.getId(), canvasWidth, canvasHeight, canvasColor, alignment, valignment, width, height, quality);
    }
    catch(Exception e)
    {
      logger.warn("We could not get the url of the thumbnail: " + e.getMessage(), e);
      imageHref = e.getMessage();
View Full Code Here

   * Getting all assets for a Principal - used for personalisation.
   */
 
  public DigitalAssetVO getPrincipalAsset(Database db, InfoGluePrincipal infoGluePrincipal, Integer languageId, String assetKey) throws Exception
  {
    DigitalAssetVO asset = null;
   
    if(infoGluePrincipal == null)
      return null;
 
    try
    {
      List<DigitalAssetVO> assetList = getPrincipalAssets(db, infoGluePrincipal, languageId);
      Iterator<DigitalAssetVO> assetListIterator = assetList.iterator();
      while(assetListIterator.hasNext())
      {
        DigitalAssetVO currentAsset = (DigitalAssetVO)assetListIterator.next();
        logger.info("" + currentAsset.getAssetKey() + "=" + assetKey);
        if(currentAsset.getAssetKey().equals(assetKey))
        {
          asset = currentAsset;
          break;
        }
      }
View Full Code Here

     
      this.digitalAssetKey = new String(this.digitalAssetKey.getBytes(fromEncoding), toEncoding);

      List<Integer> newContentVersionIdList = new ArrayList<Integer>();

      DigitalAssetVO digitalAssetVO = ContentVersionController.getContentVersionController().checkStateAndChangeIfNeeded(contentVersionId, digitalAssetId, getInfoGluePrincipal(), newContentVersionIdList);
     
      if(newContentVersionIdList.size() > 0)
        {
          Integer newContentVersionId = newContentVersionIdList.get(0);
          if(this.contentVersionId != newContentVersionId)
            refreshAll = true;
          setContentVersionId(newContentVersionId);
        }
     
      digitalAssetVO.setAssetKey(this.digitalAssetKey);

        if(mpr != null)
        {
          Enumeration names = mpr.getFileNames();
             while (names.hasMoreElements())
             {
                String name = (String)names.nextElement();
                         
                file = mpr.getFile(name);
                if(file != null)
                {
                  String contentType    = mpr.getContentType(name);
            String fileSystemName = mpr.getFilesystemName(name);
         
            String fileName = fileSystemName;
                  fileName = formatter.replaceNiceURINonAsciiWithSpecifiedChars(fileName, CmsPropertyHandler.getNiceURIDefaultReplacementCharacter());
            //fileName = new VisualFormatter().replaceNonAscii(fileName, '_');

            String tempFileName = "tmp_" + System.currentTimeMillis() + "_" + fileName;
            //String filePath = file.getParentFile().getPath();
                  String filePath = CmsPropertyHandler.getDigitalAssetPath();
                  fileSystemName =  filePath + File.separator + tempFileName;
                 
                  digitalAssetVO.setAssetContentType(contentType);
            digitalAssetVO.setAssetFileName(fileName);
            digitalAssetVO.setAssetFilePath(filePath);
            digitalAssetVO.setAssetFileSize(new Integer(new Long(file.length()).intValue()));
            is = new FileInputStream(file);     
           
            //String fileUploadMaximumSize = getPrincipalPropertyValue("fileUploadMaximumSize", false, true);
                       
            if(myFileUploadSizeLimit.intValue() > -1 && myFileUploadSizeLimit.intValue() < new Long(file.length()).intValue())
View Full Code Here

TOP

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

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.