Package org.infoglue.cms.entities.content

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


    Timer t = new Timer();
    if(this.deliveryContext.getUsedContentVersions().size() > 0 || (useContentLookup && this.deliveryContext.getUsedContents().size() > 0))
    {
      try
      {
        SmallestContentVersionVO lastContentVersionVO = null;
        if(useContentLookup)
          lastContentVersionVO = ContentVersionController.getContentVersionController().getLatestContentVersionVOByContentIds(this.deliveryContext.getUsedContents(), getDatabase());
        else
          lastContentVersionVO = ContentVersionController.getContentVersionController().getLatestContentVersionVO(this.deliveryContext.getUsedContentVersions(), getDatabase());
        logger.info("lastContentVersionVO:" + lastContentVersionVO);
        if(lastContentVersionVO != null)
          lastModifiedDateTime = lastContentVersionVO.getModifiedDateTime();
        logger.info("lastModifiedDateTime from cvVO:" + lastContentVersionVO.getModifiedDateTime());
      }
      catch (Exception e)
      {
        e.printStackTrace();
      }
View Full Code Here


                Set<String> handledVersions = new HashSet<String>();
                List<SmallestContentVersionVO> contentVersionVOList = DigitalAssetController.getContentVersionVOListConnectedToAssetWithId(new Integer(objectId))
                  Iterator<SmallestContentVersionVO> contentVersionVOListIterator = contentVersionVOList.iterator();
                  while(contentVersionVOListIterator.hasNext())
                  {
                    SmallestContentVersionVO contentVersionVO = contentVersionVOListIterator.next();
                    logger.info("Invoking clearCaches for ContentVersionImpl with id:" + contentVersionVO.getId());
                    String key = contentVersionVO.getContentId() + "_" + contentVersionVO.getLanguageId();
                    //System.out.println("Invoking clearCaches for ContentVersionImpl with id:" + key + " " + contentVersionVO.getId());
                    if(!handledVersions.contains(key))
                    {
                      CacheController.clearCaches(ContentVersionImpl.class.getName(), contentVersionVO.getId().toString(), null);             
                      CacheController.clearCaches(SmallContentVersionImpl.class.getName(), contentVersionVO.getId().toString(), null);                   
                      CacheController.clearCaches(SmallestContentVersionImpl.class.getName(), contentVersionVO.getId().toString(), null);
                      handledVersions.add(key);
                    }
                  }
              }
              else if(Class.forName(className).getName().equals(MediumDigitalAssetImpl.class.getName()))
              {
                CacheController.clearCache("digitalAssetCache");
                Class typesExtra = SmallDigitalAssetImpl.class;
                Object[] idsExtra = {new Integer(objectId)};
                CacheController.clearCache(typesExtra, idsExtra);
 
                Class typesExtraMedium = DigitalAssetImpl.class;
                Object[] idsExtraMedium = {new Integer(objectId)};
                CacheController.clearCache(typesExtraMedium, idsExtraMedium);
 
                String disableAssetDeletionInWorkThread = CmsPropertyHandler.getDisableAssetDeletionInWorkThread();
                if(disableAssetDeletionInWorkThread != null && !disableAssetDeletionInWorkThread.equals("true"))
                {
                  logger.info("We should delete all images with digitalAssetId " + objectId);
                  DigitalAssetDeliveryController.getDigitalAssetDeliveryController().deleteDigitalAssets(new Integer(objectId));
                }
               
                Set<String> handledVersions = new HashSet<String>();
                List<SmallestContentVersionVO> contentVersionVOList = DigitalAssetController.getContentVersionVOListConnectedToAssetWithId(new Integer(objectId))
                  Iterator<SmallestContentVersionVO> contentVersionVOListIterator = contentVersionVOList.iterator();
                  while(contentVersionVOListIterator.hasNext())
                  {
                    SmallestContentVersionVO contentVersionVO = contentVersionVOListIterator.next();
                    String key = contentVersionVO.getContentId() + "_" + contentVersionVO.getLanguageId();
                    //System.out.println("Invoking clearCaches for ContentVersionImpl with id:" + key + " " + contentVersionVO.getId());
                    if(!handledVersions.contains(key))
                    {
                      CacheController.clearCaches(ContentVersionImpl.class.getName(), contentVersionVO.getId().toString(), null);             
                      CacheController.clearCaches(SmallContentVersionImpl.class.getName(), contentVersionVO.getId().toString(), null);                   
                      CacheController.clearCaches(SmallestContentVersionImpl.class.getName(), contentVersionVO.getId().toString(), null)
                      handledVersions.add(key);
                    }
                  }
              }
              else if(Class.forName(className).getName().equals(SystemUserImpl.class.getName()))
