Package org.infoglue.cms.entities.content

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


        beginTransaction(db);
    try
    {
      if(contentId == null)
      {
        SmallestContentVersionVO contentVersionVO = ContentVersionController.getContentVersionController().getSmallestContentVersionVOWithId(oldContentVersionId, db);
        contentId = contentVersionVO.getContentId();
      }
      ContentVersion newContentVersion = changeState(oldContentVersionId, contentVO, stateId, versionComment, overrideVersionModifyer, recipientFilter, infoGluePrincipal, contentId, db, resultingEvents);
      if(newContentVersion != null)
        newContentVersionVO = newContentVersion.getValueObject();
     
View Full Code Here


      beginTransaction(db);
   
      logger.info("lastContentVersionId:" + lastContentVersionId);
      if(lastContentVersionId < 1)
      {
        SmallestContentVersionVO firstContentVersionVO = ContentVersionController.getContentVersionController().getFirstContentVersionId(languageVO.getId(), db);
        if(firstContentVersionVO != null)
          lastContentVersionId = firstContentVersionVO.getId();
      }
      logger.info("lastContentVersionId 2:" + lastContentVersionId);

      ContentTypeDefinitionVO contentTypeDefinitionVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithName("Meta info", db);
          ContentVersionVO lastContentVersionVO = ContentVersionController.getContentVersionController().getLatestContentVersionVO(languageVO.getId(), db);
View Full Code Here

        if(logger.isInfoEnabled())
          logger.info("contentVersionVOList:" + contentVersionVOList.size());
        Iterator<SmallestContentVersionVO> contentVersionsIterator = contentVersionVOList.iterator();
        while(contentVersionsIterator.hasNext())
        {
          SmallestContentVersionVO version = contentVersionsIterator.next();
          RequestAnalyser.getRequestAnalyser().registerComponentStatistics("contentVersionsIterator", t.getElapsedTime());
          ContentVersionVO cvVO = ContentVersionController.getContentVersionController().getContentVersionVOWithId(version.getId(), db2);
         
          Document document = getDocumentFromDigitalAsset(asset, cvVO, db);
          RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getDocumentFromDigitalAsset", t.getElapsedTime());
          logger.info("00000000000000000: Adding asset document:" + document);
          if(document != null)
            returnDocuments.add(document);
        }

        commitTransaction(db2);
      }
      catch(Exception e)
      {
        logger.error("An error occurred so we should not complete the transaction:" + e, e);
        rollbackTransaction(db2);
        throw new SystemException(e.getMessage());
      }
    }
    else if(notificationMessage.getClassName().equals(SiteNodeImpl.class.getName()) || notificationMessage.getClassName().equals(SiteNode.class.getName()))
    {
      SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId((Integer)notificationMessage.getObjectId(), db);
      if (siteNodeVO == null)
      {
        logger.warn("Could not find SiteNode with id: " + notificationMessage.getObjectId());
      }
      else
      {
        siteNodeIdsToIndex.add(siteNodeVO.getId());
      }
    }
   
    logger.info("Indexing:" + siteNodeIdsToIndex.size());
    for(Integer siteNodeId : siteNodeIdsToIndex)
    {
      //Deleting all info based on content
      Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_34);
      logger.info("Deleting all info on:" + siteNodeId);
      //TODO - Fixa sŒ inte assets tas med hŠr....
        Query query = new QueryParser(Version.LUCENE_34, "siteNodeId", analyzer).parse("" + siteNodeId);
      writer.deleteDocuments(query);
      //End

      logger.info("QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ:" + notificationMessage.getObjectId());
      SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId((Integer)notificationMessage.getObjectId(), db);
      logger.info("$$$$$$$$$$Getting doc for " + siteNodeVO.getName());
      Document document = getDocumentFromSiteNode(siteNodeVO, writer, db);
      logger.info("document " + document);
      RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getDocumentFromSiteNode", t.getElapsedTime());
      if(document != null)
        returnDocuments.add(document);
    }
   
    logger.info("Indexing contentIdsToIndex:" + contentIdsToIndex.size());
    for(Integer contentId : contentIdsToIndex)
    {
      //Deleting all info based on content
      Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_34);
      logger.info("Deleting all info on:" + contentId);
      //TODO - Fixa sŒ inte assets tas med hŠr....
     
      String[] fields = new String[]{"isAsset","contentId"};
      String[] queries = new String[]{"true","" + contentId};
      BooleanClause.Occur[] flags = new BooleanClause.Occur[]{BooleanClause.Occur.MUST_NOT,BooleanClause.Occur.MUST};
      Query query = MultiFieldQueryParser.parse(Version.LUCENE_34, queries, fields, flags, analyzer);
     
        //Query query = new QueryParser(Version.LUCENE_34, "contentId", analyzer).parse("" + contentId);
      writer.deleteDocuments(query);
      //End
     
      ContentVO contentVO = ContentController.getContentController().getContentVOWithId(contentId, db);
     
      Document document = getDocumentFromContent(contentVO, notificationMessage, writer, forceVersionIndexing, db);
      RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getDocumentFromContent", (t.getElapsedTimeNanos() / 1000));
     
      if(document != null)
      {
        returnDocuments.add(document);

        logger.info("++++++++++++++Forcing cv indexing");
        List<ContentVersionVO> versions = new ArrayList<ContentVersionVO>();
        if(CmsPropertyHandler.getApplicationName().equalsIgnoreCase("cms"))
        {
          //List<LanguageVO> languages = LanguageController.getController().getLanguageVOList(contentVO.getRepositoryId());
          List<LanguageVO> languages = LanguageController.getController().getLanguageVOList(contentVO.getRepositoryId(), db);
          RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getLanguageVOList", (t.getElapsedTimeNanos() / 1000));
          for(LanguageVO language : languages)
          {
            ContentVersionVO latestVersion = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(contentVO.getId(), language.getId(), Integer.parseInt(CmsPropertyHandler.getOperatingMode()), db);
            RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getLatestActiveContentVersionVO", (t.getElapsedTimeNanos() / 1000));

            if(latestVersion != null)
              versions.add(latestVersion);

            ContentVersionVO latestVersionPublishedVersion = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(contentVO.getId(), language.getId(), ContentVersionVO.PUBLISHED_STATE, db);
            RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getLatestActiveContentVersionVO", (t.getElapsedTimeNanos() / 1000));
            if(latestVersionPublishedVersion != null && latestVersionPublishedVersion.getId().intValue() != latestVersion.getId().intValue())
              versions.add(latestVersionPublishedVersion);
          }

        }
        else
        {
          List<LanguageVO> languages = LanguageController.getController().getLanguageVOList(contentVO.getRepositoryId(), db);
          RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getLanguageVOList", (t.getElapsedTimeNanos() / 1000));
          for(LanguageVO language : languages)
          {
            ContentVersionVO version = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(contentVO.getId(), language.getId(), Integer.parseInt(CmsPropertyHandler.getOperatingMode()), db);
            RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getLatestActiveContentVersionVO", (t.getElapsedTimeNanos() / 1000));
            if(version != null)
              versions.add(version);
          }
        }

        logger.info("versions:" + versions.size());
        for(ContentVersionVO version : versions)
        {
          logger.info("version:" + version.getId());
          Document versionDocument = getDocumentFromContentVersion(version, db);
          RequestAnalyser.getRequestAnalyser().registerComponentStatistics("getDocumentFromContentVersion", t.getElapsedTime());
          if(versionDocument != null)
            returnDocuments.add(versionDocument);
         
          if(version.getId() > this.lastCommitedContentVersionId)
            lastCommitedContentVersionId = version.getId();
        }
      }
    }
   
    return returnDocuments;
