001: /*--
002:
003: Copyright (C) 2002-2005 Adrian Price.
004: All rights reserved.
005:
006: Redistribution and use in source and binary forms, with or without
007: modification, are permitted provided that the following conditions
008: are met:
009:
010: 1. Redistributions of source code must retain the above copyright
011: notice, this list of conditions, and the following disclaimer.
012:
013: 2. Redistributions in binary form must reproduce the above copyright
014: notice, this list of conditions, and the disclaimer that follows
015: these conditions in the documentation and/or other materials
016: provided with the distribution.
017:
018: 3. The names "OBE" and "Open Business Engine" must not be used to
019: endorse or promote products derived from this software without prior
020: written permission. For written permission, please contact
021: adrianprice@sourceforge.net.
022:
023: 4. Products derived from this software may not be called "OBE" or
024: "Open Business Engine", nor may "OBE" or "Open Business Engine"
025: appear in their name, without prior written permission from
026: Adrian Price (adrianprice@users.sourceforge.net).
027:
028: THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
029: WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
030: OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
031: DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
032: INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
033: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
034: SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
035: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
036: STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
037: IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
038: POSSIBILITY OF SUCH DAMAGE.
039:
040: For more information on OBE, please see
041: <http://obe.sourceforge.net/>.
042:
043: */
044:
045: package org.obe.spi.service;
046:
047: import org.obe.client.api.repository.RepositoryException;
048: import org.obe.spi.WorkflowService;
049: import org.obe.spi.model.*;
050: import org.wfmc.audit.WMAAuditEntry;
051: import org.wfmc.wapi.WMActivityInstanceState;
052: import org.wfmc.wapi.WMFilter;
053: import org.wfmc.wapi.WMProcessInstanceState;
054: import org.wfmc.wapi.WMWorkItemState;
055:
056: import java.util.Date;
057:
058: /**
059: * Provides transactional caching and persistence services for process
060: * instances. This includes process instances, workflow relevant data,
061: * activity instances, work items; also attributes for process instance,
062: * activity instance, and work items.
063: *
064: * @author Adrian Price
065: */
066: public interface InstanceRepository extends WorkflowService {
067: String SERVICE_NAME = "InstanceRepository";
068:
069: /**
070: * Purges all data from the instance repository. <b>WARNING! All process
071: * instances, workflow relevant data, activity instances and work items
072: * will be permanently deleted.</b>
073: */
074: void purge() throws RepositoryException;
075:
076: /**
077: * Creates a new process instance for the given process definition.
078: *
079: * @param processDefinitionId The process definition ID.
080: * @param parentActivityInstanceId The ID of the parent activity instance,
081: * if any.
082: * @param processInstanceName The name of the process instance.
083: * @param priority Process instance priority.
084: * @param state The instance state, one of the integer values defined in
085: * {@link WMProcessInstanceState}.
086: * @param createdDate The creation date/time of the instance.
087: * @param startedDate The 'started' date/time for the instance. Should be
088: * <code>null</code> unless the <code>state</code> parameter is
089: * {@link WMProcessInstanceState#OPEN_RUNNING}.
090: * @param participants The list of process participants.
091: * @return The new process instance.
092: * @throws RepositoryException Workflow client exception.
093: */
094: ProcessInstance createProcessInstance(String processDefinitionId,
095: String parentActivityInstanceId,
096: String processInstanceName, int priority, int state,
097: Date createdDate, Date startedDate, String[] participants)
098: throws RepositoryException;
099:
100: /**
101: * Gets the specified process instance.
102: *
103: * @param processInstanceId The process instance id
104: * @return The process instance
105: * @throws RepositoryException Workflow client exception
106: */
107: ProcessInstance findProcessInstance(String processInstanceId)
108: throws RepositoryException;
109:
110: /**
111: * Retrieves a list of process instances.
112: *
113: * @param processDefinitionId The process definition Id, can be
114: * <code>null>/code> to select from instances of any process definition.
115: * @param filter A Filter specification.
116: * @return An array of matching process instances.
117: */
118: ProcessInstance[] findProcessInstances(String processDefinitionId,
119: WMFilter filter, boolean countFlag)
120: throws RepositoryException;
121:
122: /**
123: * Permanently deletes the specified process instance. Implementations
124: * must cascade this delete to include all related ActivityInstance,
125: * WorkItem and AttributeInstance entities.
126: *
127: * @param processInstanceId The ID of the process instance to delete.
128: * @throws RepositoryException
129: */
130: void deleteProcessInstance(String processInstanceId)
131: throws RepositoryException;
132:
133: /**
134: * Creates a process instance attribute.
135: *
136: * @param processInstanceId The process instance id
137: * @param attributeName The attribute name
138: * @param attributeType The attribute type
139: * @param attributeValue The attribute value
140: * @throws RepositoryException Workflow client exception
141: */
142: AttributeInstance createProcessInstanceAttribute(
143: String processInstanceId, String attributeName,
144: int attributeType, Object attributeValue)
145: throws RepositoryException;
146:
147: /**
148: * Reads the specified process attribute value.
149: *
150: * @param processInstanceId The process instance id
151: * @param attributeName The attribute name
152: * @return The attribute
153: * @throws RepositoryException Workflow client exception
154: */
155: AttributeInstance findProcessInstanceAttribute(
156: String processInstanceId, String attributeName)
157: throws RepositoryException;
158:
159: /**
160: * Reads a list of process instance attributes.
161: *
162: * @param processDefinitionId The process definition id, can be
163: * <code>null</code>.
164: * @param processInstanceId The process instance id, can be
165: * <code>null</code>.
166: * @param filter The filter, can be <code>null</code>.
167: * @param attrName The attribute name, can be <code>null</code>.
168: * @param countFlag True to return count value
169: * @return The query handle
170: * @throws RepositoryException Workflow client exception
171: */
172: AttributeInstance[] findProcessInstanceAttributes(
173: String processDefinitionId, String processInstanceId,
174: WMFilter filter, String attrName, boolean countFlag)
175: throws RepositoryException;
176:
177: /**
178: * Returns the specified activity instance.
179: *
180: * @param processDefinitionId The process definition id.
181: * @param processInstanceId The process instance id.
182: * @param activityDefinitionId The activity definition id.
183: * @param activityName The name of the activity.
184: * @param join The activity's join (can be <code>null</code>).
185: * @param blockActivityInstanceId The block activity instance ID, or
186: * <code>null</code> if the activity is not defined within an activity set.
187: * @param blockActivityIterator An iterator for the block activity owned by
188: * the instance (can be <code>null</code>).
189: * @param priority Activity priority.
190: * @param state Activity state, one of the integer values defined in
191: * {@link WMActivityInstanceState}.
192: * @param participants The list of participants for this activity.
193: * @return The new activity instance.
194: * @throws RepositoryException Workflow client exception.
195: */
196: ActivityInstance createActivityInstance(String processDefinitionId,
197: String processInstanceId, String activityDefinitionId,
198: String activityName, JoinInstance join,
199: String blockActivityInstanceId,
200: PersistentIterator blockActivityIterator, int priority,
201: int state, String[] participants)
202: throws RepositoryException;
203:
204: /**
205: * Reads the specified activity instance.
206: *
207: * @param activityInstanceId The activity instance id.
208: * @return The activity instance.
209: * @throws RepositoryException Workflow client exception.
210: */
211: ActivityInstance findActivityInstance(String activityInstanceId)
212: throws RepositoryException;
213:
214: /**
215: * Reads the specified activity instance. This method takes either the
216: * activity definition ID or the activity instance ID.
217: *
218: * @param processInstanceId The process instance id.
219: * @param activityDefinitionId The activity definition id.
220: * @param blockActivityInstanceId The ID of the block activity instance to
221: * which the activity instance belongs.
222: * @return The activity instance.
223: * @throws RepositoryException Workflow client exception.
224: */
225: ActivityInstance findActivityInstance(String processInstanceId,
226: String activityDefinitionId, String blockActivityInstanceId)
227: throws RepositoryException;
228:
229: /**
230: * Reads a list of activity instances.
231: *
232: * @param processDefinitionId The process definition ID, can be
233: * <code>null</code>.
234: * @param filter A Filter specification.
235: * @return An array of matching activity instances.
236: */
237: ActivityInstance[] findActivityInstances(
238: String processDefinitionId, String activityDefinitionId,
239: WMFilter filter, boolean countFlag)
240: throws RepositoryException;
241:
242: /**
243: * Creates an activity instance attribute.
244: *
245: * @param processInstanceId The process instance id
246: * @param activityInstanceId The activity instance id
247: * @param attributeName The attribute name
248: * @param attributeType The attribute type
249: * @param attributeValue The attribute value
250: * @throws RepositoryException Workflow client exception
251: */
252: AttributeInstance createActivityInstanceAttribute(
253: String processInstanceId, String activityInstanceId,
254: String attributeName, int attributeType,
255: Object attributeValue) throws RepositoryException;
256:
257: /**
258: * Reads the specified activity attribute value.
259: *
260: * @param processInstanceId The process instance id.
261: * @param activityInstanceId The activity instance id.
262: * @param attributeName The attribute name.
263: * @return The attribute.
264: * @throws RepositoryException Workflow client exception.
265: */
266: AttributeInstance findActivityInstanceAttribute(
267: String processInstanceId, String activityInstanceId,
268: String attributeName) throws RepositoryException;
269:
270: /**
271: * Reads a set of activity instance attributes.
272: *
273: * @param processInstanceId The ID of the process instance.
274: * @param activityInstanceId The ID of the activity instance.
275: * @param filter A Filter specification.
276: * @return An array of matching activity instance attributes.
277: */
278: AttributeInstance[] findActivityInstanceAttributes(
279: String processDefinitionId, String processInstanceId,
280: String activityDefinitionId, String activityInstanceId,
281: WMFilter filter, String attributeName, boolean countFlag)
282: throws RepositoryException;
283:
284: /**
285: * Creates a work item.
286: *
287: * @param processDefinitionId The process definition id.
288: * @param processInstanceId The process instance id.
289: * @param activityInstanceId The activity instance id.
290: * @param toolIndex The ID of the associated tool.
291: * @param state The work item state, one of the integer values defined in
292: * {@link WMWorkItemState}.
293: * @param participant The name of the participant to whom the work item is
294: * assigned.
295: * @return The new work item.
296: * @throws RepositoryException
297: */
298: WorkItem createWorkItem(String processDefinitionId,
299: String processInstanceId, String activityInstanceId,
300: int toolIndex, int state, String performer,
301: String participant) throws RepositoryException;
302:
303: /**
304: * Reads the specified work item.
305: *
306: * @param processInstanceId The process instance id.
307: * @param workItemId The work item id.
308: * @return The work item.
309: * @throws RepositoryException Workflow client exception
310: */
311: WorkItem findWorkItem(String processInstanceId, String workItemId)
312: throws RepositoryException;
313:
314: /**
315: * Reads a set of work items.
316: *
317: * @param filter A Filter specification.
318: * @return An array of matching work items.
319: */
320: WorkItem[] findWorkItems(WMFilter filter, boolean countFlag)
321: throws RepositoryException;
322:
323: /**
324: * Creates a work item attribute.
325: *
326: * @param processInstanceId The process instance id
327: * @param workItemId The work item id
328: * @param attributeName The attribute name
329: * @param attributeType The attribute type
330: * @param attributeValue The attribute value
331: * @throws RepositoryException Workflow client exception
332: */
333: AttributeInstance createWorkItemAttribute(String processInstanceId,
334: String workItemId, String attributeName, int attributeType,
335: Object attributeValue) throws RepositoryException;
336:
337: /**
338: * Reads the specified work item attribute value.
339: *
340: * @param processInstanceId The process instance id
341: * @param workItemId The work item id
342: * @param attributeName The attribute name
343: * @return The attribute
344: * @throws RepositoryException Workflow client exception
345: */
346: AttributeInstance findWorkItemAttribute(String processInstanceId,
347: String workItemId, String attributeName)
348: throws RepositoryException;
349:
350: /**
351: * Reads a set of work item attributes.
352: *
353: * @param filter A Filter specification.
354: * @return An array of matching work item attributes.
355: * @throws RepositoryException Workflow client exception
356: */
357: AttributeInstance[] findWorkItemAttributes(
358: String processInstanceId, String workItemId,
359: WMFilter filter, boolean countFlag)
360: throws RepositoryException;
361:
362: /**
363: * Finds the audit entries matching user specified criteria.
364: *
365: * @param filter Filter criteria.
366: * @return Matching audit entries.
367: * @throws RepositoryException If the filter type is unsupported.
368: */
369: WMAAuditEntry[] findAuditEntries(WMFilter filter)
370: throws RepositoryException;
371:
372: /**
373: * Deletes the audit entries matching user specified criteria.
374: *
375: * @param filter Filter criteria.
376: * @return Count of audit entries deleted.
377: * @throws RepositoryException If the filter type is unsupported.
378: */
379: int deleteAuditEntries(WMFilter filter) throws RepositoryException;
380: }
|