001/** 002 * Copyright 2005-2016 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.kew.engine; 017 018import java.io.Serializable; 019import java.util.ArrayList; 020import java.util.List; 021 022import org.kuali.rice.kew.engine.node.RouteNodeInstance; 023 024 025/** 026 * Represents the current state of the workflow engine. 027 * 028 * @author Kuali Rice Team (rice.collab@kuali.org) 029 */ 030public class EngineState implements Serializable { 031 032 private static final long serialVersionUID = 2405363802483005090L; 033 034 private static int currentSimulationId = -10; 035 036 private RouteNodeInstance transitioningFrom; 037 private RouteNodeInstance transitioningTo; 038 private List completeNodeInstances = new ArrayList(); 039 private List generatedRequests = new ArrayList(); 040 041 public List getCompleteNodeInstances() { 042 return completeNodeInstances; 043 } 044 public void setCompleteNodeInstances(List completeNodeInstances) { 045 this.completeNodeInstances = completeNodeInstances; 046 } 047 public RouteNodeInstance getTransitioningFrom() { 048 return transitioningFrom; 049 } 050 public void setTransitioningFrom(RouteNodeInstance transitioningFrom) { 051 this.transitioningFrom = transitioningFrom; 052 } 053 public RouteNodeInstance getTransitioningTo() { 054 return transitioningTo; 055 } 056 public void setTransitioningTo(RouteNodeInstance transitioningTo) { 057 this.transitioningTo = transitioningTo; 058 } 059 public List getGeneratedRequests() { 060 return generatedRequests; 061 } 062 public void setGeneratedRequests(List generatedRequests) { 063 this.generatedRequests = generatedRequests; 064 } 065 066 /** 067 * Gets the next id to be used for simulation purposes. Since, during simulation, we cannot save to the database and get primary keys 068 * assigned to our data beans, this method will be used to get a new simulation id which is guaranteed to be a negative number 069 * which will be unique for at least the lifetime of the simulation. 070 */ 071 public String getNextSimulationId() { 072 synchronized (EngineState.class) { 073 return String.valueOf(currentSimulationId--); 074 } 075 } 076 077}