001: /*
002: * $Id: WfExecutionObject.java,v 1.2 2003/08/28 19:06:14 ajzeneski Exp $
003: *
004: * Copyright (c) 2001, 2002 The Open For Business Project - www.ofbiz.org
005: *
006: * Permission is hereby granted, free of charge, to any person obtaining a
007: * copy of this software and associated documentation files (the "Software"),
008: * to deal in the Software without restriction, including without limitation
009: * the rights to use, copy, modify, merge, publish, distribute, sublicense,
010: * and/or sell copies of the Software, and to permit persons to whom the
011: * Software is furnished to do so, subject to the following conditions:
012: *
013: * The above copyright notice and this permission notice shall be included
014: * in all copies or substantial portions of the Software.
015: *
016: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
017: * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
018: * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
019: * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
020: * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
021: * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
022: * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
023: *
024: */
025: package org.ofbiz.workflow;
026:
027: import java.sql.Timestamp;
028: import java.util.Iterator;
029: import java.util.List;
030: import java.util.Map;
031:
032: import org.ofbiz.entity.GenericDelegator;
033: import org.ofbiz.entity.GenericValue;
034:
035: /**
036: * WfExecutionObject - Workflow Execution Object Interface
037: *
038: * @author <a href="mailto:jaz@ofbiz.org">Andy Zeneski</a>
039: * @version $Revision: 1.2 $
040: * @since 2.0
041: */
042: public interface WfExecutionObject {
043:
044: /**
045: * @throws WfException General workflow exception.
046: * @return Current state of this object.
047: */
048: public List workflowStateType() throws WfException;
049:
050: /**
051: * @throws WfException General workflow exception.
052: * @return
053: */
054: public List whileOpenType() throws WfException;
055:
056: /**
057: * @throws WfException General workflow exception.
058: * @return Reason for not running.
059: */
060: public List whyNotRunningType() throws WfException;
061:
062: /**
063: * @throws WfException General workflow exception.
064: * @return Termination art of this process ot activity.
065: */
066: public List howClosedType() throws WfException;
067:
068: /**
069: * Retrieve the list of all valid states.
070: * @throws WfException General workflow exception.
071: * @return List of valid states.
072: */
073: public List validStates() throws WfException;
074:
075: /**
076: * Retrieve the current state of this process or activity.
077: * @throws WfException General workflow exception
078: * @return Current state.
079: */
080: public String state() throws WfException;
081:
082: /**
083: * Set new state for this process or activity.
084: * @param newState New state to be set.
085: * @throws WfException General workflow exception.
086: * @throws InvalidState The state is invalid.
087: * @throws TransitionNotAllowed The transition is not allowed.
088: */
089: public void changeState(String newState) throws WfException,
090: InvalidState, TransitionNotAllowed;
091:
092: /**
093: * Getter for attribute 'name'.
094: * @throws WfException General workflow exception.
095: * @return Name of the object.
096: */
097: public String name() throws WfException;
098:
099: /**
100: * Setter for attribute 'name'
101: * @param newValue Set the name of the object.
102: * @throws WfException General workflow exception.
103: */
104: public void setName(String newValue) throws WfException;
105:
106: /** Getter for the runtime key
107: * @throws WfException
108: * @return Key of the runtime object
109: */
110: public String runtimeKey() throws WfException;
111:
112: /**
113: * Getter for definition key
114: * @throws WfException General workflow exception.
115: * @return Key of the definition object.
116: */
117: public String key() throws WfException;
118:
119: /**
120: * Getter for attribute 'description'.
121: * @throws WfException General workflow exception.
122: * @return Description of this object.
123: */
124: public String description() throws WfException;
125:
126: /**
127: * Setter for attribute 'description'.
128: * @param newValue New value for attribute 'description'.
129: * @throws WfException General workflow exception.
130: */
131: public void setDescription(String newValue) throws WfException;
132:
133: /**
134: * Getter for attribute 'context'.
135: * @throws WfException General workflow exception.
136: * @return Process context.
137: */
138: public Map processContext() throws WfException;
139:
140: /**
141: * Set the process context
142: * @param newValue Set new process data.
143: * @throws WfException General workflow exception.
144: * @throws InvalidData The data is invalid.
145: * @throws UpdateNotAllowed Update the context is not allowed.
146: */
147: public void setProcessContext(Map newValue) throws WfException,
148: InvalidData, UpdateNotAllowed;
149:
150: /**
151: * Set the process context (with previously stored data)
152: * @param newValue RuntimeData entity key.
153: * @throws WfException General workflow exception.
154: * @throws InvalidData The data is invalid.
155: * @throws UpdateNotAllowed Update the context is not allowed.
156: */
157: public void setProcessContext(String newValue) throws WfException,
158: InvalidData, UpdateNotAllowed;
159:
160: /**
161: * Get the Runtime Data key (context)
162: * @return String primary key for the runtime (context) data
163: * @throws WfException
164: */
165: public String contextKey() throws WfException;
166:
167: /**
168: * Getter for attribute 'priority'.
169: * @throws WfException General workflow exception.
170: * @return Getter Priority of
171: */
172: public long priority() throws WfException;
173:
174: /**
175: * Setter for attribute 'priority'.
176: * @param newValue
177: * @throws WfException General workflow exception
178: */
179: public void setPriority(long newValue) throws WfException;
180:
181: /**
182: * Resume this process or activity.
183: * @throws WfException General workflow exception.
184: * @throws CannotResume
185: * @throws NotRunning
186: * @throws NotSuspended
187: */
188: public void resume() throws WfException, CannotResume, NotRunning,
189: NotSuspended;
190:
191: /**
192: * Suspend this process or activity.
193: * @throws WfException General workflow exception.
194: * @throws CannotSuspend
195: * @throws NotRunning
196: * @throws AlreadySuspended
197: */
198: public void suspend() throws WfException, CannotSuspend,
199: NotRunning, AlreadySuspended;
200:
201: /**
202: * Terminate this process or activity.
203: * @throws WfException General workflow exception
204: * @throws CannotStop
205: * @throws NotRunning
206: */
207: public void terminate() throws WfException, CannotStop, NotRunning;
208:
209: /**
210: * Abort the execution of this process or activity.
211: * @throws WfException General workflow exception.
212: * @throws CannotStop The execution cannot be sopped.
213: * @throws NotRunning The process or activity is not yet running.
214: */
215: public void abort() throws WfException, CannotStop, NotRunning;
216:
217: /**
218: * Getter for history count.
219: * @throws WfException Generall workflow exception
220: * @throws HistoryNotAvailable History can not be retrieved
221: * @return Count of history Elements
222: */
223: public int howManyHistory() throws WfException, HistoryNotAvailable;
224:
225: /**
226: * Search in the history for specific elements.
227: * @param query Search criteria.
228: * @param namesInQuery elements to search.
229: * @throws WfException General workflow exception
230: * @throws HistoryNotAvailable
231: * @return Found history elements that meet the search criteria.
232: */
233: public Iterator getIteratorHistory(String query,
234: java.util.Map namesInQuery) throws WfException,
235: HistoryNotAvailable;
236:
237: /**
238: * Getter for history sequence.
239: * @param maxNumber Maximum number of element in result list.
240: * @throws WfException General workflow exception.
241: * @throws HistoryNotAvailable
242: * @return List of History objects.
243: */
244: public List getSequenceHistory(int maxNumber) throws WfException,
245: HistoryNotAvailable;
246:
247: /**
248: * Predicate to check if a 'member' is an element of the history.
249: * @param member An element of the history.
250: * @throws WfException General workflow exception.
251: * @return true if the element of the history, false otherwise.
252: */
253: public boolean isMemberOfHistory(WfExecutionObject member)
254: throws WfException;
255:
256: /**
257: * Getter for timestamp of last state change.
258: * @throws WfException General workflow exception.
259: * @return Timestamp of last state change.
260: */
261: public Timestamp lastStateTime() throws WfException;
262:
263: /**
264: * Gets the GenericValue object of the definition.
265: * @returns GenericValue object of the definition.
266: * @throws WfException
267: */
268: public GenericValue getDefinitionObject() throws WfException;
269:
270: /**
271: * Gets the GenericValue object of the runtime workeffort.
272: * @returns GenericValue object of the runtime workeffort.
273: * @throws WfException
274: */
275: public GenericValue getRuntimeObject() throws WfException;
276:
277: /**
278: * Returns the delegator being used by this workflow
279: * @return GenericDelegator used for this workflow
280: * @throws WfException
281: */
282: public GenericDelegator getDelegator() throws WfException;
283:
284: } // interface WfExecutionObjectOperations
|