Package org.infoglue.cms.applications.databeans

Examples of org.infoglue.cms.applications.databeans.ProcessBean


          contentVersionVOListForApproval.add(contentVersionVO);
        }
      }
    }

    ProcessBean processBean = ProcessBean.createProcessBean(ViewListSiteNodeVersionAction.class.getName(), "" + getInfoGluePrincipal().getName());
    SiteNodeVersionController.getController().getSiteNodeAndAffectedItemsRecursive(siteNodeId, SiteNodeVersionVO.WORKING_STATE, siteNodeVersionVOList, contentVersionVOList, false, false, this.getInfoGluePrincipal(), processBean, getLocale(), -1);
   
    this.getResponse().setContentType("text/plain");
    this.getResponse().setCharacterEncoding("UTF-8");
    if(latestVersion.getStateId().intValue() == SiteNodeVersionVO.PUBLISH_STATE)
View Full Code Here


            {
              Timer t = new Timer();
              Set<SiteNodeVersionVO> siteNodeVersionVOList = new HashSet<SiteNodeVersionVO>();
              Set<ContentVersionVO> contentVersionVOList = new HashSet<ContentVersionVO>();
             
              ProcessBean processBean = ProcessBean.createProcessBean(ViewListSiteNodeVersionAction.class.getName(), "" + infogluePrincipal.getName());
              SiteNodeVersionController.getController().getSiteNodeAndAffectedItemsRecursive(vo.getId(), SiteNodeVersionVO.WORKING_STATE, siteNodeVersionVOList, contentVersionVOList, false, false, infogluePrincipal, processBean, masterLanguageVO.getLocale(), -1);
              if(siteNodeVersionVOList.size() > 0 || contentVersionVOList.size() > 0)
                node.getParameters().put("stateId", "0");
              else
                node.getParameters().put("stateId", "" + vo.getStateId());
View Full Code Here

    StringBuffer sb = new StringBuffer();
    sb.append("<html><head><style>body {font-family: arial; font-size: 11px;}</style></head><body>");
   
    try
    {
      ProcessBean processBean = getProcessBean();
      if(processBean != null && processBean.getStatus() != ProcessBean.FINISHED)
      {
        sb.append("<h2>" + getLocalizedString(getLocale(), "tool.structuretool.publicationProcess.publicationProcessInfo") + "</h2>");

        sb.append("<ol>");
        for(String event : processBean.getProcessEvents())
          sb.append("<li>" + event + "</li>");
        sb.append("</ol>");
        sb.append("<div style='position: absolute; top:10px; right: 10px;'><img src='images/v3/loadingAnimation.gif' /></div>");
      }
      else
View Full Code Here

      return "inputV3";
  }

  public String doInputChooseContents() throws Exception
  {
    ProcessBean processBean = ProcessBean.createProcessBean(UnpublishContentVersionAction.class.getName(), "" + getInfoGluePrincipal().getName());
    processBean.setStatus(ProcessBean.RUNNING);

    try
    {
      if(this.contentId != null)
      {
          ContentVO contentVO = ContentController.getContentController().getContentVOWithId(this.contentId);
          this.repositoryId = contentVO.getRepositoryId();
         
        AccessConstraintExceptionBuffer ceb = new AccessConstraintExceptionBuffer();
     
        Integer protectedContentId = ContentControllerProxy.getController().getProtectedContentId(contentId);
        if(protectedContentId != null && !AccessRightController.getController().getIsPrincipalAuthorized(this.getInfoGluePrincipal(), "Content.SubmitToPublish", protectedContentId.toString()))
          ceb.add(new AccessConstraintException("Content.contentId", "1005"));
       
        ceb.throwIfNotEmpty();
 
        processBean.updateProcess("Getting child contents available for unpublish");
       
        contentVOList = ContentController.getContentController().getContentVOWithParentRecursive(contentId, processBean);
      }
    }
    finally
    {
      processBean.setStatus(ProcessBean.FINISHED);
      processBean.removeProcess();
    }

      return "inputChooseContents";
  }
View Full Code Here

   * This method will try to unpublish all liver versions of this content.
   */
    
    public String doUnpublishAll() throws Exception
    {  
    ProcessBean processBean = ProcessBean.createProcessBean(UnpublishContentVersionAction.class.getName(), "" + getInfoGluePrincipal().getName());
    processBean.setStatus(ProcessBean.RUNNING);

    String[] contentIdStrings = getRequest().getParameterValues("sel");
   
    List events = new ArrayList();

    Database db = CastorDatabaseService.getDatabase();

        beginTransaction(db);

        try
        {
          List<Integer> contentIds = new ArrayList<Integer>();
          for(String contentIdString : contentIdStrings)
          {
            contentIds.add(new Integer(contentIdString));
          }
         
          processBean.updateProcess("Searching for all published versions.");
          List<SmallestContentVersionVO> contentVersionsVOList = ContentVersionController.getContentVersionController().getPublishedActiveContentVersionVOList(contentIds, db);
          Map checkedLanguages = new HashMap();
          processBean.updateProcess("Found " + contentVersionsVOList.size() + " versions");
         
          for(SmallestContentVersionVO contentVersionVO : contentVersionsVOList)
          {
        if(checkedLanguages.get(contentVersionVO.getLanguageId()) == null)
        {
          checkedLanguages.put(contentVersionVO.getLanguageId(), new Boolean(true));
          ContentVersionVO latestContentVersionVO = ContentVersionController.getContentVersionController().getLatestContentVersionVO(contentVersionVO.getContentId(), contentVersionVO.getLanguageId());
          if(attemptDirectPublishing.equalsIgnoreCase("true"))
          {
            if(latestContentVersionVO != null && !latestContentVersionVO.getStateId().equals(ContentVersionVO.WORKING_STATE))
            {
              logger.info("Creating a new working version as there was no active working version left...:" + contentVersionVO.getLanguageName());
              ContentStateController.changeState(latestContentVersionVO.getId(), ContentVersionVO.WORKING_STATE, "new working version", false, null, this.getInfoGluePrincipal(), contentVersionVO.getContentId(), events);
            }
          }
        }
        //ContentStateController.changeState(contentVersionVO.getId(), ContentVersionVO.WORKING_STATE, "new working version", false, this.getInfoGluePrincipal(), contentVersionVO.getContentId(), db, events);
           
        EventVO eventVO = new EventVO();
        eventVO.setDescription(this.versionComment);
        eventVO.setEntityClass(ContentVersion.class.getName());
        eventVO.setEntityId(contentVersionVO.getContentVersionId());
        ContentVO contentVO = ContentController.getContentController().getContentVOWithId(contentVersionVO.getContentId());
        eventVO.setName(contentVO.getName() + "(" + contentVersionVO.getLanguageId() + ")");
        eventVO.setTypeId(EventVO.UNPUBLISH_LATEST);
        eventVO = EventController.create(eventVO, this.repositoryId, this.getInfoGluePrincipal(), db);
        events.add(eventVO);
         
        if(events.size() % 10 == 0)
          processBean.updateLastDescription("Updated " + events.size() + " versions");
          }

      processBean.updateLastDescription("Creating publication");

      if(!attemptDirectPublishing.equalsIgnoreCase("true"))
      {
        if(recipientFilter != null && !recipientFilter.equals("") && events != null && events.size() > 0)
          PublicationController.mailPublishNotification(events, repositoryId, getInfoGluePrincipal(), recipientFilter, true);
      }

      if(attemptDirectPublishing.equalsIgnoreCase("true"))
      {
          PublicationVO publicationVO = new PublicationVO();
          publicationVO.setName("Direct publication by " + this.getInfoGluePrincipal().getName());
          publicationVO.setDescription(getVersionComment());
          publicationVO.setPublisher(this.getInfoGluePrincipal().getName());
          publicationVO.setRepositoryId(repositoryId);

          publicationVO = PublicationController.getController().createAndPublish(publicationVO, events, this.overrideVersionModifyer, this.getInfoGluePrincipal(), db);
      }
     
        commitTransaction(db);
        }
        catch(Exception e)
        {
      logger.error("An error occurred so we should not complete the transaction:" + e.getMessage());
      logger.warn("An error occurred so we should not complete the transaction:" + e.getMessage(), e);
            rollbackTransaction(db);
            throw new SystemException(e.getMessage());
        }
        finally
    {
      processBean.setStatus(ProcessBean.FINISHED);
      processBean.removeProcess();
    }
       
         return "success";
    }
View Full Code Here

       
        ceb.throwIfNotEmpty();
     
        String errorMessage = "";
       
    ProcessBean processBean = ProcessBean.createProcessBean(this.getClass().getName(), "" + getInfoGluePrincipal().getName());
    processBean.setStatus(ProcessBean.RUNNING);

    try
    {
            if(this.qualifyerXML != null && this.qualifyerXML.length() != 0)
        {
            Document document = new DOMBuilder().getDocument(this.qualifyerXML);
        List siteNodes = parseSiteNodesFromXML(this.qualifyerXML);
        Iterator iterator = siteNodes.iterator();
        int i=0;
        while(iterator.hasNext())
        {
            SiteNodeVO siteNodeVO = (SiteNodeVO)iterator.next();
            try
          {   
              SiteNodeControllerProxy.getSiteNodeControllerProxy().acCopySiteNode(this.getInfoGluePrincipal(), siteNodeVO, this.newParentSiteNodeId, processBean);
          }
          catch(ConstraintException ce)
          {
            logger.warn("Limitation in copy site nodes:" + ce.getMessage());
            errorMessage = LabelController.getController(getLocale()).getLocalizedString(getLocale(), ce.getErrorCode(), getSiteNodeVO(newParentSiteNodeId).getName());
              this.errorsOccurred = true;
          }
          catch(Exception e)
          {
            logger.error("Error in copy site nodes:" + e.getMessage(), e);
            errorMessage = e.getMessage();
              this.errorsOccurred = true;
          }
          i++;
          }
        }

            processBean.updateProcess("Finished - cleaning up");
            Thread.sleep(1000);
    }
    catch(Exception e)
    {
      logger.error("Error in copy site nodes:" + e.getMessage(), e);
          setActionExtraData(userSessionKey, "confirmationMessage", e.getMessage() /*getLocalizedString(getLocale(), "tool.contenttool.siteNodeCopied.confirmation", getSiteNodeVO(newParentSiteNodeId).getName())*/);
    }
    finally
    {
      processBean.setStatus(ProcessBean.FINISHED);
      processBean.removeProcess();
    }
   
        setActionExtraData(userSessionKey, "refreshToolbarAndMenu", "" + true);
        setActionExtraData(userSessionKey, "repositoryId", "" + this.repositoryId);
        setActionExtraData(userSessionKey, "siteNodeId", "" + newParentSiteNodeId);
View Full Code Here

     private String attemptDirectPublishing;
     private boolean anonymousNoAccessWarning = false;

  protected String doExecute() throws Exception
  {
    ProcessBean processBean = ProcessBean.createProcessBean(ViewListSiteNodeVersionAction.class.getName(), "" + getInfoGluePrincipal().getName());
    processBean.setStatus(ProcessBean.RUNNING);

    try
    {
      Timer t = new Timer();
     
      logger.info("siteNodeId:" + this.siteNodeId);
      logger.info("siteNodeVersionId:" + this.siteNodeVersionId);
      if(this.siteNodeVersionId == null)
      {
          SiteNodeVersionVO siteNodeVersionVO = SiteNodeVersionControllerProxy.getSiteNodeVersionControllerProxy().getACLatestActiveSiteNodeVersionVO(this.getInfoGluePrincipal(), siteNodeId);
          if(siteNodeVersionVO != null)
              this.siteNodeVersionId = siteNodeVersionVO.getId();
      }
     
      if(this.siteNodeVersionId != null)
      {
        AccessConstraintExceptionBuffer ceb = new AccessConstraintExceptionBuffer();
     
        Integer protectedSiteNodeVersionId = SiteNodeVersionControllerProxy.getSiteNodeVersionControllerProxy().getProtectedSiteNodeVersionId(siteNodeVersionId);
        if(protectedSiteNodeVersionId != null && !AccessRightController.getController().getIsPrincipalAuthorized(this.getInfoGluePrincipal(), "SiteNodeVersion.SubmitToPublish", protectedSiteNodeVersionId.toString()))
          ceb.add(new AccessConstraintException("SiteNodeVersion.siteNodeVersionId", "1005"));
   
        ceb.throwIfNotEmpty();
 
        if(contentId != null && contentId > -1)
        {
          Integer protectedContentId = ContentControllerProxy.getController().getProtectedContentId(contentId);
          if(protectedContentId == null || AccessRightController.getController().getIsPrincipalAuthorized(this.getInfoGluePrincipal(), "Content.SubmitToPublish", protectedContentId.toString()))
          {
            ContentVO contentVO = ContentControllerProxy.getController().getACContentVOWithId(getInfoGluePrincipal(), contentId);
            List languageVOList = LanguageController.getController().getLanguageVOList(contentVO.getRepositoryId());
            Iterator languageVOListIterator = languageVOList.iterator();
            while(languageVOListIterator.hasNext())
            {
              LanguageVO language = (LanguageVO)languageVOListIterator.next();
              ContentVersionVO contentVersionVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(contentId, language.getId());
              if(contentVersionVO != null && contentVersionVO.getStateId().equals(ContentVersionVO.WORKING_STATE))
              {
                this.contentVersionVOList.add(contentVersionVO);
              }
            }
          }
        }
 
        processBean.updateProcess(getLocalizedString(getLocale(), "tool.structuretool.publicationProcess.gettingItems"));
       
        Set<SiteNodeVersionVO> siteNodeVersionVOList = new HashSet<SiteNodeVersionVO>();
        Set<ContentVersionVO> contentVersionVOList = new HashSet<ContentVersionVO>();
       
        SiteNodeVersionController.getController().getSiteNodeAndAffectedItemsRecursive(this.siteNodeId, SiteNodeVersionVO.WORKING_STATE, siteNodeVersionVOList, contentVersionVOList, false, recurseSiteNodes, this.getInfoGluePrincipal(), processBean, getLocale(), -1);
        RequestAnalyser.getRequestAnalyser().registerComponentStatistics("ViewListContentVersion.getSiteNodeAndAffectedItemsRecursive", t.getElapsedTime());
       
        processBean.updateProcess(getLocalizedString(getLocale(), "tool.structuretool.publicationProcess.found", siteNodeVersionVOList.size() + "/" + contentVersionVOList.size()));
        processBean.updateProcess(getLocalizedString(getLocale(), "tool.structuretool.publicationProcess.gettingMetaData"));
       
        Database db = CastorDatabaseService.getDatabase();
 
            beginTransaction(db);
 
            try
            {
              boolean skipDisplayName = false;
          for(SiteNodeVersionVO snVO : siteNodeVersionVOList)
          {
            if(snVO.getStateId() == 0)
            {
              Integer pageProtectedSiteNodeVersionId = SiteNodeVersionControllerProxy.getSiteNodeVersionControllerProxy().getProtectedSiteNodeVersionId(snVO.getId());
              if(pageProtectedSiteNodeVersionId != null)
              {
                boolean hasAnonymousUserAccess = AccessRightController.getController().getIsPrincipalAuthorized(db, UserControllerProxy.getController().getUser(CmsPropertyHandler.getAnonymousUser()), "SiteNodeVersion.Read", pageProtectedSiteNodeVersionId.toString(), false);
                if(!hasAnonymousUserAccess)
                {
                  anonymousNoAccessWarning = true;
                  snVO.setHasAnonymousUserAccess(false);
                }
              }
             
              if(!skipDisplayName)
              {
                InfoGluePrincipal principal = (InfoGluePrincipal)getInfoGluePrincipal(snVO.getVersionModifier(), db);
                if(principal != null)
                {
                  if(principal.getName().equalsIgnoreCase(principal.getDisplayName()))
                    skipDisplayName = true;
                 
                  snVO.setVersionModifierDisplayName(principal.getDisplayName());
                }
              }
              snVO.setPath(getSiteNodePath(snVO.getSiteNodeId(), db));
            }
            else
              logger.info("Not adding siteNodeVersion..");
          }

            this.siteNodeVersionVOList.addAll(siteNodeVersionVOList);
            Collections.sort(this.siteNodeVersionVOList, Collections.reverseOrder(new ReflectionComparator("modifiedDateTime")));
 
          processBean.updateProcess("Getting modifier and path to found contents.");
 
          for(ContentVersionVO contentVersionVO : contentVersionVOList)
          {
            if(contentVersionVO.getStateId() == 0
            {
              Integer protectedContentId = ContentControllerProxy.getController().getProtectedContentId(contentId, db);
              if(protectedContentId != null)
              {
                boolean hasAnonymousUserAccess = AccessRightController.getController().getIsPrincipalAuthorized(db, UserControllerProxy.getController().getUser(CmsPropertyHandler.getAnonymousUser()), "Content.Read", protectedContentId.toString(), false);
                if(!hasAnonymousUserAccess)
                {
                  anonymousNoAccessWarning = true;
                  contentVersionVO.setHasAnonymousUserAccess(false);
                }
              }

              if(!skipDisplayName)
              {
                InfoGluePrincipal principal = (InfoGluePrincipal)getInfoGluePrincipal(contentVersionVO.getVersionModifier(), db);
                if(principal != null)
                {
                  if(principal.getName().equalsIgnoreCase(principal.getDisplayName()))
                    skipDisplayName = true;
                 
                  contentVersionVO.setVersionModifierDisplayName(principal.getDisplayName());
                }
              }
              contentVersionVO.setPath(getContentPath(contentVersionVO.getContentId(), db));
            }
            else
              logger.info("Not adding contentVersion..");
          }
 
            this.contentVersionVOList.addAll(contentVersionVOList);
            Collections.sort(this.contentVersionVOList, Collections.reverseOrder(new ReflectionComparator("modifiedDateTime")));
         
          commitTransaction(db);
            }
            catch(Exception e)
            {
                logger.error("An error occurred so we should not complete the transaction:" + e);
                logger.warn("An error occurred so we should not complete the transaction:" + e, e);
                rollbackTransaction(db);
                throw new SystemException(e.getMessage());
            }
      }
    }
    finally
    {
      processBean.setStatus(ProcessBean.FINISHED);
      processBean.removeProcess();
    }
   
      return "success";
  }
View Full Code Here

   * ask the user for a comment as this is to be regarded as a new version.
   */
    
    public String doExecute() throws Exception
    {     
      ProcessBean processBean = ProcessBean.createProcessBean(this.getClass().getName(), "" + getInfoGluePrincipal().getName());
      processBean.setStatus(ProcessBean.RUNNING);
     
      try
      {
          Timer t = new Timer();
         
        setSiteNodeVersionId( getRequest().getParameterValues("selSiteNodeVersions") );
        //Iterator it = siteNodeVersionId.iterator();
   
        List events = new ArrayList();
   
        Map<Integer,SiteNodeVO> newsiteNodeMap = new HashMap<Integer,SiteNodeVO>();
        Map<Integer,ContentVO> newContentMap = new HashMap<Integer,ContentVO>();
   
        Map<Integer,SiteNodeVO> siteNodeMap = SiteNodeController.getController().getSiteNodeVOMapWithNoStateCheck(siteNodeVersionId);
        processBean.updateProcess("Read " + siteNodeMap.size() + " pages to change state on" /*getLocalizedString(getLocale(), "tool.structuretool.publicationProcess.gettingItems")*/);
        for(Entry<Integer,SiteNodeVO> entry : siteNodeMap.entrySet())
        {
          Integer siteNodeVersionId = entry.getKey();
          logger.info("Publishing:" + siteNodeVersionId);
          SiteNodeVersionVO siteNodeVersion = SiteNodeStateController.getController().changeState(siteNodeVersionId, entry.getValue(), SiteNodeVersionVO.PUBLISH_STATE, getVersionComment(), this.overrideVersionModifyer, this.recipientFilter, this.getInfoGluePrincipal(), events);
         
          if (events.size() % 50 == 0)
            processBean.updateLastDescription("Processed " + events.size() /*getLocalizedString(getLocale(), "tool.structuretool.publicationProcess.gettingItems")*/);
 
          newsiteNodeMap.put(siteNodeVersion.getId(), entry.getValue());
        }
   
        /*
        while(it.hasNext())
        {
          Integer siteNodeVersionId = (Integer)it.next();
          logger.info("Publishing:" + siteNodeVersionId);
          SiteNodeVersionVO siteNodeVersion = SiteNodeStateController.getController().changeState(siteNodeVersionId, SiteNodeVersionVO.PUBLISH_STATE, getVersionComment(), this.overrideVersionModifyer, this.recipientFilter, this.getInfoGluePrincipal(), null, events);
        }
        */
       
        setContentVersionId( getRequest().getParameterValues("selContentVersions") );
       
        Map<Integer,ContentVO> contentMap = ContentController.getContentController().getContentVOMapWithNoStateCheck(contentVersionId);
        processBean.updateProcess("Read " + contentMap.size() + " contents to change state on" /*getLocalizedString(getLocale(), "tool.structuretool.publicationProcess.gettingItems")*/);
        processBean.updateLastDescription("Processing pages");
 
        for(Entry<Integer,ContentVO> entry : contentMap.entrySet())
        {
          Integer contentVersionId = entry.getKey();
          logger.info("Publishing:" + siteNodeVersionId);
          ContentVersionVO contentVersion = ContentStateController.changeState(contentVersionId, entry.getValue(), ContentVersionVO.PUBLISH_STATE, getVersionComment(), this.overrideVersionModifyer, this.recipientFilter, this.getInfoGluePrincipal(), null, events);
         
          if (events.size() % 50 == 0)
            processBean.updateLastDescription("Processed " + events.size());
 
          newContentMap.put(contentVersion.getId(), entry.getValue());
        }
        /*
        Iterator contentVersionIdsIterator = contentVersionId.iterator();
        while(contentVersionIdsIterator.hasNext())
        {
          Integer contentVersionId = (Integer)contentVersionIdsIterator.next();
          logger.info("Publishing:" + contentVersionId);
          ContentVersionVO contentVersion = ContentStateController.changeState(contentVersionId, ContentVersionVO.PUBLISH_STATE, getVersionComment(), this.overrideVersionModifyer, this.recipientFilter, this.getInfoGluePrincipal(), null, events);
        }
        */
 
        if(!attemptDirectPublishing.equalsIgnoreCase("true"))
        {
          if(recipientFilter != null && !recipientFilter.equals("") && events != null && events.size() > 0)
            PublicationController.mailPublishNotification(events, repositoryId, getInfoGluePrincipal(), recipientFilter, false);
        }
       
            RepositoryVO repositoryVO = RepositoryController.getController().getRepositoryVOWithId(repositoryId);
            String liveAddressBaseUrl = repositoryVO.getLiveBaseUrl() + "";
   
            String liveAddress = null;
            if(CmsPropertyHandler.getPublicDeliveryUrls().size() > 0)
            {
              String firstPublicDeliveryUrl = (String)CmsPropertyHandler.getPublicDeliveryUrls().get(0);
              logger.debug("firstPublicDeliveryUrl:" + firstPublicDeliveryUrl);
              String[] firstPublicDeliveryUrlSplit = firstPublicDeliveryUrl.split("/");
             
              String context = firstPublicDeliveryUrlSplit[firstPublicDeliveryUrlSplit.length - 1];
              logger.debug("context:" + context);
              liveAddress = liveAddressBaseUrl + "/" + context + "/ViewPage.action" + "?siteNodeId=" + this.getSiteNodeId() + "&languageId=" + this.languageId;
            }
           
        if(attemptDirectPublishing.equalsIgnoreCase("true"))
        {
                setActionMessage(userSessionKey, getLocalizedString(getLocale(), "tool.common.publishing.publishingInlineOperationDoneHeader"));
              if(liveAddress != null)
                addActionLink(userSessionKey, new LinkBean("publishedPageUrl", getLocalizedString(getLocale(), "tool.common.publishing.publishingInlineOperationViewPublishedPageLinkText"), getLocalizedString(getLocale(), "tool.common.publishing.publishingInlineOperationViewPublishedPageTitleText"), getLocalizedString(getLocale(), "tool.common.publishing.publishingInlineOperationViewPublishedPageTitleText"), liveAddress, false, "", "_blank"));
              else
                addActionLink(userSessionKey, new LinkBean("publishedPageUrl", "No public servers stated in cms", "No public servers stated in cms", "No public servers stated in cms", "#", false, "", "_blank"));
               
          PublicationVO publicationVO = new PublicationVO();
            publicationVO.setName("Direct publication by " + this.getInfoGluePrincipal().getName());
            publicationVO.setDescription(getVersionComment());
            publicationVO.setRepositoryId(repositoryId);
          publicationVO = PublicationController.getController().createAndPublish(publicationVO, events, newsiteNodeMap, newContentMap, overrideVersionModifyer, this.getInfoGluePrincipal());
     
          processBean.updateProcess("Creating publication"/*getLocalizedString(getLocale(), "tool.structuretool.publicationProcess.gettingItems")*/);
        }
        else
        {
                setActionMessage(userSessionKey, getLocalizedString(getLocale(), "tool.common.publishing.submitToPublishingInlineOperationDoneHeader"));
        }
   
        logger.info("this.returnAddress:" + this.returnAddress);
        if(this.returnAddress != null && !this.returnAddress.equals(""))
            {
              String arguments   = "userSessionKey=" + userSessionKey + "&attemptDirectPublishing=" + attemptDirectPublishing + "&isAutomaticRedirect=false";
              String messageUrl   = returnAddress + (returnAddress.indexOf("?") > -1 ? "&" : "?") + arguments;
             
              this.getResponse().sendRedirect(messageUrl);
              return NONE;
            }
            else
            {
              return SUCCESS;
            }
            /*
        if(this.returnAddress != null && !this.returnAddress.equals(""))
        {
          this.returnAddress = this.getResponse().encodeURL(returnAddress);
          this.getResponse().sendRedirect(returnAddress);
     
          return NONE;
        }
        else
        {
               return "success";
        }
        */
        }
      finally
      {
        processBean.setStatus(ProcessBean.FINISHED);
        processBean.removeProcess();
      }
    }
View Full Code Here

      return "input";
  }
 
  public String doInputChooseSiteNodes() throws Exception
  {
    ProcessBean processBean = ProcessBean.createProcessBean(UnpublishSiteNodeVersionAction.class.getName(), "" + siteNodeId + "_" + getInfoGluePrincipal().getName());
    processBean.setStatus(ProcessBean.RUNNING);
   
    try
    {
    if(this.siteNodeId != null)
    {
        SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId(this.siteNodeId);
        this.repositoryId = siteNodeVO.getRepositoryId();

      if(this.siteNodeVersionId == null)
      {
          SiteNodeVersionVO siteNodeVersionVO = SiteNodeVersionControllerProxy.getSiteNodeVersionControllerProxy().getACLatestActiveSiteNodeVersionVO(this.getInfoGluePrincipal(), siteNodeId);
          if(siteNodeVersionVO != null)
              this.siteNodeVersionId = siteNodeVersionVO.getId();
      }

      AccessConstraintExceptionBuffer ceb = new AccessConstraintExceptionBuffer();
     
      Integer protectedSiteNodeVersionId = SiteNodeVersionControllerProxy.getSiteNodeVersionControllerProxy().getProtectedSiteNodeVersionId(siteNodeVersionId);
      if(protectedSiteNodeVersionId != null && !AccessRightController.getController().getIsPrincipalAuthorized(this.getInfoGluePrincipal(), "SiteNodeVersion.SubmitToPublish", protectedSiteNodeVersionId.toString()))
        ceb.add(new AccessConstraintException("SiteNodeVersion.siteNodeId", "1005"));
     
      ceb.throwIfNotEmpty();

      siteNodeVOList = SiteNodeController.getController().getSiteNodeVOWithParentRecursive(siteNodeId, processBean);
    }
    }
    finally
    {
      processBean.setStatus(ProcessBean.FINISHED);
      processBean.removeProcess();
    }

      return "inputChooseSiteNodes";
  }
View Full Code Here

   * This method will try to unpublish all liver versions of this sitenode.
   */
    
    public String doUnpublishAll() throws Exception
    {  
      ProcessBean processBean = ProcessBean.createProcessBean(UnpublishSiteNodeVersionAction.class.getName(), "" + getInfoGluePrincipal().getName());
    processBean.setStatus(ProcessBean.RUNNING);

    try
    {
      String[] siteNodeIds = getRequest().getParameterValues("sel");
 
      List<EventVO> events = new ArrayList<EventVO>();
 
      List<Integer> siteNodeVersionIdList = new ArrayList<Integer>();
      for(int i=0; i < siteNodeIds.length; i++)
        siteNodeVersionIdList.add(new Integer(siteNodeIds[i]));
 
      Map<Integer,SiteNodeVO> siteNodeMap = SiteNodeController.getController().getSiteNodeVOMapWithNoStateCheck(siteNodeVersionIdList);
      Map<Integer,ContentVO> contentMap = new HashMap<Integer,ContentVO>();
 
      processBean.updateProcess("Found " + siteNodeMap.size() + " pages");

      //System.out.println("Read all siteNodes:" + siteNodeMap);
 
      /*
      for(Entry<Integer,SiteNodeVO> entry : siteNodeMap.entrySet())
      {
        Integer siteNodeVersionId = entry.getKey();
        logger.info("Publishing:" + siteNodeVersionId);
        SiteNodeVersionVO siteNodeVersion = SiteNodeStateController.getController().changeState(siteNodeVersionId, entry.getValue(), SiteNodeVersionVO.PUBLISH_STATE, getVersionComment(), this.overrideVersionModifyer, this.recipientFilter, this.getInfoGluePrincipal(), events);
      }
      */
 
      processBean.updateProcess("Processing " + siteNodeIds.length + " pages");
     
          for(int i=0; i < siteNodeIds.length; i++)
      {
            if (i % 10 == 0)
              processBean.updateLastDescription("Unpublished " + i + " pages");

              String siteNodeIdString = siteNodeIds[i];
            List siteNodeVersionVOList = SiteNodeVersionController.getController().getPublishedActiveSiteNodeVersionVOList(new Integer(siteNodeIdString));
           
        Iterator it = siteNodeVersionVOList.iterator();
       
        while(it.hasNext())
        {
          SiteNodeVersionVO siteNodeVersionVO = (SiteNodeVersionVO)it.next();
         
          SiteNodeVersionVO latestSiteNodeVersionVO = SiteNodeVersionController.getController().getLatestActiveSiteNodeVersionVO(siteNodeVersionVO.getSiteNodeId());
          //SiteNodeVO siteNodeVO = siteNodeMap.get(siteNodeVersionVO.getId());
          //if(siteNodeVO == null)
          SiteNodeVO siteNodeVO = SiteNodeController.getController().getSiteNodeVOWithId(siteNodeVersionVO.getSiteNodeId());
         
          if(attemptDirectPublishing.equals("true"))
          {
            if(siteNodeVersionVO.getId().equals(latestSiteNodeVersionVO.getId()))
            {
              logger.info("Creating a new working version as there was no active working version left...");
              SiteNodeVersionVO newSiteNodeVersionVO = SiteNodeStateController.getController().changeState(siteNodeVersionVO.getId(), siteNodeVO, SiteNodeVersionVO.WORKING_STATE, "new working version", false, this.getInfoGluePrincipal(), events);
              siteNodeMap.put(newSiteNodeVersionVO.getId(), siteNodeVO);
            }
          }
         
          EventVO eventVO = new EventVO();
          eventVO.setDescription(this.versionComment);
          eventVO.setEntityClass(SiteNodeVersion.class.getName());
          eventVO.setEntityId(siteNodeVersionVO.getId());
          eventVO.setName(siteNodeVO.getName());
          eventVO.setTypeId(EventVO.UNPUBLISH_LATEST);
          eventVO = EventController.create(eventVO, this.repositoryId, this.getInfoGluePrincipal());
          events.add(eventVO);
         
          List contentVersionVOList = SiteNodeVersionController.getController().getMetaInfoContentVersionVOList(siteNodeVersionVO, siteNodeVO, this.getInfoGluePrincipal());
          Iterator contentVersionVOListIterator = contentVersionVOList.iterator();
          while(contentVersionVOListIterator.hasNext())
          {
              ContentVersionVO currentContentVersionVO = (ContentVersionVO)contentVersionVOListIterator.next();
             
            ContentVersionVO latestContentVersionVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(currentContentVersionVO.getContentId(), currentContentVersionVO.getLanguageId());
            ContentVO contentVO = ContentController.getContentController().getContentVOWithId(currentContentVersionVO.getContentId());
            contentMap.put(currentContentVersionVO.getId(), contentVO);
            if(attemptDirectPublishing.equals("true"))
            {
              if(currentContentVersionVO.getId().equals(latestContentVersionVO.getId()))
              {
                logger.info("Creating a new working version as there was no active working version left...:" + currentContentVersionVO.getLanguageName());
                ContentStateController.changeState(currentContentVersionVO.getId(), contentVO, ContentVersionVO.WORKING_STATE, "new working version", false, null, this.getInfoGluePrincipal(), currentContentVersionVO.getContentId(), events);
              }
             
              EventVO versionEventVO = new EventVO();
              versionEventVO.setDescription(this.versionComment);
              versionEventVO.setEntityClass(ContentVersion.class.getName());
              versionEventVO.setEntityId(currentContentVersionVO.getId());
              versionEventVO.setName(contentVO.getName());
              versionEventVO.setTypeId(EventVO.UNPUBLISH_LATEST);
              versionEventVO = EventController.create(versionEventVO, this.repositoryId, this.getInfoGluePrincipal());
              events.add(versionEventVO);         
            }
          }
        }
      }
     
      if(!attemptDirectPublishing.equalsIgnoreCase("true"))
      {
        if(recipientFilter != null && !recipientFilter.equals("") && events != null && events.size() > 0)
          PublicationController.mailPublishNotification(events, repositoryId, getInfoGluePrincipal(), recipientFilter, true);
      }

      if(attemptDirectPublishing.equalsIgnoreCase("true"))
      {
          PublicationVO publicationVO = new PublicationVO();
          publicationVO.setName("Direct publication by " + this.getInfoGluePrincipal().getName());
          publicationVO.setDescription(getVersionComment());
          //publicationVO.setPublisher(this.getInfoGluePrincipal().getName());
          publicationVO.setRepositoryId(repositoryId);
          publicationVO = PublicationController.getController().createAndPublish(publicationVO, events, siteNodeMap, contentMap, false, this.getInfoGluePrincipal());
      }
    }
    finally
    {
      processBean.setStatus(ProcessBean.FINISHED);
      processBean.removeProcess();
    }
   
    if(this.returnAddress != null && !this.returnAddress.equals(""))
        {
          String arguments   = "userSessionKey=" + userSessionKey + "&attemptDirectPublishing=" + attemptDirectPublishing + "&isAutomaticRedirect=false";
View Full Code Here

TOP

Related Classes of org.infoglue.cms.applications.databeans.ProcessBean

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.