001: /*
002: * This file is part of the WfMOpen project.
003: * Copyright (C) 2001-2003 Danet GmbH (www.danet.de), GS-AN.
004: * All rights reserved.
005: *
006: * This program is free software; you can redistribute it and/or modify
007: * it under the terms of the GNU General Public License as published by
008: * the Free Software Foundation; either version 2 of the License, or
009: * (at your option) any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019: *
020: * $Id: WfExecutionObjectLocal.java,v 1.1 2007/05/03 21:58:19 mlipp Exp $
021: *
022: * $Log: WfExecutionObjectLocal.java,v $
023: * Revision 1.1 2007/05/03 21:58:19 mlipp
024: * Internal refactoring for making better use of local EJBs.
025: *
026: */
027: package de.danet.an.workflow.localcoreapi;
028:
029: import java.util.Collection;
030: import java.util.Date;
031:
032: import de.danet.an.workflow.omgcore.AlreadySuspendedException;
033: import de.danet.an.workflow.omgcore.CannotResumeException;
034: import de.danet.an.workflow.omgcore.CannotStopException;
035: import de.danet.an.workflow.omgcore.CannotSuspendException;
036: import de.danet.an.workflow.omgcore.HistoryNotAvailableException;
037: import de.danet.an.workflow.omgcore.InvalidDataException;
038: import de.danet.an.workflow.omgcore.InvalidPriorityException;
039: import de.danet.an.workflow.omgcore.InvalidStateException;
040: import de.danet.an.workflow.omgcore.NotRunningException;
041: import de.danet.an.workflow.omgcore.NotSuspendedException;
042: import de.danet.an.workflow.omgcore.ProcessData;
043: import de.danet.an.workflow.omgcore.TransitionNotAllowedException;
044: import de.danet.an.workflow.omgcore.UpdateNotAllowedException;
045: import de.danet.an.workflow.omgcore.WfExecutionObject.State;
046:
047: /**
048: * <code>WfExecutionObject</code> is an abstract base interface that defines
049: * common attributes, states, and operations for
050: * {@link de.danet.an.workflow.localcoreapi.WfProcessLocal <code>WfProcess</code>}
051: * and
052: * {@link de.danet.an.workflow.localcoreapi.WfActivityLocal <code>WfActivity</code>}.
053: **/
054: public interface WfExecutionObjectLocal extends WfObjectLocal {
055:
056: /**
057: * Return the current state.
058: *
059: * @return the current <code>state</code>.
060: */
061: State workflowState();
062:
063: /**
064: * Returns the workflow state for open execution objects.
065: * @return the state as <code>State</code> object.
066: */
067: State whileOpen();
068:
069: /**
070: * Returns the workflow state for open, not running execution objects.
071: * @return the state as <code>State</code> object.
072: */
073: State whyNotRunning();
074:
075: /**
076: * Returns the workflow state for closed execution objects.
077: * @return the state as <code>State</code> object.
078: */
079: State howClosed();
080:
081: /**
082: * Returns a list of all the valid states that can be reached from the
083: * current state.
084: * @return A {@link java.util.Collection collection} of
085: * all the valid states.
086: */
087: Collection validStates();
088:
089: /**
090: * Gets the current state of the object.
091: * @return the current state.
092: */
093: String state();
094:
095: /**
096: * Updates the current state of the execution object. As a result
097: * the state of execution objects associated with this execution object
098: * might be updated, too.
099: * @param newState State to change to.
100: * @throws InvalidStateException If <code>newState</code> is an invalid
101: * state for the execution object.
102: * @throws TransitionNotAllowedException If the transition from the current
103: * state to <code>newState</code> is not allowed.
104: */
105: void changeState(String newState) throws InvalidStateException,
106: TransitionNotAllowedException;
107:
108: /**
109: * Return human readable, descriptive identifier of the execution object.
110: * @return string of the descriptive identifier.
111: */
112: String name();
113:
114: /**
115: * Set the name of this <code>WfExecutionObject</code>.
116: * @param newValue the description of this <code>WfExecutionObject</code>.
117: */
118: void setName(String newValue);
119:
120: /**
121: * Identifier of the execution object.
122: * @return string of the identifier.
123: */
124: String key();
125:
126: /**
127: * Get the description of this <code>WfExecutionObject</code>.
128: * @return a string value of the description.
129: */
130: String description();
131:
132: /**
133: * Set the description of this <code>WfExecutionObject</code>.
134: * @param newValue the description of this <code>WfExecutionObject</code>.
135: */
136: void setDescription(String newValue);
137:
138: /**
139: * Return the context of this <code>WfExecutionObject</code>.
140: * @return the process relevant data that define the context of the
141: * execution object.
142: */
143: ProcessData processContext();
144:
145: /**
146: * Set the context of this <code>WfExecutionObject</code>.
147: * @param newValue process relevant data that define the context of the
148: * execution object.
149: * @throws InvalidDataException when new process data does not match the
150: * signature of this <code>WfExecutionObject</code>.
151: * @throws UpdateNotAllowedException raised when the implementation of the
152: * WfM Facility or the specific workflow process does not allow an update
153: * of the context.
154: */
155: void setProcessContext(ProcessData newValue)
156: throws InvalidDataException, UpdateNotAllowedException;
157:
158: /**
159: * Return the priority of this <code>WfExecutionObject</code>.
160: * @return the value of the priority.
161: */
162: int priority();
163:
164: /**
165: * Update the priority of this <code>WfExecutionObject</code>.
166: * @param newValue new priority to set
167: * @throws InvalidPriorityException when the specified priority is out of
168: * range.
169: * @throws UpdateNotAllowedException when the priority cannot be updated.
170: */
171: void setPriority(int newValue) throws InvalidPriorityException,
172: UpdateNotAllowedException;
173:
174: /**
175: * Return the time the state of the WfExecutionObject was changed.
176: * @return value of the time.
177: */
178: Date lastStateTime();
179:
180: /**
181: * Requests enactment of a suspended execution object to be resumed. The
182: * state is set to OpenState.Running (or a substate) from
183: * NotRunningState.SUSPENDED.
184: * @throws CannotResumeException when the execution object cannot be
185: * resumed. For example, resuming a WfActivity might not be allowed when
186: * the containing WfProcess is suspended.
187: * @throws NotRunningException when the object is not running.
188: * @throws NotSuspendedException when the object is not suspended.
189: */
190: void resume() throws CannotResumeException, NotRunningException,
191: NotSuspendedException;
192:
193: /**
194: * Requests enactment of an execution object to be suspended. The state is
195: * set to NotRunningState.SUSPENDED (or one of its substates).
196: * @throws CannotSuspendException when the execution object cannot be
197: * suspended. For example, an implementation of the WfM Facility might not
198: * support suspension of a <code>WfActivity</code>.
199: * @throws NotRunningException when the object is not running.
200: * @throws AlreadySuspendedException when the object is already suspended.
201: */
202: void suspend() throws CannotSuspendException, NotRunningException,
203: AlreadySuspendedException;
204:
205: /**
206: * Requests enactment of an execution object to be terminated before its
207: * normal completion.
208: * @throws CannotStopException when the execution object cannot be aborted.
209: * @throws NotRunningException when the object is not running.
210: */
211: void terminate() throws CannotStopException, NotRunningException;
212:
213: /**
214: * Requests enactment of a suspended execution object to be aborted before
215: * its normal completion. The state is set to ClosedState.ABORTED.
216: * @throws CannotStopException when the execution object cannot be aborted.
217: * @throws NotRunningException when the object is not running.
218: */
219: void abort() throws CannotStopException, NotRunningException;
220:
221: /**
222: * Return all <code>WfAuditEvent</code> items associated with this
223: * execution object.
224: * @return the collection of all <code>WfAuditEvent</code> items.
225: * @throws HistoryNotAvailableException if any audit event item available.
226: */
227: Collection history() throws HistoryNotAvailableException;
228: }
|