View Full Code Here

    while (lit.hasNext())
    {
      LanguageVO langVO = (LanguageVO) lit.next();
      if (langVO.getLanguageId().compareTo(languageId)!=0)
      {
        SmallestContentVersionVO contentVersion = getSmallestContentVersionVO(siteNodeId, contentId, langVO.getLanguageId(), db, false, deliveryContext, infoGluePrincipal);
        if (contentVersion != null)
        {
          DigitalAssetVO digitalAsset = (assetKey == null) ? DigitalAssetController.getLatestDigitalAssetVO(contentVersion.getId(), db) : DigitalAssetController.getLatestDigitalAssetVO(contentVersion.getId(), assetKey, db);
         
          if(digitalAsset != null)
          {
            asset = digitalAsset;
            break;
          }
        }                 
        checkedLanguages.add(langVO.getLanguageId());
      }
    }

    if(asset == null)
    {
      ContentVO contentVO = getContentVO(db, contentId, deliveryContext);
      SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId(siteNodeId, db);

      if(!contentVO.getRepositoryId().equals(siteNodeVO.getRepositoryId()))
      {
        List contentRepositoryLangs = LanguageDeliveryController.getLanguageDeliveryController().getAvailableLanguagesForRepository(db, contentVO.getRepositoryId());
        Iterator contentRepositoryLangsIterator = contentRepositoryLangs.iterator();
        while (contentRepositoryLangsIterator.hasNext())
        {
          LanguageVO langVO = (LanguageVO) contentRepositoryLangsIterator.next();
          if (langVO.getLanguageId().compareTo(languageId)!=0)
          {
            if(checkedLanguages.contains(langVO.getLanguageId()))
            {
              continue;
            }

            SmallestContentVersionVO contentVersion = getSmallestContentVersionVO(siteNodeId, contentId, langVO.getLanguageId(), db, false, deliveryContext, infoGluePrincipal);
            if (contentVersion != null)
            {
              DigitalAssetVO digitalAsset = (assetKey == null) ? DigitalAssetController.getLatestDigitalAssetVO(contentVersion.getId(), db) : DigitalAssetController.getLatestDigitalAssetVO(contentVersion.getId(), assetKey, db);
             
              if(digitalAsset != null)
              {
                asset = digitalAsset;
                break;
View Full Code Here

  public Integer getDigitalAssetId(Database db, Integer contentId, Integer languageId, String assetKey, Integer siteNodeId, boolean useLanguageFallback, DeliveryContext deliveryContext, InfoGluePrincipal infoGluePrincipal) throws SystemException, Exception
  {
      Integer digitalAssetId = null;
   
      SmallestContentVersionVO contentVersion = getSmallestContentVersionVO(siteNodeId, contentId, languageId, db, useLanguageFallback, deliveryContext, infoGluePrincipal);
    if (contentVersion != null)
        {
          DigitalAssetVO digitalAsset = DigitalAssetController.getLatestDigitalAssetVO(contentVersion.getContentVersionId(), assetKey, db);
     
      if(digitalAsset != null)
      {
          digitalAssetId = digitalAsset.getId();
      }
View Full Code Here

      return cachedAssetUrl;
    }
   
    String assetUrl = "";
   
    SmallestContentVersionVO contentVersion = getSmallestContentVersionVO(siteNodeId, contentId, languageId, db, useLanguageFallback, deliveryContext, infoGluePrincipal);
    if (contentVersion != null)
        {
        DigitalAssetVO digitalAsset = DigitalAssetController.getLatestDigitalAssetVO(contentVersion.getId(), db);
       
      if(digitalAsset != null)
      {
        //String fileName = digitalAsset.getDigitalAssetId() + "_" + digitalAsset.getAssetFileName();
        String fileName = DigitalAssetDeliveryController.getAssetFileName(digitalAsset, contentId, languageId, db);
View Full Code Here

    }
   
    String assetUrl = "";
    assetUrl = urlComposer.composeDigitalAssetUrl("", null, "", deliveryContext);
   
    SmallestContentVersionVO contentVersion = getSmallestContentVersionVO(siteNodeId, contentId, languageId, db, useLanguageFallback, deliveryContext, infoGluePrincipal);
    ContentVO contentVO = this.getContentVO(db, contentId, deliveryContext);
    LanguageVO masterLanguageVO = LanguageDeliveryController.getLanguageDeliveryController().getMasterLanguageForRepository(contentVO.getRepositoryId(), db);
    if(logger.isInfoEnabled())
    {
      logger.info("languageId:" + languageId);
      logger.info("masterLanguageVO:" + masterLanguageVO);
    }
    /*
    if(deliveryContext.getUseDownloadAction())
    {
      SiteNode siteNode = NodeDeliveryController.getNodeDeliveryController(siteNodeId, languageId, contentId).getSiteNode(db, siteNodeId);
      String dnsName = CmsPropertyHandler.getWebServerAddress();
      if(siteNode != null && siteNode.getRepository().getDnsName() != null && !siteNode.getRepository().getDnsName().equals(""))
        dnsName = siteNode.getRepository().getDnsName();

      return urlComposer.composeDigitalAssetUrl(dnsName, siteNodeId, contentId, languageId, assetKey, deliveryContext);
    }
    */
   
    boolean isUnprotectedAsset = getHasUserContentAccess(db, UserControllerProxy.getController().getUser(CmsPropertyHandler.getAnonymousUser()), contentId);
   
    if(!isUnprotectedAsset)
    {
          DigitalAssetVO digitalAsset = DigitalAssetController.getLatestDigitalAssetVO(contentVersion.getId(), assetKey, db);
          if(digitalAsset == null)
            return "";
         
      //SiteNodeVO siteNodeVO = getSiteNodeVO(db, siteNodeId);
      String dnsName = CmsPropertyHandler.getWebServerAddress();
      if(siteNodeVO != null)
      {
        RepositoryVO repositoryVO = RepositoryController.getController().getRepositoryVOWithId(siteNodeVO.getRepositoryId(), db);
        if(repositoryVO.getDnsName() != null && !repositoryVO.getDnsName().equals(""))
          dnsName = repositoryVO.getDnsName();
      }
      /*
      SiteNode siteNode = NodeDeliveryController.getNodeDeliveryController(siteNodeId, languageId, contentId).getSiteNodeVO(db, siteNodeId);
      String dnsName = CmsPropertyHandler.getWebServerAddress();
      if(siteNode != null && siteNode.getRepository().getDnsName() != null && !siteNode.getRepository().getDnsName().equals(""))
        dnsName = siteNode.getRepository().getDnsName();
      */

      return urlComposer.composeDigitalAssetUrl(dnsName, siteNodeId, contentId, languageId, assetKey, deliveryContext, db);
    }
    else if(contentVersion != null)
        {
          DigitalAssetVO digitalAsset = DigitalAssetController.getLatestDigitalAssetVO(contentVersion.getId(), assetKey, db);
     
      if(digitalAsset != null)
      {
        //String fileName = digitalAsset.getDigitalAssetId() + "_" + digitalAsset.getAssetFileName();
        String fileName = DigitalAssetDeliveryController.getAssetFileName(digitalAsset, contentId, languageId, db);
        //String folderName = "" + (digitalAsset.getDigitalAssetId().intValue() / 1000);
        String folderName = DigitalAssetDeliveryController.getAssetFolderName(digitalAsset, contentId, languageId, db);

        int i = 0;
        File masterFile = null;
        String filePath = CmsPropertyHandler.getDigitalAssetPath0() + File.separator + folderName;
        while(filePath != null)
        {
          try
          {
              if(masterFile == null)
                  masterFile = DigitalAssetDeliveryController.getDigitalAssetDeliveryController().dumpDigitalAsset(digitalAsset, fileName, filePath, db)
            else
                DigitalAssetDeliveryController.getDigitalAssetDeliveryController().dumpDigitalAsset(masterFile, fileName, filePath);
          }
          catch(Exception e)
          {
            logger.warn("An file could not be written:" + e.getMessage(), e);
          }
           
            i++;
            filePath = CmsPropertyHandler.getProperty("digitalAssetPath." + i);
            if(filePath != null)
              filePath += File.separator + folderName;
        }

        //SiteNodeVO siteNodeVO = getSiteNodeVO(db, siteNodeId);
        String dnsName = CmsPropertyHandler.getWebServerAddress();
        if(siteNodeVO != null)
        {
          RepositoryVO repositoryVO = RepositoryController.getController().getRepositoryVOWithId(siteNodeVO.getRepositoryId(), db);
          if(repositoryVO.getDnsName() != null && !repositoryVO.getDnsName().equals(""))
            dnsName = repositoryVO.getDnsName();
        }

        /*
        SiteNode siteNode = NodeDeliveryController.getNodeDeliveryController(siteNodeId, languageId, contentId).getSiteNode(db, siteNodeId);
        String dnsName = CmsPropertyHandler.getWebServerAddress();
        if(siteNode != null && siteNode.getRepository().getDnsName() != null && !siteNode.getRepository().getDnsName().equals(""))
          dnsName = siteNode.getRepository().getDnsName();
        */
         
        if(deliveryContext.getUseDownloadAction())
          assetUrl = urlComposer.composeDigitalAssetUrl(dnsName, siteNodeId, contentId, languageId, assetKey, deliveryContext, db);
        else
          assetUrl = urlComposer.composeDigitalAssetUrl(dnsName, folderName, fileName, deliveryContext);
      }
      else if(useLanguageFallback)
      {
        assetUrl = getLanguageIndependentAssetUrl(contentId, languageId, siteNodeId, db, assetKey, deliveryContext, infoGluePrincipal);
      }
    }       
    else if(useLanguageFallback && languageId != null && masterLanguageVO != null && languageId.intValue() != masterLanguageVO.getId().intValue())
    {
        contentVersion = getSmallestContentVersionVO(siteNodeId, contentId, languageId, db, useLanguageFallback, deliveryContext, infoGluePrincipal);
       
        logger.info("contentVersion:" + contentVersion);
      if(contentVersion != null)
      {
              DigitalAssetVO digitalAsset = DigitalAssetController.getLatestDigitalAssetVO(contentVersion.getId(), assetKey, db);
       
        if(digitalAsset != null)
        {
          //String fileName = digitalAsset.getDigitalAssetId() + "_" + digitalAsset.getAssetFileName();
          String fileName = DigitalAssetDeliveryController.getAssetFileName(digitalAsset, contentId, languageId, db);
View Full Code Here

      return cachedAssetUrl;
    }
   
    String assetUrl = "";
   
    SmallestContentVersionVO contentVersion = getSmallestContentVersionVO(siteNodeId, contentId, languageId, db, useLanguageFallback, deliveryContext, infoGluePrincipal);
    if (contentVersion != null)
    {
      //DigitalAsset digitalAsset = getLatestDigitalAsset(contentVersion);
          DigitalAssetVO digitalAsset = DigitalAssetController.getLatestDigitalAssetVO(contentVersion.getId(), db);
     
      if(digitalAsset != null)
      {
        //String fileName = digitalAsset.getDigitalAssetId() + "_" + digitalAsset.getAssetFileName();
        String fileName = DigitalAssetDeliveryController.getAssetFileName(digitalAsset, contentId, languageId, db);
View Full Code Here

      return cachedAssetUrl;
    }

    String assetUrl = "";
   
    SmallestContentVersionVO contentVersion = getSmallestContentVersionVO(siteNodeId, contentId, languageId, db, useLanguageFallback, deliveryContext, infoGluePrincipal);
    if (contentVersion != null)
    {
      //DigitalAsset digitalAsset = getDigitalAssetWithKey(contentVersion, assetKey);
          DigitalAssetVO digitalAsset = DigitalAssetController.getLatestDigitalAssetVO(contentVersion.getId(), assetKey, db);

      if(digitalAsset != null)
      {
        //String fileName = digitalAsset.getDigitalAssetId() + "_" + digitalAsset.getAssetFileName();
        String fileName = DigitalAssetDeliveryController.getAssetFileName(digitalAsset, contentId, languageId, null);
View Full Code Here

 
  public Integer getAssetFileSize(Database db, Integer contentId, Integer languageId, String assetKey, Integer siteNodeId, boolean useLanguageFallback, DeliveryContext deliveryContext, InfoGluePrincipal infoGluePrincipal) throws SystemException, Exception
  {
    Integer fileSize = null;
 
    SmallestContentVersionVO contentVersion = getSmallestContentVersionVO(siteNodeId, contentId, languageId, db, useLanguageFallback, deliveryContext, infoGluePrincipal);
    if (contentVersion != null)
    {
      //DigitalAsset digitalAsset =  (assetKey == null) ? getLatestDigitalAsset(contentVersion) : getDigitalAssetWithKey(contentVersion, assetKey);
      DigitalAssetVO digitalAsset =  (assetKey == null) ? DigitalAssetController.getLatestDigitalAssetVO(contentVersion.getId(), db) : DigitalAssetController.getLatestDigitalAssetVO(contentVersion.getId(), assetKey, db);
     
      if(digitalAsset == null)
        digitalAsset = getLanguageIndependentAssetVO(contentId, languageId, siteNodeId, db, assetKey, deliveryContext, infoGluePrincipal);
       
      if(digitalAsset != null)
View Full Code Here

  public String getScriptExtensionUrls(Database db, Integer contentId, Integer languageId, String assetKey, String fileNames, Boolean autoCreateMarkup, Boolean addToHeader, Boolean addToBodyEnd, Boolean addToBundledIncludes, String bundleName, boolean prepend, Integer siteNodeId, boolean useLanguageFallback, DeliveryContext deliveryContext, InfoGluePrincipal infoGluePrincipal) throws SystemException, Exception
  {
    Timer t = new Timer();
    String scriptExtensionUrls = "";
   
    SmallestContentVersionVO contentVersion = getSmallestContentVersionVO(siteNodeId, contentId, languageId, db, useLanguageFallback, deliveryContext, infoGluePrincipal);
    if (contentVersion != null)
        {
      DigitalAssetVO digitalAsset = null;
      if(assetKey == null)
        digitalAsset = DigitalAssetController.getLatestDigitalAssetVO(contentVersion.getContentVersionId(), db);
      else
        digitalAsset = DigitalAssetController.getLatestDigitalAssetVO(contentVersion.getContentVersionId(), assetKey, db);
     
      if(digitalAsset != null)
      {
        String fileName = digitalAsset.getAssetFileName();
       
View Full Code Here

TOP

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

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.