001: package org.emforge;
002:
003: import java.io.IOException;
004: import java.util.List;
005:
006: import javax.jws.WebParam;
007: import javax.jws.WebService;
008:
009: import org.emforge.xfer.CommentTO;
010: import org.emforge.xfer.HistoryTO;
011: import org.emforge.xfer.PriorityTO;
012: import org.emforge.xfer.StepTO;
013: import org.emforge.xfer.TaskStatus;
014: import org.emforge.xfer.TaskTO;
015: import org.emforge.xfer.WorkflowTO;
016:
017: /** Web-Service for working with BPM Data
018: *
019: */
020: @WebService
021: public interface BpmService {
022: public static final int WORKFLOW_LAST_VERSION = -1;
023:
024: /** Returns List of Active Tasks for Logged-In user for Specified Project
025: *
026: * @param projectName
027: * @return
028: */
029: List<StepTO> getActiveSteps(@WebParam(name="projectName")
030: String projectName) throws EmForgeException;
031:
032: /** Returns Specific Step by ID
033: *
034: * @param stepId - step to return
035: * @return step object, or null if nothing found
036: */
037: StepTO getStep(@WebParam(name="stepId")
038: long stepId) throws EmForgeException;
039:
040: /** Returns Specific Task by ID
041: *
042: * @param taskId - task to return
043: * @return task object, or null if nothing found
044: */
045: TaskTO getTask(@WebParam(name="taskId")
046: long taskId) throws EmForgeException;
047:
048: /** Returns trie if task for specified workflow exists
049: *
050: * @param taskId - task to find
051: * @return
052: */
053: Boolean hasTask(@WebParam(name="taskId")
054: long taskId);
055:
056: /** Return list of Workflows, stored in the system
057: *
058: * @return
059: */
060: WorkflowTO[] getWorkflows() throws EmForgeException;
061:
062: /** Return workflow by name and version
063: * @param name - name of workflow
064: * @param version - version. If -1 is used - means last version of specified workflow
065: * @return Workflow object for specified name and version. Null is not found
066: */
067: WorkflowTO getWorkflowByName(@WebParam(name="name")
068: String name, @WebParam(name="version")
069: int version) throws EmForgeException;
070:
071: /** Return true if workflow exists
072: * @param name - name of workflow to find
073: * @param version - version. If -1 is used - means last version of specified workflow
074: * @return
075: */
076: Boolean hasWorkflow(@WebParam(name="name")
077: String name, @WebParam(name="version")
078: int version);
079:
080: /** Return workflow by id
081: * @param workflowId - id of workflow
082: * @return Workflow object for specified id. Null is not found
083: */
084: WorkflowTO getWorkflowById(@WebParam(name="workflowId")
085: long workflowId) throws EmForgeException;
086:
087: /** Add new workflow
088: *
089: * @param workflowContent - content of par-file
090: * @param comment - comment for this deployment
091: * @return create workflow
092: */
093: WorkflowTO addNewWorkflow(@WebParam(name="workflowContent")
094: byte[] workflowContent, @WebParam(name="comment")
095: String comment) throws EmForgeException;
096:
097: /** Retunrs history for workflow versions
098: *
099: * @param name - workflow name to get history
100: * @param version - workflow version to get history
101: * @return
102: * @throws EmForgeException
103: */
104: HistoryTO[] getWorkflowHistory(@WebParam(name="name")
105: String name, @WebParam(name="version")
106: int version) throws EmForgeException;
107:
108: /** Returns list of workflows, used in specified workflow
109: *
110: * @param name - workflow name
111: * @param version - workflow version
112: * @return
113: * @throws EmForgeException
114: */
115: WorkflowTO[] getUsedWorkflows(@WebParam(name="name")
116: String name, @WebParam(name="version")
117: int version) throws EmForgeException;
118:
119: /** Returns Blocking Steps for specified Task
120: *
121: */
122: StepTO[] getBlockingSteps(@WebParam(name="taskId")
123: long taskId) throws EmForgeException;
124:
125: /** Add comment for specified Task
126: *
127: * @return created Comment object
128: */
129: Boolean addComment(@WebParam(name="taskId")
130: long taskId, @WebParam(name="comment")
131: String comment) throws EmForgeException;
132:
133: /** Returns Comments for Specified Task
134: *
135: * @param taskId - id of task we need to get comments
136: * @return array of task comments
137: */
138: CommentTO[] getTaskComments(@WebParam(name="taskId")
139: long taskId) throws EmForgeException;
140:
141: /** Returns start step for specified workflow.
142: *
143: * It is "empty" task - it's id is null since it is not created.
144: * It should be used for filling required variables and any other required information,
145: * getting information about transition, and starting new task later with passing this step back
146: *
147: * @param name - started workflow name
148: * @param version - started workflow version
149: * @param projectName - name of project, for which workflow is created
150: * @return
151: */
152: StepTO getWorkflowStartStep(@WebParam(name="name")
153: String name, @WebParam(name="version")
154: int version, @WebParam(name="projectName")
155: String projectName) throws EmForgeException;
156:
157: /** Starts new task
158: *
159: * @param startStep - information about started task like: priority, variable values,
160: * required by start task, dueDate and so on
161: * @param transitionName - name of transition, should be used for completing start-task
162: * @param tempPageName - in case then description and attachments was specified for task,
163: * they were stored in temporare Wiki-Page. this param contains name of this page
164: * May be empty
165: *
166: * @todo tempPageName should be passed n startStep (somehow), and this method should receive content for description
167: *
168: * @return created task
169: */
170: TaskTO startTask(@WebParam(name="startStep")
171: StepTO startStep, @WebParam(name="transitionName")
172: String transitionName, @WebParam(name="tempPageName")
173: String tempPageName) throws EmForgeException;
174:
175: /** Stop Specified Task
176: *
177: * @param taskId - id of task we need to stop
178: * @param comment - comment specified why task is stopped (may be empty)
179: *
180: * @return true is task stopped, othervise false
181: */
182: Boolean stopTask(@WebParam(name="taskId")
183: long taskId, @WebParam(name="comment")
184: String comment) throws EmForgeException;
185:
186: /** Save task
187: *
188: *
189: * @param task - task to be saved with all required variables set
190: * @param comment - comment related to changes
191: * @return - true if saving success
192: * @throws EmForgeException
193: */
194: Boolean saveTask(@WebParam(name="task")
195: TaskTO task, @WebParam(name="comment")
196: String comment) throws EmForgeException;
197:
198: /** Assign step to new owner
199: *
200: * @param step
201: * @param newActor
202: * @param comment
203: * @return
204: * @throws EmForgeException
205: */
206: StepTO assignStep(@WebParam(name="step")
207: StepTO step, @WebParam(name="newActor")
208: String newActor, @WebParam(name="comment")
209: String comment) throws EmForgeException;
210:
211: /** Change Step Priority
212: *
213: * @param step
214: * @param newPriority
215: * @param comment
216: * @return
217: * @throws EmForgeException
218: */
219: StepTO changeStepPriority(@WebParam(name="step")
220: StepTO step, @WebParam(name="newPriority")
221: PriorityTO newPriority, @WebParam(name="comment")
222: String comment) throws EmForgeException;
223:
224: /** Complete step
225: *
226: *
227: * @param step - step to be completed with all required variables set
228: * @param transitionName - transaction name, should be used for completion
229: * @param comment - comment related to completion
230: * @return - new state of Task processed
231: * @throws EmForgeException
232: */
233: TaskTO completeStep(@WebParam(name="startStep")
234: StepTO step, @WebParam(name="transitionName")
235: String transitionName, @WebParam(name="comment")
236: String comment) throws EmForgeException;
237:
238: /** Returns list of currently active subtasks for specified task
239: *
240: * @param taskId - parent task id
241: * @return list of active sub-tasks
242: */
243: TaskTO[] getBlockingSubTasks(@WebParam(name="taskId")
244: long taskId) throws EmForgeException;
245:
246: /** Returns list of finished subtasks for specified task
247: *
248: * @param taskId - parent task id
249: * @return list of finished sub-tasks
250: */
251: TaskTO[] getFinishedSubTasks(@WebParam(name="taskId")
252: long taskId) throws EmForgeException;
253:
254: /** Create subtask for specified step
255: *
256: * @param parentStepId - step used as parent step for new task
257: * @param startStep - starting information for subtask
258: * @param transitionName - transition should be used for finishing start task
259: * @param tempPageName - temprorary page name, used for storing description and attachments
260: * @return
261: * @throws EmForgeException
262: */
263: TaskTO startSubTask(@WebParam(name="parentStepId")
264: long parentStepId, @WebParam(name="startStep")
265: StepTO startStep, @WebParam(name="transitionName")
266: String transitionName, @WebParam(name="tempPageName")
267: String tempPageName) throws EmForgeException;
268:
269: /** Get task history
270: *
271: * @param taskId - task id to get history
272: * @return
273: * @throws EmForgeException
274: */
275: HistoryTO[] getTaskHistory(@WebParam(name="taskId")
276: long taskId) throws EmForgeException;
277:
278: /** Is it possible for currently logged user request a status for specified step
279: *
280: * @param stepId - step id to check
281: * @return true if it is possible to request status
282: *
283: * @throws EmForgeException
284: */
285: Boolean isPossibleRequestStatus(@WebParam(name="stepId")
286: long stepId) throws EmForgeException;
287:
288: /** Request status for specified step
289: *
290: * @param stepId - step to request
291: * @param request - request message
292: * @return
293: * @throws EmForgeException
294: */
295: Boolean requestStatus(@WebParam(name="taskId")
296: long stepId, @WebParam(name="request")
297: String request) throws EmForgeException;
298:
299: /** Find tasks
300: *
301: * We will have reporting service, allowed us to generate reports for any criteria.
302: * But - we will need also some easy-reporting - there we will able find and display list of tasks
303: *
304: * This is initial version of method, implemented this 'easy-reporting' it's interface will be changed in future
305: * to support more options for search
306: * @param milestoneName -
307: * @param status
308: * @param includeSubTasks
309: * @return
310: */
311: List<TaskTO> findTasks(@WebParam(name="milestoneName")
312: String milestoneName, @WebParam(name="taskStatus")
313: TaskStatus taskStatus, @WebParam(name="includeSubTasks")
314: boolean includeSubTasks) throws EmForgeException;
315:
316: /** is current user allowed to read specified task
317: *
318: * @param stepId
319: * @return
320: */
321: boolean canReadTask(@WebParam(name="taskId")
322: long stepId);
323:
324: /** is current user allowed to complete specified step
325: *
326: * @param stepId
327: * @return
328: */
329: boolean canCompleteStep(@WebParam(name="step")
330: StepTO step);
331:
332: /** Is Current User allowed to edit task description
333: *
334: * @param taskId
335: * @return
336: */
337: boolean canEditTaskDescription(@WebParam(name="task")
338: TaskTO task);
339:
340: /** Is Current user allowed to add attachment for task
341: *
342: * @param taskId
343: * @return
344: */
345: boolean canAddAttachment(@WebParam(name="taskId")
346: long taskId);
347:
348: /** Is current user allowed to add comment for the task
349: *
350: * @param taskId
351: * @return
352: */
353: boolean canCommentTask(@WebParam(name="taskId")
354: long taskId);
355:
356: /** Is current user allowed to close the specified task
357: *
358: * @param taskId
359: * @return
360: */
361: boolean canStopTask(@WebParam(name="task")
362: TaskTO task);
363:
364: /** Is current user allowed to change the task
365: *
366: * @param taskId
367: * @return
368: */
369: boolean canChangeTask(@WebParam(name="task")
370: TaskTO task);
371:
372: /** Is current user allowed to change the step
373: *
374: * @param stepId
375: * @return
376: */
377: boolean canChangeStep(@WebParam(name="step")
378: StepTO step);
379:
380: /** Is Current user allowed to reassign the steps for specified task
381: *
382: * @param taskId
383: * @return
384: */
385: boolean canReassignSteps(@WebParam(name="task")
386: TaskTO task);
387:
388: /** Is current user allowed to add new workflows
389: *
390: * @return
391: */
392: boolean canAddNewWorkflow();
393:
394: /** Is Current user allowed to start new tasks for specified project
395: *
396: * @param projectName
397: * @return
398: */
399: boolean canStartNewTask(@WebParam(name="projectName")
400: String projectName);
401:
402: /** Method used in Process Icon Servlet
403: *
404: * @param workflowId
405: * @return
406: */
407: byte[] getWorkflowIcon(@WebParam(name="workflowId")
408: long workflowId);
409:
410: /** Very specific method
411: *
412: * This code got from jBPM and used for image generation
413: * It should be used onli inside ProcessImageComponent
414: *
415: * @param writer
416: * @param i_workflow
417: * @param i_task
418: * @param i_step
419: * @throws DocumentException
420: * @throws IOException
421: *
422: * @todo REFACTOR IT! it is currently ugly
423: */
424: String writeWorkflowImageTable(WorkflowTO i_workflow,
425: TaskTO i_task, StepTO i_step) throws EmForgeException;
426:
427: /** Returns workflow image
428: *
429: * @param workflowId
430: * @return
431: */
432: byte[] getWorkflowImage(long workflowId);
433:
434: }
|