View Javadoc

1   /**
2    * Copyright 2005-2012 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kew.engine;
17  
18  import java.io.Serializable;
19  import java.util.ArrayList;
20  import java.util.List;
21  
22  import org.kuali.rice.kew.engine.node.RouteNodeInstance;
23  
24  
25  /**
26   * Represents the current state of the workflow engine.
27   * 
28   * @author Kuali Rice Team (rice.collab@kuali.org)
29   */
30  public class EngineState implements Serializable {
31      
32  	private static final long serialVersionUID = 2405363802483005090L;
33  
34  	private static int currentSimulationId = -10;
35      
36      private RouteNodeInstance transitioningFrom;
37      private RouteNodeInstance transitioningTo;
38      private List completeNodeInstances = new ArrayList();
39      private List generatedRequests = new ArrayList();
40      
41      public List getCompleteNodeInstances() {
42          return completeNodeInstances;
43      }
44      public void setCompleteNodeInstances(List completeNodeInstances) {
45          this.completeNodeInstances = completeNodeInstances;
46      }
47      public RouteNodeInstance getTransitioningFrom() {
48          return transitioningFrom;
49      }
50      public void setTransitioningFrom(RouteNodeInstance transitioningFrom) {
51          this.transitioningFrom = transitioningFrom;
52      }
53      public RouteNodeInstance getTransitioningTo() {
54          return transitioningTo;
55      }
56      public void setTransitioningTo(RouteNodeInstance transitioningTo) {
57          this.transitioningTo = transitioningTo;
58      }
59      public List getGeneratedRequests() {
60          return generatedRequests;
61      }
62      public void setGeneratedRequests(List generatedRequests) {
63          this.generatedRequests = generatedRequests;
64      }
65      
66      /**
67       * Gets the next id to be used for simulation purposes.  Since, during simulation, we cannot save to the database and get primary keys
68       * assigned to our data beans, this method will be used to get a new simulation id which is guaranteed to be a negative number
69       * which will be unique for at least the lifetime of the simulation.
70       */
71      public String getNextSimulationId() {
72          synchronized (EngineState.class) {
73              return String.valueOf(currentSimulationId--);
74          }
75      }
76      
77  }