1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.kernel.workflow;
16  
17  import com.liferay.portal.kernel.util.OrderByComparator;
18  
19  import java.io.Serializable;
20  
21  import java.util.List;
22  import java.util.Map;
23  
24  /**
25   * <a href="WorkflowInstanceManagerUtil.java.html"><b><i>View Source</i></b></a>
26   *
27   * @author Micha Kiener
28   * @author Shuyang Zhou
29   * @author Brian Wing Shun Chan
30   */
31  public class WorkflowInstanceManagerUtil {
32  
33      public static void deleteWorkflowInstance(
34              long companyId, long workflowInstanceId)
35          throws WorkflowException {
36  
37          _workflowInstanceManager.deleteWorkflowInstance(
38              companyId, workflowInstanceId);
39      }
40  
41      public static List<String> getNextTransitionNames(
42              long companyId, long userId, long workflowInstanceId)
43          throws WorkflowException {
44  
45          return _workflowInstanceManager.getNextTransitionNames(
46              companyId, userId, workflowInstanceId);
47      }
48  
49      public static WorkflowInstance getWorkflowInstance(
50              long companyId, long workflowInstanceId)
51          throws WorkflowException {
52  
53          return _workflowInstanceManager.getWorkflowInstance(
54              companyId, workflowInstanceId);
55      }
56  
57      public static int getWorkflowInstanceCount(
58              long companyId, String workflowDefinitionName,
59              Integer workflowDefinitionVersion, Boolean completed)
60          throws WorkflowException {
61  
62          return _workflowInstanceManager.getWorkflowInstanceCount(
63              companyId, workflowDefinitionName, workflowDefinitionVersion,
64              completed);
65      }
66  
67      public static WorkflowInstanceManager getWorkflowInstanceManager() {
68          return _workflowInstanceManager;
69      }
70  
71      public static List<WorkflowInstance> getWorkflowInstances(
72              long companyId, String workflowDefinitionName,
73              Integer workflowDefinitionVersion, Boolean completed, int start,
74              int end, OrderByComparator orderByComparator)
75          throws WorkflowException {
76  
77          return _workflowInstanceManager.getWorkflowInstances(
78              companyId, workflowDefinitionName,
79              workflowDefinitionVersion, completed, start,
80              end, orderByComparator);
81      }
82  
83      public static WorkflowInstance signalWorkflowInstance(
84              long companyId, long userId, long workflowInstanceId,
85              String transitionName, Map<String, Serializable> context)
86          throws WorkflowException {
87  
88          return _workflowInstanceManager.signalWorkflowInstance(
89              companyId, userId, workflowInstanceId, transitionName, context);
90      }
91  
92      public static WorkflowInstance startWorkflowInstance(
93              long companyId, long userId, String workflowDefinitionName,
94              Integer workflowDefinitionVersion, String transitionName,
95              Map<String, Serializable> context)
96          throws WorkflowException {
97  
98          return _workflowInstanceManager.startWorkflowInstance(
99              companyId, userId, workflowDefinitionName,
100             workflowDefinitionVersion, transitionName, context);
101     }
102 
103     public static WorkflowInstance updateContext(
104             long companyId, long workflowInstanceId,
105             Map<String, Serializable> context)
106         throws WorkflowException {
107 
108         return _workflowInstanceManager.updateContext(
109             companyId, workflowInstanceId, context);
110     }
111 
112     public void setWorkflowInstanceManager(
113         WorkflowInstanceManager workflowInstanceManager) {
114 
115         _workflowInstanceManager = workflowInstanceManager;
116     }
117 
118     private static WorkflowInstanceManager _workflowInstanceManager;
119 
120 }