1 package org.apache.fulcrum.osworkflow;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 import com.opensymphony.workflow.Workflow;
25 import com.opensymphony.workflow.WorkflowException;
26
27
28 /***
29 * This is a Facade class for WorkflowService.
30 *
31 * This class provides static methods that call related methods of the
32 * implementation of the WorkflowService used by the System.
33 *
34 * @version $Id: WorkflowServiceFacade.java 535465 2007-05-05 06:58:06Z tv $
35 */
36 public class WorkflowServiceFacade
37 {
38
39 /*** Static instance of the WorkflowService. */
40 private static WorkflowService workflowService;
41
42 /***
43 * Utility method for accessing the service
44 * implementation
45 *
46 * @return a WorkflowService implementation instance
47 */
48 private static WorkflowService getService()
49 {
50 if(workflowService==null){
51 throw new RuntimeException("Workflow Service has not been set yet.");
52 }
53 return workflowService;
54 }
55 static void setWorkflowService(WorkflowService service)
56 {
57 workflowService = service;
58 }
59
60 /*** Retrives a workflow based on the caller */
61 public static Workflow retrieveWorkflow(String caller)
62 {
63 return getService().retrieveWorkflow(caller);
64 }
65
66 /*** For a specific caller and status, return all the workflows. */
67 public static long[] retrieveWorkflows(String caller, String status)
68 throws WorkflowException
69 {
70 return getService().retrieveWorkflows(caller, status);
71 }
72 }