Package org.infoglue.cms.entities.structure.impl.simple

Examples of org.infoglue.cms.entities.structure.impl.simple.SmallSiteNodeVersionImpl


          List versionInitialSuggestions = new ArrayList();
          List versionNonPublishedSuggestions = new ArrayList();

          while (results.hasMore())
            {
            SmallSiteNodeVersionImpl version = (SmallSiteNodeVersionImpl)results.next();
        if(previousSiteNodeId != null && previousSiteNodeId.intValue() != version.getSiteNodeId().intValue())
        {
          logger.info("previousSiteNodeId:" + previousSiteNodeId);
          if(minimumTimeBetweenVersionsDuringClean != -1 && versionInitialSuggestions.size() > numberOfVersionsToKeep)
          {           
            Iterator potentialSiteNodeVersionVOListIterator = potentialSiteNodeVersionVOList.iterator();
            while(potentialSiteNodeVersionVOListIterator.hasNext())
            {
              SiteNodeVersionVO potentialSiteNodeVersionVO = (SiteNodeVersionVO)potentialSiteNodeVersionVOListIterator.next();
             
              SiteNodeVersionVO firstInitialSuggestedSiteNodeVersionVO = null;
              Iterator versionInitialSuggestionsIterator = versionInitialSuggestions.iterator();
              while(versionInitialSuggestionsIterator.hasNext())
              {
                SiteNodeVersionVO initialSuggestedSiteNodeVersionVO = (SiteNodeVersionVO)versionInitialSuggestionsIterator.next();
                if(initialSuggestedSiteNodeVersionVO.getStateId().equals(ContentVersionVO.PUBLISHED_STATE))
                {
                  firstInitialSuggestedSiteNodeVersionVO = initialSuggestedSiteNodeVersionVO;
                  break;
                }
              }
             
              if(firstInitialSuggestedSiteNodeVersionVO != null)
              {
                keptSiteNodeVersionVOList.remove(potentialSiteNodeVersionVO);
                keptSiteNodeVersionVOList.add(firstInitialSuggestedSiteNodeVersionVO);
                versionInitialSuggestions.remove(firstInitialSuggestedSiteNodeVersionVO);
                versionInitialSuggestions.add(potentialSiteNodeVersionVO);
              }
            }
          }
         
          siteNodeVersionsIdList.addAll(versionNonPublishedSuggestions);
          siteNodeVersionsIdList.addAll(versionInitialSuggestions);
          potentialSiteNodeVersionVOList.clear();
          versionInitialSuggestions.clear();
          versionNonPublishedSuggestions.clear();
          keptSiteNodeVersionVOList.clear();
         
          numberOfLaterVersions = 0;
          previousDate = null;
          difference = -1;
          potentialSiteNodeVersionVOList = 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)
        {
          keptSiteNodeVersionVOList.add(version.getValueObject());
          potentialSiteNodeVersionVOList.add(version.getValueObject());   
          numberOfLaterVersions++;
        }
        else
        {
          keptSiteNodeVersionVOList.add(version.getValueObject());
          previousDate = version.getModifiedDateTime();
          numberOfLaterVersions++;
        }

        previousSiteNodeId = version.getSiteNodeId();
            }
           
      results.close();
      oql.close();
View Full Code Here


      if(logger.isInfoEnabled())
        logger.info("There was an cached siteNodeVersionVO:" + siteNodeVersionVO);
    }
    else
    {
      SmallSiteNodeVersionImpl siteNodeVersion = null;
       
        OQLQuery oql = db.getOQLQuery( "SELECT cv FROM org.infoglue.cms.entities.structure.impl.simple.SmallSiteNodeVersionImpl cv WHERE cv.siteNodeId = $1 AND cv.isActive = $2 ORDER BY cv.siteNodeVersionId desc");
      oql.bind(siteNodeId);
      oql.bind(new Boolean(true));
     
      QueryResults results = oql.execute(Database.READONLY);
     
      if (results.hasMore())
        {
          siteNodeVersion = (SmallSiteNodeVersionImpl)results.next();
          }
 
      results.close();
      oql.close();

        if(siteNodeVersion != null)
          siteNodeVersionVO = siteNodeVersion.getValueObject();
        else
          logger.warn("The siteNode " + siteNodeId + " did not have a latest active siteNodeVersion - very strange.");

      if(siteNodeVersionVO != null)
      {
View Full Code Here

   * This method does not cache! Use {@link #getLatestActiveSiteNodeVersionVO(Database, Integer)} if possible.
   */
  public SiteNodeVersionVO getLatestActiveSiteNodeVersionVO(Database db, Integer siteNodeId, Integer stateId) throws SystemException, Bug, Exception
  {
    SiteNodeVersionVO siteNodeVersionVO = null;
    SmallSiteNodeVersionImpl siteNodeVersion = null;

      OQLQuery oql = db.getOQLQuery( "SELECT cv FROM org.infoglue.cms.entities.structure.impl.simple.SmallSiteNodeVersionImpl cv WHERE cv.siteNodeId = $1 AND cv.isActive = $2 AND cv.stateId >= $3 ORDER BY cv.siteNodeVersionId desc");
    oql.bind(siteNodeId);
    oql.bind(new Boolean(true));
    oql.bind(stateId);

    QueryResults results = oql.execute(Database.READONLY);

    if (results.hasMore())
      {
        siteNodeVersion = (SmallSiteNodeVersionImpl)results.next();
        }

    results.close();
    oql.close();

      if(siteNodeVersion != null)
      {
        siteNodeVersionVO = siteNodeVersion.getValueObject();
      }
      else
      {
        logger.warn("The siteNode " + siteNodeId + " did not have a latest active siteNodeVersion - very strange.");
      }
View Full Code Here

      {
        logger.info("Changing version modifier from '" + currentModifier + "' to '" + newModifier + "' for number of SiteNodeVersions: " + results.size());
      }
    while (results.hasMore())
        {
      SmallSiteNodeVersionImpl snv = (SmallSiteNodeVersionImpl)results.nextElement();
      snv.setVersionModifier(newModifier);
      if (logger.isDebugEnabled())
        {
          logger.debug("Changing version modifier from '" + currentModifier + "' to '" + newModifier + "' for SiteNodeVersion with ID: " + snv.getSiteNodeVersionId());
        }
    }

    results.close();
    oql.close();
View Full Code Here

TOP

Related Classes of org.infoglue.cms.entities.structure.impl.simple.SmallSiteNodeVersionImpl

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.