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

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


    public SiteNodeVersionVO changeState(Integer oldSiteNodeVersionId, SiteNodeVO siteNodeVO, Integer stateId, String versionComment, boolean overrideVersionModifyer, String recipientFilter, InfoGluePrincipal infoGluePrincipal, Database db, List<EventVO> resultingEvents) throws ConstraintException, SystemException
    {
      Timer t = new Timer();
     
      SiteNodeVersionVO returnSiteNodeVersionVO = null;
    MediumSiteNodeVersionImpl returnSiteNodeVersionImpl = null;
   
        try
        {
      MediumSiteNodeVersionImpl oldMediumSiteNodeVersionImpl = SiteNodeVersionController.getController().getMediumSiteNodeVersionWithId(oldSiteNodeVersionId, db);
      returnSiteNodeVersionVO = oldMediumSiteNodeVersionImpl.getValueObject();
      //t.printElapsedTime("oldMediumSiteNodeVersionImpl:" + oldMediumSiteNodeVersionImpl.getSiteNodeId());
     
            //Here we create a new version if it was a state-change back to working, it's a copy of the publish-version
        if(stateId.intValue() == SiteNodeVersionVO.WORKING_STATE.intValue())
        {
          logger.info("About to create a new working version");
           
        SiteNodeVersionVO newSiteNodeVersionVO = new SiteNodeVersionVO();
          newSiteNodeVersionVO.setStateId(stateId);
        newSiteNodeVersionVO.setVersionComment("New working version");
        newSiteNodeVersionVO.setModifiedDateTime(DateHelper.getSecondPreciseDate());
        if(overrideVersionModifyer)
            newSiteNodeVersionVO.setVersionModifier(infoGluePrincipal.getName());
        else
            newSiteNodeVersionVO.setVersionModifier(oldMediumSiteNodeVersionImpl.getVersionModifier());
       
        newSiteNodeVersionVO.setContentType(oldMediumSiteNodeVersionImpl.getContentType());
        newSiteNodeVersionVO.setPageCacheKey(oldMediumSiteNodeVersionImpl.getPageCacheKey());
        newSiteNodeVersionVO.setPageCacheTimeout(oldMediumSiteNodeVersionImpl.getPageCacheTimeout());
        newSiteNodeVersionVO.setDisableEditOnSight(oldMediumSiteNodeVersionImpl.getDisableEditOnSight());
        newSiteNodeVersionVO.setDisableLanguages(oldMediumSiteNodeVersionImpl.getDisableLanguages());
        newSiteNodeVersionVO.setDisablePageCache(oldMediumSiteNodeVersionImpl.getDisablePageCache());
        newSiteNodeVersionVO.setIsProtected(oldMediumSiteNodeVersionImpl.getIsProtected());
        newSiteNodeVersionVO.setDisableForceIdentityCheck(oldMediumSiteNodeVersionImpl.getDisableForceIdentityCheck());
        newSiteNodeVersionVO.setForceProtocolChange(oldMediumSiteNodeVersionImpl.getForceProtocolChange());
        newSiteNodeVersionVO.setIsHidden(oldMediumSiteNodeVersionImpl.getIsHidden());
        newSiteNodeVersionVO.setSortOrder(oldMediumSiteNodeVersionImpl.getSortOrder());

        RequestAnalyser.getRequestAnalyser().registerComponentStatistics("changeState 1", t.getElapsedTime());

        //returnSiteNodeVersionVO = SiteNodeVersionController.createFull(siteNodeId, infoGluePrincipal, newSiteNodeVersionVO, db).getValueObject();
        returnSiteNodeVersionImpl = SiteNodeVersionController.createSmall(siteNodeVO.getId(), infoGluePrincipal, newSiteNodeVersionVO, db);
        returnSiteNodeVersionVO = returnSiteNodeVersionImpl.getValueObject();
       
        RequestAnalyser.getRequestAnalyser().registerComponentStatistics("changeState createSmall", t.getElapsedTime());
       
        returnSiteNodeVersionImpl.setSiteNodeId(oldMediumSiteNodeVersionImpl.getSiteNodeId());
       
        copyServiceBindings(oldMediumSiteNodeVersionImpl, returnSiteNodeVersionImpl, db);
        RequestAnalyser.getRequestAnalyser().registerComponentStatistics("changeState copyServiceBindings", t.getElapsedTime());
       
        if(returnSiteNodeVersionImpl.getIsProtected().intValue() == SiteNodeVersionVO.YES || returnSiteNodeVersionImpl.getIsProtected().intValue() == SiteNodeVersionVO.YES_WITH_INHERIT_FALLBACK)
        {
          copyAccessRights("SiteNodeVersion", oldMediumSiteNodeVersionImpl.getId(), returnSiteNodeVersionImpl.getId(), db);
          RequestAnalyser.getRequestAnalyser().registerComponentStatistics("changeState copyAccessRights", t.getElapsedTime());
        }
      }
 
        //If the user changes the state to publish we create a copy and set that copy to publish.
        if(stateId.intValue() == SiteNodeVersionVO.PUBLISH_STATE.intValue())
        {
          logger.info("About to copy the working copy to a publish-one");
          //First we update the old working-version so it gets a comment
         
          //SiteNodeVersionVO oldSiteNodeVersionVO = oldSiteNodeVersion.getValueObject();
        oldMediumSiteNodeVersionImpl.setVersionComment(versionComment);
 
        if(CmsPropertyHandler.getUseApprovalFlow().equals("true"))
        {
            //Now we create a new version which is basically just a copy of the working-version       
            SiteNodeVersionVO newSiteNodeVersionVO = new SiteNodeVersionVO();
            newSiteNodeVersionVO.setSiteNodeId(siteNodeVO.getId());
            newSiteNodeVersionVO.setStateId(stateId);
            newSiteNodeVersionVO.setVersionComment(versionComment);
          if(overrideVersionModifyer)
              newSiteNodeVersionVO.setVersionModifier(infoGluePrincipal.getName());
          else
              newSiteNodeVersionVO.setVersionModifier(oldMediumSiteNodeVersionImpl.getVersionModifier());
         
          newSiteNodeVersionVO.setModifiedDateTime(DateHelper.getSecondPreciseDate());
           
          newSiteNodeVersionVO.setContentType(oldMediumSiteNodeVersionImpl.getContentType());
          newSiteNodeVersionVO.setPageCacheKey(oldMediumSiteNodeVersionImpl.getPageCacheKey());
          newSiteNodeVersionVO.setPageCacheTimeout(oldMediumSiteNodeVersionImpl.getPageCacheTimeout());
          newSiteNodeVersionVO.setDisableEditOnSight(oldMediumSiteNodeVersionImpl.getDisableEditOnSight());
          newSiteNodeVersionVO.setDisableLanguages(oldMediumSiteNodeVersionImpl.getDisableLanguages());
          newSiteNodeVersionVO.setDisablePageCache(oldMediumSiteNodeVersionImpl.getDisablePageCache());
          newSiteNodeVersionVO.setIsProtected(oldMediumSiteNodeVersionImpl.getIsProtected());
          newSiteNodeVersionVO.setDisableForceIdentityCheck(oldMediumSiteNodeVersionImpl.getDisableForceIdentityCheck());
          newSiteNodeVersionVO.setForceProtocolChange(oldMediumSiteNodeVersionImpl.getForceProtocolChange());
          newSiteNodeVersionVO.setIsHidden(oldMediumSiteNodeVersionImpl.getIsHidden());
          newSiteNodeVersionVO.setSortOrder(oldMediumSiteNodeVersionImpl.getSortOrder());

          RequestAnalyser.getRequestAnalyser().registerComponentStatistics("changeState publish1", t.getElapsedTime());
 
          //returnSiteNodeVersionVO = SiteNodeVersionController.createFull(siteNodeId, infoGluePrincipal, newSiteNodeVersionVO, db).getValueObject();
          returnSiteNodeVersionImpl = SiteNodeVersionController.createSmall(siteNodeVO.getId(), infoGluePrincipal, newSiteNodeVersionVO, db);
          RequestAnalyser.getRequestAnalyser().registerComponentStatistics("changeState publish createSmall", t.getElapsedTime());
          returnSiteNodeVersionVO = returnSiteNodeVersionImpl.getValueObject();
         
          //returnSiteNodeVersionVO.setSiteNodeId(oldSiteNodeVersion.getValueObject().getSiteNodeId());
          //copyServiceBindings(oldSiteNodeVersion, newSiteNodeVersion, db);
          if(returnSiteNodeVersionImpl.getIsProtected().intValue() == SiteNodeVersionVO.YES || returnSiteNodeVersionImpl.getIsProtected().intValue() == SiteNodeVersionVO.YES_WITH_INHERIT_FALLBACK)
          {
            copyAccessRights("SiteNodeVersion", oldMediumSiteNodeVersionImpl.getId(), returnSiteNodeVersionImpl.getId(), db);
            RequestAnalyser.getRequestAnalyser().registerComponentStatistics("changeState publish copyAccessRights", t.getElapsedTime());
          }
 
          //Creating the event that will notify the editor...
          EventVO eventVO = new EventVO();
          eventVO.setDescription(returnSiteNodeVersionImpl.getVersionComment());
          eventVO.setEntityClass(SiteNodeVersion.class.getName());
          eventVO.setEntityId(new Integer(returnSiteNodeVersionImpl.getId().intValue()));
              eventVO.setName(siteNodeVO.getName());
          eventVO.setTypeId(EventVO.PUBLISH);
              eventVO = EventController.create(eventVO, siteNodeVO.getRepositoryId(), infoGluePrincipal, db);     
             
              eventVO.setName(siteNodeVO.getName());
         
          resultingEvents.add(eventVO);
        }
        else
        {
          oldMediumSiteNodeVersionImpl.setVersionComment(versionComment);

          //Creating the event that will notify the editor...
          EventVO eventVO = new EventVO();
          eventVO.setDescription(oldMediumSiteNodeVersionImpl.getVersionComment());
          eventVO.setEntityClass(SiteNodeVersion.class.getName());
          eventVO.setEntityId(new Integer(oldMediumSiteNodeVersionImpl.getId().intValue()));
              eventVO.setName(siteNodeVO.getName());
          eventVO.setTypeId(EventVO.PUBLISH);
              eventVO = EventController.create(eventVO, siteNodeVO.getRepositoryId(), infoGluePrincipal, db);     
             
              eventVO.setName(siteNodeVO.getName());
         
          resultingEvents.add(eventVO);
        }
       
        //if(recipientFilter != null && !recipientFilter.equals(""))
        //  PublicationController.mailPublishNotification(resultingEvents, siteNodeVO.getRepositoryId(), infoGluePrincipal, recipientFilter, db);
 
        RequestAnalyser.getRequestAnalyser().registerComponentStatistics("changeState publish create event", t.getElapsedTime());
        }
 
        if(stateId.intValue() == SiteNodeVersionVO.PUBLISHED_STATE.intValue())
        {
          logger.info("About to publish an existing version");
          oldMediumSiteNodeVersionImpl.setStateId(stateId);
          oldMediumSiteNodeVersionImpl.setIsActive(new Boolean(true));
          returnSiteNodeVersionImpl = oldMediumSiteNodeVersionImpl;
        }

        if(stateId.intValue() != SiteNodeVersionVO.PUBLISH_STATE.intValue() || CmsPropertyHandler.getUseApprovalFlow().equals("true"))
      {
View Full Code Here


        {
          clearCache(SiteNodeVersionImpl.class);

          try
          {
            MediumSiteNodeVersionImpl siteNodeVersion = (MediumSiteNodeVersionImpl)object;
            SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId(siteNodeVersion.getValueObject().getSiteNodeId(), true);
            CacheController.clearCacheForGroup("siteNodeCacheWithLatestVersion", "siteNode_" + siteNodeVO.getId());
            CacheController.clearCacheForGroup("childSiteNodesCache", "siteNode_" + siteNodeVO.getId());
            CacheController.clearCacheForGroup("childPagesCache", "siteNode_" + siteNodeVO.getId());
            if(siteNodeVO.getParentSiteNodeId() != null)
            {
              CacheController.clearCacheForGroup("childSiteNodesCache", "siteNode_" + siteNodeVO.getParentSiteNodeId());         
              CacheController.clearCacheForGroup("childPagesCache", "siteNode_" + siteNodeVO.getParentSiteNodeId());
            }
           
            CacheController.clearCacheForGroup("latestSiteNodeVersionCache", "siteNode_" + siteNodeVO.getId());
          }
          catch (Exception e)
          {
            logger.warn("Error in JDOCallback:" + e.getMessage(), e);
          }
        }
        else
        {
          SiteNodeVersionImpl siteNodeVersion = (SiteNodeVersionImpl)object;
         
          clearCache(MediumSiteNodeVersionImpl.class, siteNodeVersion.getId());
          try
          {
            SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId(siteNodeVersion.getValueObject().getSiteNodeId(), true);
            if(siteNodeVO != null)
            { 
              CacheController.clearCacheForGroup("siteNodeCacheWithLatestVersion", "siteNode_" + siteNodeVO.getId());
              CacheController.clearCacheForGroup("childSiteNodesCache", "siteNode_" + siteNodeVO.getId());
              CacheController.clearCacheForGroup("childPagesCache", "siteNode_" + siteNodeVO.getId());
View Full Code Here

      {
        //CacheController.clearCache("childSiteNodesCache");
        CacheController.clearCache("parentSiteNodeCache");
        if(object.getClass().getName().equals(MediumSiteNodeVersionImpl.class.getName()))
        {
          MediumSiteNodeVersionImpl siteNodeVersion = (MediumSiteNodeVersionImpl)object;
          CacheController.clearCacheForGroup("latestSiteNodeVersionCache", "siteNode_" + siteNodeVersion.getValueObject().getSiteNodeId());
          CacheController.clearCacheForGroup("siteNodeCacheWithLatestVersion", "siteNode_" + siteNodeVersion.getValueObject().getSiteNodeId());
        }
        else
        {
          SiteNodeVersion siteNodeVersion = (SiteNodeVersion)object;
          Integer siteNodeId = siteNodeVersion.getValueObject().getSiteNodeId();
          if(siteNodeId == null)
            siteNodeId = siteNodeVersion.getOwningSiteNode().getId();
         
          CacheController.clearCacheForGroup("latestSiteNodeVersionCache", "siteNode_" + siteNodeId);
          CacheController.clearCacheForGroup("siteNodeCacheWithLatestVersion", "siteNode_" + siteNodeId);
        }
      }
View Full Code Here

        if(object.getClass().getName().equals(MediumSiteNodeVersionImpl.class.getName()))
        {
          clearCache(SiteNodeVersionImpl.class);
          try
          {
            MediumSiteNodeVersionImpl siteNodeVersion = (MediumSiteNodeVersionImpl)object;
            CacheController.clearCacheForGroup("siteNodeCacheWithLatestVersion", "siteNode_" + (Integer)getObjectIdentity(object));
            CacheController.clearCacheForGroup("childSiteNodesCache", "siteNode_" + siteNodeVersion.getValueObject().getSiteNodeId());
            CacheController.clearCacheForGroup("childPagesCache", "siteNode_" + siteNodeVersion.getValueObject().getSiteNodeId());
            CacheController.clearCacheForGroup("latestSiteNodeVersionCache", "siteNode_" + siteNodeVersion.getValueObject().getSiteNodeId());
            SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId(siteNodeVersion.getValueObject().getSiteNodeId(), true);
            if(siteNodeVO.getParentSiteNodeId() != null)
            {
              CacheController.clearCacheForGroup("childSiteNodesCache", "siteNode_" + siteNodeVO.getParentSiteNodeId());         
              CacheController.clearCacheForGroup("childPagesCache", "siteNode_" + siteNodeVO.getParentSiteNodeId());         
            }
          }
          catch (Exception e)
          {
            logger.warn("Error in JDOCallback:" + e.getMessage(), e);
          }
        }
        else
        {
          clearCache(MediumSiteNodeVersionImpl.class);
          try
          {
            SiteNodeVersionImpl siteNodeVersion = (SiteNodeVersionImpl)object;
            Integer siteNodeId = siteNodeVersion.getSiteNodeId();
            if(siteNodeId == null && siteNodeVersion.getOwningSiteNode() != null)
              siteNodeId = siteNodeVersion.getOwningSiteNode().getId();

            CacheController.clearCacheForGroup("siteNodeCacheWithLatestVersion", "siteNode_" + siteNodeId);
            CacheController.clearCacheForGroup("childSiteNodesCache", "siteNode_" + siteNodeId);
            CacheController.clearCacheForGroup("childPagesCache", "siteNode_" + siteNodeId);
            CacheController.clearCacheForGroup("latestSiteNodeVersionCache", "siteNode_" + siteNodeId);
            SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId(siteNodeVersion.getValueObject().getSiteNodeId(), true);
            if(siteNodeVO.getParentSiteNodeId() != null)
            {
              CacheController.clearCacheForGroup("childSiteNodesCache", "siteNode_" + siteNodeVO.getParentSiteNodeId());
              CacheController.clearCacheForGroup("childPagesCache", "siteNode_" + siteNodeVO.getParentSiteNodeId());
            }
View Full Code Here

      Iterator<SiteNodeVersionVO> siteNodeVersionVOListIterator = siteNodeVersionVOList.iterator();
      while(siteNodeVersionVOListIterator.hasNext())
      {
        SiteNodeVersionVO siteNodeVersionVO = siteNodeVersionVOListIterator.next();
        //SiteNodeVersion siteNodeVersion = SiteNodeVersionController.getController().getSiteNodeVersionWithId(siteNodeVersionVO.getId(), db);
        MediumSiteNodeVersionImpl siteNodeVersion = SiteNodeVersionController.getController().getMediumSiteNodeVersionWithId(siteNodeVersionVO.getId(), db);
        logger.info("Deleting the siteNodeVersion " + siteNodeVersion.getId() + " on siteNode " + siteNodeVersion.getSiteNodeId());
        delete(siteNodeVersion, db, true);
      }

      commitTransaction(db);
View Full Code Here

    }

    // Publish sitenodeversions
        if(entityClass.equals(SiteNodeVersion.class.getName()))
    {
      MediumSiteNodeVersionImpl siteNodeVersion = null;
      //SiteNodeVersion oldSiteNodeVersion = SiteNodeVersionController.getController().getSiteNodeVersionWithId(entityId, db);
      MediumSiteNodeVersionImpl oldSiteNodeVersion = SiteNodeVersionController.getController().getMediumSiteNodeVersionWithId(entityId, db);
      if(oldSiteNodeVersion != null && oldSiteNodeVersion.getSiteNodeId() != null && typeId.intValue() == EventVO.UNPUBLISH_LATEST.intValue())
      {
          oldSiteNodeVersion.setIsActive(new Boolean(false));
          siteNodeVersion = oldSiteNodeVersion;
      }
      /*
      else if(oldSiteNodeVersion != null && oldSiteNodeVersion.getOwningSiteNode() != null && typeId.intValue() == EventVO.UNPUBLISH_ALL.intValue())
      {
        //We just set the published version to not active.
          siteNodeVersion.setIsActive(new Boolean(false));
      }
      */
      else if(oldSiteNodeVersion != null && oldSiteNodeVersion.getSiteNodeId() != null)
      {
        List<EventVO> events = new ArrayList<EventVO>();

        SiteNodeVersionVO newSiteNodeVersionVO = SiteNodeStateController.getController().changeState(entityId, siteNodeVO, SiteNodeVersionVO.PUBLISHED_STATE, "Published", overrideVersionModifyer, infoGluePrincipal, db, oldSiteNodeVersion.getSiteNodeId(), events);
        siteNodeVersion = SiteNodeVersionController.getController().getMediumSiteNodeVersionWithId(newSiteNodeVersionVO.getId(), db);
      }

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

     */
    public void delete(Integer siteNodeVersionId, Database db) throws ConstraintException, SystemException
    {
    try
    {
      MediumSiteNodeVersionImpl siteNodeVersion = getMediumSiteNodeVersionWithId(siteNodeVersionId, db);
      Collection serviceBindings = siteNodeVersion.getServiceBindings();
        Iterator serviceBindingsIterator = serviceBindings.iterator();
        while(serviceBindingsIterator.hasNext())
        {
            ServiceBinding serviceBinding = (ServiceBinding)serviceBindingsIterator.next();
            serviceBindingsIterator.remove();
View Full Code Here

   * This method creates a new siteNodeVersion for the siteNode sent in.
   */
 
  public static MediumSiteNodeVersionImpl createSmall(Integer siteNodeId, InfoGluePrincipal infoGluePrincipal, SiteNodeVersionVO siteNodeVersionVO, Database db) throws SystemException, Bug, Exception
  {
    MediumSiteNodeVersionImpl siteNodeVersion = new MediumSiteNodeVersionImpl();
   
         siteNodeVersionVO.setVersionModifier(infoGluePrincipal.getName());
         siteNodeVersion.setValueObject(siteNodeVersionVO);
         siteNodeVersion.setSiteNodeId(siteNodeId);
         siteNodeVersion.setVersionNumber(new Integer(1));
         db.create(siteNodeVersion);

         return siteNodeVersion;   
  }
View Full Code Here

   * Updates the SiteNodeVersion within a transaction.
   */
 
  public SiteNodeVersionVO update(SiteNodeVersionVO siteNodeVersionVO, Database db) throws ConstraintException, SystemException, Exception
  {
    MediumSiteNodeVersionImpl siteNodeVersion = getMediumSiteNodeVersionWithId(siteNodeVersionVO.getId(), db);
      registryController.updateSiteNodeVersionThreaded(siteNodeVersionVO);

      siteNodeVersion.setValueObject(siteNodeVersionVO);
      return siteNodeVersionVO;
  }   
View Full Code Here

TOP

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

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.