View Full Code Here

      {
        List<SmallestContentVersionVO> contentVersionVOList = DigitalAssetController.getContentVersionVOListConnectedToAssetWithId(digitalAssetId)
          Iterator<SmallestContentVersionVO> contentVersionVOListIterator = contentVersionVOList.iterator();
          while(contentVersionVOListIterator.hasNext())
          {
            SmallestContentVersionVO contentVersionVO = contentVersionVOListIterator.next();
            DigitalAssetVO assetVO = DigitalAssetController.getSmallDigitalAssetVOWithId(digitalAssetId);
            Integer contentId = contentVersionVO.getContentId();
            Integer languageId = contentVersionVO.getLanguageId();
            assetKey = assetVO.getAssetKey();
           
          folderName = "" + (contentId / 1000);
          filterString = "" + contentId + "_";
          logger.info("New folderName is:" + folderName);
View Full Code Here

    
  public SmallestContentVersionVO getFirstContentVersionId(Integer languageId, Database db) throws Exception
  {
    Timer t = new Timer();
   
    SmallestContentVersionVO contentVersionVO = null;
     
       StringBuffer SQL = new StringBuffer();

      OQLQuery oql = db.getOQLQuery("CALL SQL select cv.contentVersionId, cv.stateId, cv.modifiedDateTime, cv.versionComment, cv.isCheckedOut, cv.isActive, cv.contentId, cv.languageId, cv.versionModifier FROM cmContentVersion cv where cv.languageId = $1 AS org.infoglue.cms.entities.content.impl.simple.SmallestContentVersionImpl");
      if(CmsPropertyHandler.getUseShortTableNames() != null && CmsPropertyHandler.getUseShortTableNames().equalsIgnoreCase("true"))
View Full Code Here

    {
    Timer t = new Timer();
    if(contentVersionIds == null || contentVersionIds.size() == 0)
      return null;
   
    SmallestContentVersionVO result = null;
   
    StringBuilder variables = new StringBuilder();
   
    int i = 0;
      for(String contentVersionId : contentVersionIds)
View Full Code Here

    {
    Timer t = new Timer();
    if(contentIds == null || contentIds.size() == 0)
      return null;
   
    SmallestContentVersionVO result = null;
   
    StringBuilder variables = new StringBuilder();
    int i = 0;
      for(String contentId : contentIds)
      {
View Full Code Here

        try
        {
      Iterator<SmallestContentVersionVO> contentVersionVOIdListIterator = contentVersionVOList.iterator();
      while(contentVersionVOIdListIterator.hasNext())
      {
        SmallestContentVersionVO contentVersionVO = contentVersionVOIdListIterator.next();
        //ContentVersion contentVersion = getContentVersionWithId(contentVersionVO.getContentVersionId(), db);
        MediumContentVersionImpl contentVersion = getMediumContentVersionWithId(contentVersionVO.getContentVersionId(), db);
        logger.info("Deleting the contentVersion " + contentVersion.getId() + " on content " + contentVersion.getOwningContent());
        delete(contentVersion, db, true);
      }
     
      commitRegistryAwareTransaction(db);
View Full Code Here

          if(minimumTimeBetweenVersionsDuringClean != -1 && versionInitialSuggestions.size() >= numberOfVersionsToKeep)
          {
            Iterator potentialContentVersionVOListIterator = potentialContentVersionVOList.iterator();
            while(potentialContentVersionVOListIterator.hasNext())
            {
              SmallestContentVersionVO potentialContentVersionVO = (SmallestContentVersionVO)potentialContentVersionVOListIterator.next();
             
              SmallestContentVersionVO firstInitialSuggestedContentVersionVO = null;
              Iterator versionInitialSuggestionsIterator = versionInitialSuggestions.iterator();
              while(versionInitialSuggestionsIterator.hasNext())
              {
                SmallestContentVersionVO initialSuggestedContentVersionVO = (SmallestContentVersionVO)versionInitialSuggestionsIterator.next();
                if(initialSuggestedContentVersionVO.getStateId().equals(ContentVersionVO.PUBLISHED_STATE))
                {
                  firstInitialSuggestedContentVersionVO = initialSuggestedContentVersionVO;
                  break;
                }
              }
             
              if(firstInitialSuggestedContentVersionVO != null)
              {
                keptContentVersionVOList.remove(potentialContentVersionVO);
                keptContentVersionVOList.add(firstInitialSuggestedContentVersionVO);
                versionInitialSuggestions.remove(firstInitialSuggestedContentVersionVO);
                versionInitialSuggestions.add(potentialContentVersionVO);
              }
            }
          }
                   
          //System.out.println("versionNonPublishedSuggestions:" + versionNonPublishedSuggestions.size());
          //System.out.println("versionInitialSuggestions:" + versionInitialSuggestions.size());
          contentVersionsIdList.addAll(versionNonPublishedSuggestions);
          contentVersionsIdList.addAll(versionInitialSuggestions);
          potentialContentVersionVOList.clear();
          versionInitialSuggestions.clear();
          versionNonPublishedSuggestions.clear();
          keptContentVersionVOList.clear();
         
          numberOfLaterVersions = 0;
          previousDate = null;
          difference = -1;
          potentialContentVersionVOList = new ArrayList();
        }
        else if(previousDate != null)
        {
          difference = previousDate.getTime() - version.getModifiedDateTime().getTime();
        }

        if(numberOfLaterVersions >= numberOfVersionsToKeep || (keepOnlyOldPublishedVersions && numberOfLaterVersions > 0 && !version.getStateId().equals(ContentVersionVO.PUBLISHED_STATE)))
              {
          if(version.getStateId().equals(ContentVersionVO.PUBLISHED_STATE))
          {
            versionInitialSuggestions.add(version.getValueObject());
          }
          else
          {
            versionNonPublishedSuggestions.add(version.getValueObject());
          }
              }
        else if(previousDate != null && difference != -1 && difference < minimumTimeBetweenVersionsDuringClean)
        {
          keptContentVersionVOList.add(version.getValueObject());
          potentialContentVersionVOList.add(version.getValueObject());   
          numberOfLaterVersions++;
        }
        else
        {
          keptContentVersionVOList.add(version.getValueObject());
          previousDate = version.getModifiedDateTime();
          numberOfLaterVersions++;
        }

        previousContentId = version.getContentId();
            }
           
      if(minimumTimeBetweenVersionsDuringClean != -1 && versionInitialSuggestions.size() >= numberOfVersionsToKeep)
      {
        //System.out.println("Inside again....");
        //System.out.println("potentialContentVersionVOList:" + potentialContentVersionVOList.size());
        Iterator potentialContentVersionVOListIterator = potentialContentVersionVOList.iterator();
        while(potentialContentVersionVOListIterator.hasNext())
        {
          SmallestContentVersionVO potentialContentVersionVO = (SmallestContentVersionVO)potentialContentVersionVOListIterator.next();
         
          SmallestContentVersionVO firstInitialSuggestedContentVersionVO = null;
          Iterator versionInitialSuggestionsIterator = versionInitialSuggestions.iterator();
          while(versionInitialSuggestionsIterator.hasNext())
          {
            SmallestContentVersionVO initialSuggestedContentVersionVO = (SmallestContentVersionVO)versionInitialSuggestionsIterator.next();
            if(initialSuggestedContentVersionVO.getStateId().equals(ContentVersionVO.PUBLISHED_STATE))
            {
              firstInitialSuggestedContentVersionVO = initialSuggestedContentVersionVO;
              //System.out.println("Breaking...");
              break;
            }
View Full Code Here

                keep = false;
             
              List<SmallestContentVersionVO> contentVersions = DigitalAssetController.getController().getContentVersionVOListConnectedToAssetWithId(digitalAsset.getId());
              //Collection contentVersions = digitalAsset.getContentVersions();
              Iterator<SmallestContentVersionVO> contentVersionsIterator = contentVersions.iterator();
              SmallestContentVersionVO contentVersionVO = null;
              while(contentVersionsIterator.hasNext())
              {
                contentVersionVO = contentVersionsIterator.next();
                if(!isOldVersion(contentVersionVO, numberOfVersionsToKeep, db))
                  keep = false;
              }
             
              if(contentVersionVO != null && keep)
              {
                if(contentVersionVO.getContentId() != null)
                {
                  String contentPath = ContentController.getContentController().getContentPath(contentVersionVO.getContentId(), true, true, db);
                  optimizationBeanList.addDigitalAsset(digitalAsset);
                  optimizationBeanList.addEventVersions(contentVersions);
                  optimizationBeanList.setContentPath(digitalAsset.getId(), contentPath);
                }
                else
                {
                  logger.error("ContentVersion with id:" + contentVersionVO.getId() + " had no ownningcontent");
                }
              }
            }
           
      results.close();
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.