001: /*
002: * Copyright 2007 Outerthought bvba and Schaubroeck nv
003: *
004: * Licensed under the Apache 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.apache.org/licenses/LICENSE-2.0
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: */
016: package org.outerj.daisy.workflow;
017:
018: import org.outerj.daisy.repository.RepositoryException;
019: import org.outerx.daisy.x10Workflow.SearchResultDocument;
020:
021: import java.io.InputStream;
022: import java.util.List;
023: import java.util.Locale;
024: import java.util.Map;
025:
026: /**
027: * The main interface for accessing Daisy's workflow functionality.
028: *
029: * <p>This is an optional repository extension component.
030: *
031: * <p>All workflow operations are performed through this interface. The returned objects are
032: * pure value objects (data snapshots), with no active behaviour.
033: *
034: * <p>The WorkflowManager is obtained from the {@link org.outerj.daisy.repository.Repository Repository} as
035: * follows:
036: *
037: * <pre>
038: * WorkflowManager wfManager = (WorkflowManager)repository.getExtension("WorkflowManager");
039: * </pre>
040: *
041: * <p>In the remote repository API, the WorkflowManager extension can be registered as follows:
042: *
043: * <pre>
044: * RemoteRepositoryManager repositoryManager = ...;
045: * repositoryManager.registerExtension("WorkflowManager",
046: * new Packages.org.outerj.daisy.workflow.clientimpl.RemoteWorkflowManagerProvider());
047: * </pre>
048: */
049: public interface WorkflowManager {
050:
051: WfPoolManager getPoolManager();
052:
053: /**
054: * Defines (deploys) a new workflow definition.
055: *
056: * <p>It is the responsibility of the caller to close the input stream.
057: *
058: * @param mimeType Use application/zip for zipped workflow archives, or text/xml for XML-described workflows.
059: */
060: WfProcessDefinition deployProcessDefinition(InputStream is,
061: String mimeType, Locale locale) throws RepositoryException;
062:
063: /**
064: * Re-installs the built-in sample workflows. Can be useful after upgrading.
065: *
066: */
067: void loadSampleWorkflows() throws RepositoryException;
068:
069: /**
070: * Deletes a workflow definition.
071: *
072: * <p><b>Warning: this removes all process instances that use this workflow definition.</b>
073: */
074: void deleteProcessDefinition(String processDefinitionId)
075: throws RepositoryException;
076:
077: /**
078: * @throws ProcessDefinitionNotFoundException in case the workflow definition does not exist.
079: */
080: WfProcessDefinition getProcessDefinition(
081: String processDefinitionId, Locale locale)
082: throws RepositoryException;
083:
084: WfProcessDefinition getLatestProcessDefinition(String workflowName,
085: Locale locale) throws RepositoryException;
086:
087: /**
088: * Gets a list of the latest versions of all workflow definitions defined in the system.
089: */
090: List<WfProcessDefinition> getAllLatestProcessDefinitions(
091: Locale locale) throws RepositoryException;
092:
093: /**
094: * Gets a list of all workflow definitions (in all versions) defined in the system.
095: *
096: * <p>See {@link #getAllLatestProcessDefinitions(Locale)} to only get the latest versions.
097: */
098: List<WfProcessDefinition> getAllProcessDefinitions(Locale locale)
099: throws RepositoryException;
100:
101: /**
102: * Returns the number of process instances of each process definition. The key in the map
103: * is the process definition id, the value the instance count.
104: */
105: Map<String, Integer> getProcessInstanceCounts()
106: throws RepositoryException;
107:
108: /**
109: * Calculates initial values for start-state task variables.
110: */
111: List<WfVariable> getInitialVariables(String processDefinitionId,
112: WfVersionKey contextDocument) throws RepositoryException;
113:
114: /**
115: *
116: * @param startTaskData parameters for the start task of the workflow
117: * @param initialTransition the transition to take from the start node
118: */
119: WfProcessInstance startProcess(String processDefinitionId,
120: TaskUpdateData startTaskData, String initialTransition,
121: Locale locale) throws RepositoryException;
122:
123: /**
124: *
125: * @param executionPathFullName fullName property of the execution path
126: * @param transitionName allowed to be null
127: */
128: WfExecutionPath signal(String processInstanceId,
129: String executionPathFullName, String transitionName,
130: Locale locale) throws RepositoryException;
131:
132: WfProcessInstance getProcess(String processInstanceId, Locale locale)
133: throws RepositoryException;
134:
135: WfTask updateTask(String taskId, TaskUpdateData taskUpdateData,
136: Locale locale) throws RepositoryException;
137:
138: WfTask endTask(String taskId, TaskUpdateData taskUpdateData,
139: String transitionName, Locale locale)
140: throws RepositoryException;
141:
142: WfTask getTask(String taskId, Locale locale)
143: throws RepositoryException;
144:
145: /**
146: * Gets the open tasks for the current user.
147: */
148: List<WfTask> getMyTasks(Locale locale) throws RepositoryException;
149:
150: List<WfTask> getPooledTasks(Locale locale)
151: throws RepositoryException;
152:
153: WfTask requestPooledTask(String taskId, Locale locale)
154: throws RepositoryException;
155:
156: /**
157: * Unassigns a task from its current assignee, putting it back in the pool. Unassignment
158: * is not allowed if there are no pooled actors to fall back too.
159: */
160: WfTask unassignTask(String taskId, Locale locale)
161: throws RepositoryException;
162:
163: /**
164: * Assigns (possibly re-assigns) a task to the given actor (user or pools).
165: *
166: * @param overwriteSwimlane if the task is associated with a swimlane, should the swimlane be reassigned too? Usually yes.
167: */
168: WfTask assignTask(String taskId, WfActorKey actor,
169: boolean overwriteSwimlane, Locale locale)
170: throws RepositoryException;
171:
172: /**
173: *
174: * @param chunkOffset specify -1 to ignore
175: * @param chunkLength specify -1 to ignore
176: */
177: List<WfTask> getTasks(QueryConditions queryConditions,
178: List<QueryOrderByItem> orderByItems, int chunkOffset,
179: int chunkLength, Locale locale) throws RepositoryException;
180:
181: SearchResultDocument searchTasks(List<QuerySelectItem> selectItems,
182: QueryConditions queryConditions,
183: List<QueryOrderByItem> orderByItems, int chunkOffset,
184: int chunkLength, Locale locale) throws RepositoryException;
185:
186: List<WfProcessInstance> getProcesses(
187: QueryConditions queryConditions,
188: List<QueryOrderByItem> orderByItems, int chunkOffset,
189: int chunkLength, Locale locale) throws RepositoryException;
190:
191: SearchResultDocument searchProcesses(
192: List<QuerySelectItem> selectItems,
193: QueryConditions queryConditions,
194: List<QueryOrderByItem> orderByItems, int chunkOffset,
195: int chunkLength, Locale locale) throws RepositoryException;
196:
197: void deleteProcess(String processInstanceId)
198: throws RepositoryException;
199:
200: WfProcessInstance suspendProcess(String processInstanceId,
201: Locale locale) throws RepositoryException;
202:
203: WfProcessInstance resumeProcess(String processInstanceId,
204: Locale locale) throws RepositoryException;
205:
206: WfTimer getTimer(String timerId, Locale locale)
207: throws RepositoryException;
208:
209: List<WfTimer> getTimers(QueryConditions queryConditions,
210: List<QueryOrderByItem> orderByItems, int chunkOffset,
211: int chunkLength, Locale locale) throws RepositoryException;
212:
213: SearchResultDocument searchTimers(
214: List<QuerySelectItem> selectItems,
215: QueryConditions queryConditions,
216: List<QueryOrderByItem> orderByItems, int chunkOffset,
217: int chunkLength, Locale locale) throws RepositoryException;
218: }
|