craigmcc    01/08/21 18:04:37

  Modified:    workflow/src/java/org/apache/commons/workflow/base
                        BaseContext.java
  Log:
  When execute() is called at a point at which "nextStep" is null, assume
  that we need to start at the beginning of the Activity.  Otherwise, if you
  do the following sequence:
  
    Context context = ...
    Activity activity = new BaseActivity();
    context.setActivity(activity);
  
  and *then* add some steps to the activity, they never get executed.
  
  As a side effect, this change allows you to rerun an Activity if you wish.
  
  Revision  Changes    Path
  1.7       +7 -5      
jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/base/BaseContext.java
  
  Index: BaseContext.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/base/BaseContext.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- BaseContext.java  2001/08/20 04:14:19     1.6
  +++ BaseContext.java  2001/08/22 01:04:37     1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/base/BaseContext.java,v
 1.6 2001/08/20 04:14:19 craigmcc Exp $
  - * $Revision: 1.6 $
  - * $Date: 2001/08/20 04:14:19 $
  + * $Header: 
/home/cvs/jakarta-commons-sandbox/workflow/src/java/org/apache/commons/workflow/base/BaseContext.java,v
 1.7 2001/08/22 01:04:37 craigmcc Exp $
  + * $Revision: 1.7 $
  + * $Date: 2001/08/22 01:04:37 $
    *
    * ====================================================================
    * 
  @@ -84,7 +84,7 @@
    * class.  If it is used in a multiple thread environment, callers must
    * take suitable precations.</p>
    *
  - * @version $Revision: 1.6 $ $Date: 2001/08/20 04:14:19 $
  + * @version $Revision: 1.7 $ $Date: 2001/08/22 01:04:37 $
    * @author Craig R. McClanahan
    */
   
  @@ -511,7 +511,9 @@
           // Do we actually have a next step to be performed
           if (activity == null)
               throw new IllegalStateException("No Activity has been selected");
  -        else if (nextStep == null)
  +        if (nextStep == null)
  +            nextStep = activity.getFirstStep();
  +        if (nextStep == null)
               throw new IllegalStateException("Activity has been completed");
   
           // Reset the suspend flag until set by another step
  
  
  

Reply via email to