001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.workflow;
016    
017    import com.liferay.portal.kernel.util.OrderByComparator;
018    
019    import java.io.Serializable;
020    
021    import java.util.Date;
022    import java.util.List;
023    import java.util.Map;
024    
025    /**
026     * @author Micha Kiener
027     * @author Shuyang Zhou
028     * @author Brian Wing Shun Chan
029     * @author Marcellus Tavares
030     */
031    public class WorkflowTaskManagerUtil {
032    
033            public static WorkflowTask assignWorkflowTaskToRole(
034                            long companyId, long userId, long workflowTaskId, long roleId,
035                            String comment, Date dueDate,
036                            Map<String, Serializable> workflowContext)
037                    throws WorkflowException {
038    
039                    return _workflowTaskManager.assignWorkflowTaskToRole(
040                            companyId, userId, workflowTaskId, roleId, comment, dueDate,
041                            workflowContext);
042            }
043    
044            public static WorkflowTask assignWorkflowTaskToUser(
045                            long companyId, long userId, long workflowTaskId,
046                            long assigneeUserId, String comment, Date dueDate,
047                            Map<String, Serializable> workflowContext)
048                    throws WorkflowException {
049    
050                    return _workflowTaskManager.assignWorkflowTaskToUser(
051                            companyId, userId, workflowTaskId, assigneeUserId, comment, dueDate,
052                            workflowContext);
053            }
054    
055            public static WorkflowTask completeWorkflowTask(
056                            long companyId, long userId, long workflowTaskId,
057                            String transitionName, String comment,
058                            Map<String, Serializable> workflowContext)
059                    throws WorkflowException {
060    
061                    return _workflowTaskManager.completeWorkflowTask(
062                            companyId, userId, workflowTaskId, transitionName, comment,
063                            workflowContext);
064            }
065    
066            public static List<String> getNextTransitionNames(
067                            long companyId, long userId, long workflowTaskId)
068                    throws WorkflowException {
069    
070                    return _workflowTaskManager.getNextTransitionNames(
071                            companyId, userId, workflowTaskId);
072            }
073    
074            public static long[] getPooledActorsIds(long companyId, long workflowTaskId)
075                    throws WorkflowException {
076    
077                    return _workflowTaskManager.getPooledActorsIds(
078                            companyId, workflowTaskId);
079            }
080    
081            public static WorkflowTask getWorkflowTask(
082                            long companyId, long workflowTaskId)
083                    throws WorkflowException {
084    
085                    return _workflowTaskManager.getWorkflowTask(companyId, workflowTaskId);
086            }
087    
088            public static int getWorkflowTaskCount(long companyId, Boolean completed)
089                    throws WorkflowException {
090    
091                    return _workflowTaskManager.getWorkflowTaskCount(companyId, completed);
092            }
093    
094            public static int getWorkflowTaskCountByRole(
095                            long companyId, long roleId, Boolean completed)
096                    throws WorkflowException {
097    
098                    return _workflowTaskManager.getWorkflowTaskCountByRole(
099                            companyId, roleId, completed);
100            }
101    
102            public static int getWorkflowTaskCountBySubmittingUser(
103                            long companyId, long userId, Boolean completed)
104                    throws WorkflowException {
105    
106                    return _workflowTaskManager.getWorkflowTaskCountBySubmittingUser(
107                            companyId, userId, completed);
108            }
109    
110            public static int getWorkflowTaskCountByUser(
111                            long companyId, long userId, Boolean completed)
112                    throws WorkflowException {
113    
114                    return _workflowTaskManager.getWorkflowTaskCountByUser(
115                            companyId, userId, completed);
116            }
117    
118            public static int getWorkflowTaskCountByUserRoles(
119                            long companyId, long userId, Boolean completed)
120                    throws WorkflowException {
121    
122                    return _workflowTaskManager.getWorkflowTaskCountByUserRoles(
123                            companyId, userId, completed);
124            }
125    
126            public static int getWorkflowTaskCountByWorkflowInstance(
127                            long companyId, Long userId, long workflowInstanceId,
128                            Boolean completed)
129                    throws WorkflowException {
130    
131                    return _workflowTaskManager.getWorkflowTaskCountByWorkflowInstance(
132                            companyId, userId, workflowInstanceId, completed);
133            }
134    
135            public static WorkflowTaskManager getWorkflowTaskManager() {
136                    return _workflowTaskManager;
137            }
138    
139            public static List<WorkflowTask> getWorkflowTasks(
140                            long companyId, Boolean completed, int start, int end,
141                            OrderByComparator orderByComparator)
142                    throws WorkflowException {
143    
144                    return _workflowTaskManager.getWorkflowTasks(
145                            companyId, completed, start, end, orderByComparator);
146            }
147    
148            public static List<WorkflowTask> getWorkflowTasksByRole(
149                            long companyId, long roleId, Boolean completed, int start, int end,
150                            OrderByComparator orderByComparator)
151                    throws WorkflowException {
152    
153                    return _workflowTaskManager.getWorkflowTasksByRole(
154                            companyId, roleId, completed, start, end, orderByComparator);
155            }
156    
157            public static List<WorkflowTask> getWorkflowTasksBySubmittingUser(
158                            long companyId, long userId, Boolean completed, int start, int end,
159                            OrderByComparator orderByComparator)
160                    throws WorkflowException {
161    
162                    return _workflowTaskManager.getWorkflowTasksBySubmittingUser(
163                            companyId, userId, completed, start, end, orderByComparator);
164            }
165    
166            public static List<WorkflowTask> getWorkflowTasksByUser(
167                            long companyId, long userId, Boolean completed, int start, int end,
168                            OrderByComparator orderByComparator)
169                    throws WorkflowException {
170    
171                    return _workflowTaskManager.getWorkflowTasksByUser(
172                            companyId, userId, completed, start, end, orderByComparator);
173            }
174    
175            public static List<WorkflowTask> getWorkflowTasksByUserRoles(
176                            long companyId, long userId, Boolean completed, int start, int end,
177                            OrderByComparator orderByComparator)
178                    throws WorkflowException {
179    
180                    return _workflowTaskManager.getWorkflowTasksByUserRoles(
181                            companyId, userId, completed, start, end, orderByComparator);
182            }
183    
184            public static List<WorkflowTask> getWorkflowTasksByWorkflowInstance(
185                            long companyId, Long userId, long workflowInstanceId,
186                            Boolean completed, int start, int end,
187                            OrderByComparator orderByComparator)
188                    throws WorkflowException {
189    
190                    return _workflowTaskManager.getWorkflowTasksByWorkflowInstance(
191                            companyId, userId, workflowInstanceId, completed, start, end,
192                            orderByComparator);
193            }
194    
195            public static List<WorkflowTask> search(
196                            long companyId, long userId, String keywords, Boolean completed,
197                            Boolean searchByUserRoles, int start, int end,
198                            OrderByComparator orderByComparator)
199                    throws WorkflowException {
200    
201                    return _workflowTaskManager.search(
202                            companyId, userId, keywords, completed, searchByUserRoles, start,
203                            end, orderByComparator);
204            }
205    
206            public static List<WorkflowTask> search(
207                            long companyId, long userId, String taskName, String assetType,
208                            Long[] assetPrimaryKey, Date dueDateGT, Date dueDateLT,
209                            Boolean completed, Boolean searchByUserRoles, boolean andOperator,
210                            int start, int end, OrderByComparator orderByComparator)
211                    throws WorkflowException {
212    
213                    return _workflowTaskManager.search(
214                            companyId, userId, taskName, assetType, assetPrimaryKey, dueDateGT,
215                            dueDateLT, completed, searchByUserRoles, andOperator, start, end,
216                            orderByComparator);
217            }
218    
219            public static List<WorkflowTask> search(
220                            long companyId, long userId, String keywords, String[] assetTypes,
221                            Boolean completed, Boolean searchByUserRoles, int start, int end,
222                            OrderByComparator orderByComparator)
223                    throws WorkflowException {
224    
225                    return _workflowTaskManager.search(
226                            companyId, userId, keywords, assetTypes, completed,
227                            searchByUserRoles, start, end, orderByComparator);
228            }
229    
230            public static int searchCount(
231                            long companyId, long userId, String keywords, Boolean completed,
232                            Boolean searchByUserRoles)
233                    throws WorkflowException {
234    
235                    return _workflowTaskManager.searchCount(
236                            companyId, userId, keywords, completed, searchByUserRoles);
237            }
238    
239            public static int searchCount(
240                    long companyId, long userId, String taskName, String assetType,
241                            Long[] assetPrimaryKey, Date dueDateGT, Date dueDateLT,
242                            Boolean completed, Boolean searchByUserRoles, boolean andOperator)
243                    throws WorkflowException {
244    
245                    return _workflowTaskManager.searchCount(
246                            companyId, userId, taskName, assetType, assetPrimaryKey, dueDateGT,
247                            dueDateLT, completed, searchByUserRoles, andOperator);
248            }
249    
250            public static int searchCount(
251                            long companyId, long userId, String keywords, String[] assetTypes,
252                            Boolean completed, Boolean searchByUserRoles)
253                    throws WorkflowException {
254    
255                    return _workflowTaskManager.searchCount(
256                            companyId, userId, keywords, assetTypes, completed,
257                            searchByUserRoles);
258            }
259    
260            public static WorkflowTask updateDueDate(
261                            long companyId, long userId, long workflowTaskId, String comment,
262                            Date dueDate)
263                    throws WorkflowException {
264    
265                    return _workflowTaskManager.updateDueDate(
266                            companyId, userId, workflowTaskId, comment, dueDate);
267            }
268    
269            public void setWorkflowTaskManager(
270                    WorkflowTaskManager workflowTaskManager) {
271    
272                    _workflowTaskManager = workflowTaskManager;
273            }
274    
275            private static WorkflowTaskManager _workflowTaskManager;
276    
277    }