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: ActivityLocal.java,v 1.1 2007/05/03 21:58:23 mlipp Exp $
021: *
022: * $Log: ActivityLocal.java,v $
023: * Revision 1.1 2007/05/03 21:58:23 mlipp
024: * Internal refactoring for making better use of local EJBs.
025: *
026: */
027: package de.danet.an.workflow.localapi;
028:
029: import java.util.List;
030:
031: import de.danet.an.workflow.api.ActivityUniqueKey;
032: import de.danet.an.workflow.api.AlreadyAssignedException;
033: import de.danet.an.workflow.api.Activity.DeadlineInfo;
034: import de.danet.an.workflow.api.Activity.Implementation;
035: import de.danet.an.workflow.api.Activity.Info;
036: import de.danet.an.workflow.api.Activity.JoinAndSplitMode;
037: import de.danet.an.workflow.localcoreapi.WfActivityLocal;
038: import de.danet.an.workflow.omgcore.InvalidResourceException;
039: import de.danet.an.workflow.omgcore.NotAssignedException;
040: import de.danet.an.workflow.omgcore.TransitionNotAllowedException;
041: import de.danet.an.workflow.omgcore.WfAssignment;
042: import de.danet.an.workflow.omgcore.WfResource;
043:
044: /**
045: * Interface <code>Activity</code> adds some functions to the
046: * {@link de.danet.an.workflow.localcoreapi.WfActivityLocal OMG activity}.
047: */
048: public interface ActivityLocal extends ExecutionObjectLocal,
049: WfActivityLocal {
050:
051: /**
052: * Return a unique key for the activity. (Note that the OMG
053: * interface defines the key returned by the {@link
054: * de.danet.an.workflow.localcoreapi.WfExecutionObjectLocal#key
055: * <code>key()</code>} method as unique within the scope of the
056: * containing process only.)
057: * @return value of uniqueKey
058: */
059: ActivityUniqueKey uniqueKey();
060:
061: /**
062: * Returns the implementation of the activity as {@link
063: * de.danet.an.workflow.localapi.ActivityLocal.Implementation
064: * <code>Implementation</code>}s.
065: *
066: * @return an array of <code>Implementation</code>}s or
067: * <code>null</code> if no implementation is defined
068: */
069: Implementation[] implementation();
070:
071: /**
072: * Returns the performer as string.
073: * @return performer as string
074: */
075: String performer();
076:
077: /**
078: * Returns the current executor.
079: *
080: * @return current executor or <code>null</code> if no executor
081: * running
082: */
083: Implementation executor();
084:
085: /**
086: * Returns the join mode.
087: * @return join mode
088: */
089: JoinAndSplitMode joinMode();
090:
091: /**
092: * Returns the split mode.
093: * @return split mode
094: */
095: JoinAndSplitMode splitMode();
096:
097: /**
098: * Returns the list of activities that may follow this activity,
099: * i.e. to which transitions exist.
100: * @return the list of {@link ActivityLocal <code>Activity</code>} objects.
101: */
102: List nextActivities();
103:
104: /**
105: * Returns the names of the exceptions handled by this activity.
106: * @return handled exceptions
107: */
108: String[] handledExceptions();
109:
110: /**
111: * Returns the deadlines defined for this activity.
112: *
113: * @return the deadlines
114: */
115: DeadlineInfo[] deadlines();
116:
117: /**
118: * This method returns all available information about the
119: * activity in a single operation.
120: *
121: * @return the resulting <code>Activity.Info</code> value
122: */
123: Info activityInfo();
124:
125: /**
126: * Returns the key of the "parent" block activity. All activities
127: * implicitly created by a block activity share the same block
128: * activity key.<P>
129: *
130: * Note that there need not be an activity with the returned key,
131: * as an activity set is actually a template describing how to
132: * implement block activities. The information obtained can mainly
133: * be used to group all activities that have been instantiated as
134: * part of an activity set.<P>
135: *
136: * @return an identification of the block activity that caused
137: * this activity to be instantiated or <code>null</code> if this
138: * activity was not instantiated as part of an activity set
139: */
140: String blockActivity();
141:
142: /**
143: * Force the completion of this activity, leaving it in state
144: * "closed.completed.abandoned". Does nothing if the activity is
145: * in state "closed" already or has not been started
146: * ("open.not_running.not_started").<P>
147: *
148: * An abandoned activity is considered to be completed under
149: * exceptional circumstances. Therefore only transitions with
150: * conditions of type <code>EXCEPTION</code> or
151: * <code>DEFAULTEXCEPTION</code> are considered when evaluating
152: * the set of subsequent activities. The argument is the name of
153: * the exception which may be used to distinguish different
154: * exceptions in transition evaluation (see XPDL).<P>
155: *
156: * This method should be used with care. In general, exceptions
157: * have a different level of abstraction in a workflow process
158: * description than in Java programming. The author of a workflow
159: * process should not have to know about e.g. a
160: * "SAXException". But he may know what to do in case of a
161: * "ResultInvalid" exception (though this kind of problem should
162: * only arise during development anyway).<P>
163: *
164: * This method may only be called during tool execution. Note that
165: * calling this method does not terminate tool execution, i.e. the
166: * method will return. A tool agent should, however, not try to do
167: * anything with the activity any more after calling this method.
168: *
169: * @param exceptionName the name of the exception
170: * @throws TransitionNotAllowedException if the activity is not
171: * executing a tool
172: */
173: void abandon(String exceptionName)
174: throws TransitionNotAllowedException;
175:
176: /**
177: * Get the resource associated with an Assignment. The method calls
178: * the corresponding method of the resource assignment service.
179: *
180: * This method is intended to be used by resource assignment
181: * systems for implementing {@link
182: * de.danet.an.workflow.localcoreapi.WfAssignment#assignee
183: * <code>WfAssignment.assignee</code>}.<P>
184: *
185: * Clients should not use this method but rather call {@link
186: * de.danet.an.workflow.localcoreapi.WfAssignment#assignee
187: * <code>WfAssignment.assignee</code>}.
188: *
189: * @param asnmnt the assignment
190: * @return the resource
191: */
192: WfResource getResource(WfAssignment asnmnt);
193:
194: /**
195: * Change an assignment for enacting the activity. This method calls
196: * the corresponding method of the resource assignment service and
197: * creates the appropriate audit event.<P>
198: *
199: * This method is intended to be used by resource assignment
200: * systems for implementing {@link
201: * de.danet.an.workflow.localcoreapi.WfAssignment#setAssignee
202: * <code>WfAssignment.setAssignee</code>}. Resource assignment
203: * systems are responsible for implementing
204: * <code>WfAssignment</code> and could therefore perform the
205: * reassignment directly; this would, however, leave the
206: * generation of notifications unexecuted. <P>
207: *
208: * Clients should not use this method but rather call {@link
209: * de.danet.an.workflow.localcoreapi.WfAssignment#setAssignee
210: * <code>WfAssignment.setAssignee</code>}.
211: *
212: * @param oldResource the resource that has its assignment removed
213: * @param newResource the resource to be assigned
214: * @throws InvalidResourceException if the resource is invalid.
215: * As the environment is a concurrent multi user environment,
216: * <code>WfResource</code> objects may become invalid.
217: * @throws AlreadyAssignedException if the assignment already
218: * exists
219: * @throws NotAssignedException if there is no assignment to the
220: * old resource
221: */
222: void changeAssignment(WfResource oldResource, WfResource newResource)
223: throws InvalidResourceException, AlreadyAssignedException,
224: NotAssignedException;
225:
226: /**
227: * Removes an assignment for enacting the activity. This method calls
228: * the corresponding method of the resource assignment service and
229: * creates the appropriate audit event.<P>
230: *
231: * This method is intended to be used by resource management
232: * systems for implementing {@link WfResource#release
233: * <code>WfResource.release</code>}. <P>
234: *
235: * Clients should not use this
236: * method but rather call {@link WfResource#release
237: * <code>WfResource.release</code>}.
238: *
239: * @param resource the resource whose assignment is to be canceled
240: * @throws InvalidResourceException if the resource is invalid.
241: * As the environment is a concurrent multi user environment,
242: * <code>WfResource</code> objects may become invalid.
243: * @throws NotAssignedException if there is no such assignment
244: */
245: void removeAssignment(WfResource resource)
246: throws InvalidResourceException, NotAssignedException;
247:
248: /**
249: * Makes this activity the chosen one in a set of activities
250: * started by an AND split with the "deferred choice" option
251: * set. All other activities in the set are reset to their initial
252: * state.
253: *
254: * <P>If the activity does not participate in a deferred choice,
255: * this method does nothing and returns <code>true</code>.
256: *
257: * @return <code>true</code> if the activity could be made the
258: * effectively chosen one
259: * @throws TransitionNotAllowedException if the activity is
260: * neither running nor suspended
261: */
262: boolean choose() throws TransitionNotAllowedException;
263: }
|