cmailleux    2005/09/30 10:40:28 CEST

  Modified files:
    core/src/java/org/jahia/workflow/nstep NStepWorkflow.java 
  Log:
  Show only rollback to author after first step and show rollback one step and 
rollback to author after that

  

  Add some javadoc
  
  Revision  Changes    Path
  1.7       +28 -25    
jahia/core/src/java/org/jahia/workflow/nstep/NStepWorkflow.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/workflow/nstep/NStepWorkflow.java.diff?r1=1.6&r2=1.7&f=h
  
  
  
  Index: NStepWorkflow.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/workflow/nstep/NStepWorkflow.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- NStepWorkflow.java        29 Sep 2005 15:02:00 -0000      1.6
  +++ NStepWorkflow.java        30 Sep 2005 08:40:28 -0000      1.7
  @@ -27,21 +27,26 @@
   import java.io.IOException;
   import java.util.*;
   
  -/*
  - * Copyright (c) 2004 CODEVA. All Rights Reserved.
  - */
  -
   /**
  - * Created by IntelliJ IDEA.
  - * User: Rincevent
  - * Date: 9 d�c. 2004
  + * NstepWorkflow is a workflow which allowed you to define multiple 
sequential process in resource files.
  + * Then this processes can be applied to your pages in jahia to change the 
base two step workflow.
  + *
  + * Date: 9 déc. 2004
    * Time: 14:53:40
  - * To change this template use File | Settings | File Templates.
  + * @author [EMAIL PROTECTED]
  + * @version $Id: NStepWorkflow.java,v 1.7 2005/09/30 08:40:28 cmailleux Exp $
  + *
  + * Revision log :
  + * $Log: NStepWorkflow.java,v $
  + * Revision 1.7  2005/09/30 08:40:28  cmailleux
  + * Show only rollback to author after first step and show rollback one step 
and rollback to author after that

  + * 

  + * Add some javadoc
  + *
    */
   public class NStepWorkflow implements ExternalWorkflow {
   // ------------------------------ FIELDS ------------------------------
   
  -    private ApplicationContext context = null;
       private final Log log = LogFactory.getLog(NStepWorkflow.class);
       private org.jahia.workflow.nstep.service.WorkflowHistoryManager 
historyManager = null;
       private org.jahia.workflow.nstep.service.WorkflowInstanceManager 
instanceManager = null;
  @@ -56,7 +61,7 @@
   
       public NStepWorkflow() throws JahiaException {
           try {
  -            context = SpringContextSingleton.getInstance().getContext();
  +            ApplicationContext context = 
SpringContextSingleton.getInstance().getContext();
               workflowManager = 
(org.jahia.workflow.nstep.service.WorkflowManager) 
context.getBean("nstepWorkflowManager");
               instanceManager = 
(org.jahia.workflow.nstep.service.WorkflowInstanceManager) context.getBean(
                       "nstepWorkflowInstanceManager");
  @@ -95,9 +100,8 @@
       /**
        * Get the name of the workflow engine, as it will be displayed in jahia 
engine
        *
  -     * @return
  +     * @return localized name of the workflow engine
        *
  -     * todo ResourceBundleize this string
        */
       public String getDisplayName() {
           if (resourceBundle == null) {
  @@ -126,7 +130,7 @@
       /**
        * Get the name of the process
        *
  -     * @return
  +     * @return the localized name of the process
        */
       public String getProcessName(String processName) {
           String procName = resourceBundle.getString(
  @@ -145,7 +149,7 @@
        * @param languageCode
        * @param jParams
        *
  -     * @return
  +     * @return null in all case
        */
       public String initProcess(String processName, String objectKey, String 
languageCode, ProcessingContext jParams) {
           try {
  @@ -165,7 +169,7 @@
           } catch (ObjectRetrievalFailureException e) {
               log.warn("Error could not retrieve process " + processName, e);
           }
  -        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
  +        return null;
       }
   
       /**
  @@ -175,7 +179,7 @@
        * @param objectKey
        * @param languageCode
        *
  -     * @return
  +     * @return true if process is already started
        */
       public boolean isProcessStarted(String processName, String objectKey, 
String languageCode) {
           try {
  @@ -223,7 +227,7 @@
        *
        * @param processName
        *
  -     * @return
  +     * @return Collection of String containing all actions available in 
specified workflow
        */
       public Collection getAllActions(String processName) {
           try {
  @@ -251,7 +255,7 @@
        * @param languageCode
        * @param jParams
        *
  -     * @return
  +     * @return Collection of string containing action names
        */
       public Collection getAvailableActions(String processName, String 
objectKey, String languageCode, ProcessingContext jParams) {
           WorkflowInstance instance = 
instanceManager.getWorkflowInstanceByObjectKey(objectKey, languageCode);
  @@ -264,10 +268,12 @@
               JahiaGroup group = 
workflowService.getRoleGroup(jParams.getContentPage(),
                                                               
trimActionName(workflowStep.getName()), true);
               if (group.isMember(jParams.getUser())) {
  -                // avoid rollback on first step
  -                if (startIndex > 1) {
  -                    // Add rollback to previous step
  +                // avoid rollback on first two step
  +                if (startIndex > 2) {
  +                    // Add rollback to previous step only if we have already 
done step one
                       list.add(trimActionName(rollback_action_name));
  +                }
  +                if(startIndex > 1) {
                       // Add rollback to author (reinit workflow)
                       list.add(trimActionName(rollback_author_action_name));
                   }
  @@ -289,7 +295,7 @@
        * @param actionName
        * @param jParams
        *
  -     * @return
  +     * @return a simple string containing an html defining a text area for 
user input
        */
       public String getParameterForm(String processName, String actionName, 
ProcessingContext jParams) {
           // We don't need extra information
  @@ -310,14 +316,13 @@
        * @param actionName
        * @param jParams
        *
  -     * @return
  +     * @return true if sendAction is successfull false otherwise
        */
       public boolean sendAction(String processName, String objectKey, String 
languageCode, String actionName,
                                 ProcessingContext jParams) {
           try {
               String unTrimmedActionName = untrimActionName(actionName);
               String comment = jParams.getParameter("nstepcomment");
  -            ActivationTestResults testResults = null;
               boolean isStartStep = false;
               boolean isFinished = false;
               WorkflowInstance instance;
  @@ -353,7 +358,7 @@
                                                                    
languageCode);
                   if (isFinished) {
                       // Publish object
  -                    testResults = finishProcess(languageCode, jParams, 
objectKey, processName);
  +                    finishProcess(languageCode, jParams, objectKey, 
processName);
                   } else {
                       changeStatus(languageCode, jParams, objectKey, 
processName,
                                    EntryLoadRequest.WAITING_WORKFLOW_STATE);
  @@ -368,10 +373,13 @@
               sendMail(jParams, actionName, objectKey, languageCode, comment, 
isStartStep, isFinished, instance);
           } catch (ObjectRetrievalFailureException e) {
               log.warn("Can not retrieve object " + objectKey + " in language 
" + languageCode, e);
  +            throw new RuntimeException(e);
           } catch (JahiaException e) {
               log.warn("Can not retrieve object " + objectKey + " in language 
" + languageCode, e);
  +            throw new RuntimeException(e);
           } catch (ClassNotFoundException e) {
               log.warn("Can not retrieve object " + objectKey + " in language 
" + languageCode, e);
  +            throw new RuntimeException(e);
           }
   
           return true;
  

Reply via email to