001    /**
002     * Copyright (c) 2000-present 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.security.pacl.permission.PortalRuntimePermission;
018    import com.liferay.portal.kernel.util.OrderByComparator;
019    
020    import java.io.Serializable;
021    
022    import java.util.Date;
023    import java.util.List;
024    import java.util.Map;
025    
026    /**
027     * @author Micha Kiener
028     * @author Shuyang Zhou
029     * @author Brian Wing Shun Chan
030     * @author Marcellus Tavares
031     * @author Raymond Aug??
032     */
033    public class WorkflowTaskManagerUtil {
034    
035            public static WorkflowTask assignWorkflowTaskToRole(
036                            long companyId, long userId, long workflowTaskId, long roleId,
037                            String comment, Date dueDate,
038                            Map<String, Serializable> workflowContext)
039                    throws WorkflowException {
040    
041                    return getWorkflowTaskManager().assignWorkflowTaskToRole(
042                            companyId, userId, workflowTaskId, roleId, comment, dueDate,
043                            workflowContext);
044            }
045    
046            public static WorkflowTask assignWorkflowTaskToUser(
047                            long companyId, long userId, long workflowTaskId,
048                            long assigneeUserId, String comment, Date dueDate,
049                            Map<String, Serializable> workflowContext)
050                    throws WorkflowException {
051    
052                    return getWorkflowTaskManager().assignWorkflowTaskToUser(
053                            companyId, userId, workflowTaskId, assigneeUserId, comment, dueDate,
054                            workflowContext);
055            }
056    
057            public static WorkflowTask completeWorkflowTask(
058                            long companyId, long userId, long workflowTaskId,
059                            String transitionName, String comment,
060                            Map<String, Serializable> workflowContext)
061                    throws WorkflowException {
062    
063                    return getWorkflowTaskManager().completeWorkflowTask(
064                            companyId, userId, workflowTaskId, transitionName, comment,
065                            workflowContext);
066            }
067    
068            public static List<String> getNextTransitionNames(
069                            long companyId, long userId, long workflowTaskId)
070                    throws WorkflowException {
071    
072                    return getWorkflowTaskManager().getNextTransitionNames(
073                            companyId, userId, workflowTaskId);
074            }
075    
076            public static long[] getPooledActorsIds(long companyId, long workflowTaskId)
077                    throws WorkflowException {
078    
079                    return getWorkflowTaskManager().getPooledActorsIds(
080                            companyId, workflowTaskId);
081            }
082    
083            public static WorkflowTask getWorkflowTask(
084                            long companyId, long workflowTaskId)
085                    throws WorkflowException {
086    
087                    return getWorkflowTaskManager().getWorkflowTask(
088                            companyId, workflowTaskId);
089            }
090    
091            public static int getWorkflowTaskCount(long companyId, Boolean completed)
092                    throws WorkflowException {
093    
094                    return getWorkflowTaskManager().getWorkflowTaskCount(
095                            companyId, completed);
096            }
097    
098            public static int getWorkflowTaskCountByRole(
099                            long companyId, long roleId, Boolean completed)
100                    throws WorkflowException {
101    
102                    return getWorkflowTaskManager().getWorkflowTaskCountByRole(
103                            companyId, roleId, completed);
104            }
105    
106            public static int getWorkflowTaskCountBySubmittingUser(
107                            long companyId, long userId, Boolean completed)
108                    throws WorkflowException {
109    
110                    return getWorkflowTaskManager().getWorkflowTaskCountBySubmittingUser(
111                            companyId, userId, completed);
112            }
113    
114            public static int getWorkflowTaskCountByUser(
115                            long companyId, long userId, Boolean completed)
116                    throws WorkflowException {
117    
118                    return getWorkflowTaskManager().getWorkflowTaskCountByUser(
119                            companyId, userId, completed);
120            }
121    
122            public static int getWorkflowTaskCountByUserRoles(
123                            long companyId, long userId, Boolean completed)
124                    throws WorkflowException {
125    
126                    return getWorkflowTaskManager().getWorkflowTaskCountByUserRoles(
127                            companyId, userId, completed);
128            }
129    
130            public static int getWorkflowTaskCountByWorkflowInstance(
131                            long companyId, Long userId, long workflowInstanceId,
132                            Boolean completed)
133                    throws WorkflowException {
134    
135                    return getWorkflowTaskManager().getWorkflowTaskCountByWorkflowInstance(
136                            companyId, userId, workflowInstanceId, completed);
137            }
138    
139            public static WorkflowTaskManager getWorkflowTaskManager() {
140                    PortalRuntimePermission.checkGetBeanProperty(
141                            WorkflowTaskManagerUtil.class);
142    
143                    return _workflowTaskManager;
144            }
145    
146            public static List<WorkflowTask> getWorkflowTasks(
147                            long companyId, Boolean completed, int start, int end,
148                            OrderByComparator<WorkflowTask> orderByComparator)
149                    throws WorkflowException {
150    
151                    return getWorkflowTaskManager().getWorkflowTasks(
152                            companyId, completed, start, end, orderByComparator);
153            }
154    
155            public static List<WorkflowTask> getWorkflowTasksByRole(
156                            long companyId, long roleId, Boolean completed, int start, int end,
157                            OrderByComparator<WorkflowTask> orderByComparator)
158                    throws WorkflowException {
159    
160                    return getWorkflowTaskManager().getWorkflowTasksByRole(
161                            companyId, roleId, completed, start, end, orderByComparator);
162            }
163    
164            public static List<WorkflowTask> getWorkflowTasksBySubmittingUser(
165                            long companyId, long userId, Boolean completed, int start, int end,
166                            OrderByComparator<WorkflowTask> orderByComparator)
167                    throws WorkflowException {
168    
169                    return getWorkflowTaskManager().getWorkflowTasksBySubmittingUser(
170                            companyId, userId, completed, start, end, orderByComparator);
171            }
172    
173            public static List<WorkflowTask> getWorkflowTasksByUser(
174                            long companyId, long userId, Boolean completed, int start, int end,
175                            OrderByComparator<WorkflowTask> orderByComparator)
176                    throws WorkflowException {
177    
178                    return getWorkflowTaskManager().getWorkflowTasksByUser(
179                            companyId, userId, completed, start, end, orderByComparator);
180            }
181    
182            public static List<WorkflowTask> getWorkflowTasksByUserRoles(
183                            long companyId, long userId, Boolean completed, int start, int end,
184                            OrderByComparator<WorkflowTask> orderByComparator)
185                    throws WorkflowException {
186    
187                    return getWorkflowTaskManager().getWorkflowTasksByUserRoles(
188                            companyId, userId, completed, start, end, orderByComparator);
189            }
190    
191            public static List<WorkflowTask> getWorkflowTasksByWorkflowInstance(
192                            long companyId, Long userId, long workflowInstanceId,
193                            Boolean completed, int start, int end,
194                            OrderByComparator<WorkflowTask> orderByComparator)
195                    throws WorkflowException {
196    
197                    return getWorkflowTaskManager().getWorkflowTasksByWorkflowInstance(
198                            companyId, userId, workflowInstanceId, completed, start, end,
199                            orderByComparator);
200            }
201    
202            public static List<WorkflowTask> search(
203                            long companyId, long userId, String keywords, Boolean completed,
204                            Boolean searchByUserRoles, int start, int end,
205                            OrderByComparator<WorkflowTask> orderByComparator)
206                    throws WorkflowException {
207    
208                    return getWorkflowTaskManager().search(
209                            companyId, userId, keywords, completed, searchByUserRoles, start,
210                            end, orderByComparator);
211            }
212    
213            public static List<WorkflowTask> search(
214                            long companyId, long userId, String taskName, String assetType,
215                            Long[] assetPrimaryKey, Date dueDateGT, Date dueDateLT,
216                            Boolean completed, Boolean searchByUserRoles, boolean andOperator,
217                            int start, int end,
218                            OrderByComparator<WorkflowTask> orderByComparator)
219                    throws WorkflowException {
220    
221                    return getWorkflowTaskManager().search(
222                            companyId, userId, taskName, assetType, assetPrimaryKey, dueDateGT,
223                            dueDateLT, completed, searchByUserRoles, andOperator, start, end,
224                            orderByComparator);
225            }
226    
227            public static List<WorkflowTask> search(
228                            long companyId, long userId, String keywords, String[] assetTypes,
229                            Boolean completed, Boolean searchByUserRoles, int start, int end,
230                            OrderByComparator<WorkflowTask> orderByComparator)
231                    throws WorkflowException {
232    
233                    return getWorkflowTaskManager().search(
234                            companyId, userId, keywords, assetTypes, completed,
235                            searchByUserRoles, start, end, orderByComparator);
236            }
237    
238            public static int searchCount(
239                            long companyId, long userId, String keywords, Boolean completed,
240                            Boolean searchByUserRoles)
241                    throws WorkflowException {
242    
243                    return getWorkflowTaskManager().searchCount(
244                            companyId, userId, keywords, completed, searchByUserRoles);
245            }
246    
247            public static int searchCount(
248                            long companyId, long userId, String taskName, String assetType,
249                            Long[] assetPrimaryKey, Date dueDateGT, Date dueDateLT,
250                            Boolean completed, Boolean searchByUserRoles, boolean andOperator)
251                    throws WorkflowException {
252    
253                    return getWorkflowTaskManager().searchCount(
254                            companyId, userId, taskName, assetType, assetPrimaryKey, dueDateGT,
255                            dueDateLT, completed, searchByUserRoles, andOperator);
256            }
257    
258            public static int searchCount(
259                            long companyId, long userId, String keywords, String[] assetTypes,
260                            Boolean completed, Boolean searchByUserRoles)
261                    throws WorkflowException {
262    
263                    return getWorkflowTaskManager().searchCount(
264                            companyId, userId, keywords, assetTypes, completed,
265                            searchByUserRoles);
266            }
267    
268            public static WorkflowTask updateDueDate(
269                            long companyId, long userId, long workflowTaskId, String comment,
270                            Date dueDate)
271                    throws WorkflowException {
272    
273                    return getWorkflowTaskManager().updateDueDate(
274                            companyId, userId, workflowTaskId, comment, dueDate);
275            }
276    
277            public void setWorkflowTaskManager(
278                    WorkflowTaskManager workflowTaskManager) {
279    
280                    PortalRuntimePermission.checkSetBeanProperty(getClass());
281    
282                    _workflowTaskManager = workflowTaskManager;
283            }
284    
285            private static WorkflowTaskManager _workflowTaskManager;
286    
287    }