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.List;
022    import java.util.Map;
023    
024    /**
025     * @author Micha Kiener
026     * @author Shuyang Zhou
027     * @author Brian Wing Shun Chan
028     * @author Marcellus Tavares
029     */
030    public class WorkflowInstanceManagerUtil {
031    
032            public static void deleteWorkflowInstance(
033                            long companyId, long workflowInstanceId)
034                    throws WorkflowException {
035    
036                    _workflowInstanceManager.deleteWorkflowInstance(
037                            companyId, workflowInstanceId);
038            }
039    
040            public static List<String> getNextTransitionNames(
041                            long companyId, long userId, long workflowInstanceId)
042                    throws WorkflowException {
043    
044                    return _workflowInstanceManager.getNextTransitionNames(
045                            companyId, userId, workflowInstanceId);
046            }
047    
048            public static WorkflowInstance getWorkflowInstance(
049                            long companyId, long workflowInstanceId)
050                    throws WorkflowException {
051    
052                    return _workflowInstanceManager.getWorkflowInstance(
053                            companyId, workflowInstanceId);
054            }
055    
056            public static int getWorkflowInstanceCount(
057                            long companyId, Long userId, String assetClassName,
058                            Long assetClassPK, Boolean completed)
059                    throws WorkflowException {
060    
061                    return _workflowInstanceManager.getWorkflowInstanceCount(
062                            companyId, userId, assetClassName, assetClassPK, completed);
063            }
064    
065            public static int getWorkflowInstanceCount(
066                            long companyId, Long userId, String[] assetClassNames,
067                            Boolean completed)
068                    throws WorkflowException {
069    
070                    return _workflowInstanceManager.getWorkflowInstanceCount(
071                            companyId, userId, assetClassNames, completed);
072            }
073    
074            public static int getWorkflowInstanceCount(
075                            long companyId, String workflowDefinitionName,
076                            Integer workflowDefinitionVersion, Boolean completed)
077                    throws WorkflowException {
078    
079                    return _workflowInstanceManager.getWorkflowInstanceCount(
080                            companyId, workflowDefinitionName, workflowDefinitionVersion,
081                            completed);
082            }
083    
084            public static WorkflowInstanceManager getWorkflowInstanceManager() {
085                    return _workflowInstanceManager;
086            }
087    
088            public static List<WorkflowInstance> getWorkflowInstances(
089                            long companyId, Long userId, String assetClassName,
090                            Long assetClassPK, Boolean completed, int start, int end,
091                            OrderByComparator orderByComparator)
092                    throws WorkflowException {
093    
094                    return _workflowInstanceManager.getWorkflowInstances(
095                            companyId, userId, assetClassName, assetClassPK, completed, start,
096                            end, orderByComparator);
097            }
098    
099            public static List<WorkflowInstance> getWorkflowInstances(
100                            long companyId, Long userId, String[] assetClassNames,
101                            Boolean completed, int start, int end,
102                            OrderByComparator orderByComparator)
103                    throws WorkflowException {
104    
105                    return _workflowInstanceManager.getWorkflowInstances(
106                            companyId, userId, assetClassNames, completed, start, end,
107                            orderByComparator);
108            }
109    
110            public static List<WorkflowInstance> getWorkflowInstances(
111                            long companyId, String workflowDefinitionName,
112                            Integer workflowDefinitionVersion, Boolean completed, int start,
113                            int end, OrderByComparator orderByComparator)
114                    throws WorkflowException {
115    
116                    return _workflowInstanceManager.getWorkflowInstances(
117                            companyId, workflowDefinitionName, workflowDefinitionVersion,
118                            completed, start, end, orderByComparator);
119            }
120    
121            public static WorkflowInstance signalWorkflowInstance(
122                            long companyId, long userId, long workflowInstanceId,
123                            String transitionName, Map<String, Serializable> workflowContext)
124                    throws WorkflowException {
125    
126                    return _workflowInstanceManager.signalWorkflowInstance(
127                            companyId, userId, workflowInstanceId, transitionName,
128                            workflowContext);
129            }
130    
131            public static WorkflowInstance startWorkflowInstance(
132                            long companyId, long groupId, long userId,
133                            String workflowDefinitionName, Integer workflowDefinitionVersion,
134                            String transitionName, Map<String, Serializable> workflowContext)
135                    throws WorkflowException {
136    
137                    return _workflowInstanceManager.startWorkflowInstance(
138                            companyId, groupId, userId, workflowDefinitionName,
139                            workflowDefinitionVersion, transitionName, workflowContext);
140            }
141    
142            public static WorkflowInstance updateWorkflowContext(
143                            long companyId, long workflowInstanceId,
144                            Map<String, Serializable> workflowContext)
145                    throws WorkflowException {
146    
147                    return _workflowInstanceManager.updateWorkflowContext(
148                            companyId, workflowInstanceId, workflowContext);
149            }
150    
151            public void setWorkflowInstanceManager(
152                    WorkflowInstanceManager workflowInstanceManager) {
153    
154                    _workflowInstanceManager = workflowInstanceManager;
155            }
156    
157            private static WorkflowInstanceManager _workflowInstanceManager;
158    
159    }