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