001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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     */
029    public class WorkflowInstanceManagerUtil {
030    
031            public static void deleteWorkflowInstance(
032                            long companyId, long workflowInstanceId)
033                    throws WorkflowException {
034    
035                    _workflowInstanceManager.deleteWorkflowInstance(
036                            companyId, workflowInstanceId);
037            }
038    
039            public static List<String> getNextTransitionNames(
040                            long companyId, long userId, long workflowInstanceId)
041                    throws WorkflowException {
042    
043                    return _workflowInstanceManager.getNextTransitionNames(
044                            companyId, userId, workflowInstanceId);
045            }
046    
047            public static WorkflowInstance getWorkflowInstance(
048                            long companyId, long workflowInstanceId)
049                    throws WorkflowException {
050    
051                    return _workflowInstanceManager.getWorkflowInstance(
052                            companyId, workflowInstanceId);
053            }
054    
055            public static int getWorkflowInstanceCount(
056                            long companyId, Long userId, String assetClassName,
057                            Long assetClassPK, Boolean completed)
058                    throws WorkflowException {
059    
060                    return _workflowInstanceManager.getWorkflowInstanceCount(
061                            companyId, userId, assetClassName, assetClassPK, completed);
062            }
063    
064            public static int getWorkflowInstanceCount(
065                            long companyId, String workflowDefinitionName,
066                            Integer workflowDefinitionVersion, Boolean completed)
067                    throws WorkflowException {
068    
069                    return _workflowInstanceManager.getWorkflowInstanceCount(
070                            companyId, workflowDefinitionName, workflowDefinitionVersion,
071                            completed);
072            }
073    
074            public static WorkflowInstanceManager getWorkflowInstanceManager() {
075                    return _workflowInstanceManager;
076            }
077    
078            public static List<WorkflowInstance> getWorkflowInstances(
079                            long companyId, Long userId, String assetClassName,
080                            Long assetClassPK, Boolean completed, int start,
081                            int end, OrderByComparator orderByComparator)
082                    throws WorkflowException {
083    
084                    return _workflowInstanceManager.getWorkflowInstances(
085                            companyId, userId, assetClassName, assetClassPK,
086                            completed, start, end, orderByComparator);
087            }
088    
089            public static List<WorkflowInstance> getWorkflowInstances(
090                            long companyId, String workflowDefinitionName,
091                            Integer workflowDefinitionVersion, Boolean completed, int start,
092                            int end, OrderByComparator orderByComparator)
093                    throws WorkflowException {
094    
095                    return _workflowInstanceManager.getWorkflowInstances(
096                            companyId, workflowDefinitionName,
097                            workflowDefinitionVersion, completed, start,
098                            end, orderByComparator);
099            }
100    
101            public static WorkflowInstance signalWorkflowInstance(
102                            long companyId, long userId, long workflowInstanceId,
103                            String transitionName, Map<String, Serializable> workflowContext)
104                    throws WorkflowException {
105    
106                    return _workflowInstanceManager.signalWorkflowInstance(
107                            companyId, userId, workflowInstanceId, transitionName,
108                            workflowContext);
109            }
110    
111            public static WorkflowInstance startWorkflowInstance(
112                            long companyId, long groupId, long userId,
113                            String workflowDefinitionName, Integer workflowDefinitionVersion,
114                            String transitionName, Map<String, Serializable> workflowContext)
115                    throws WorkflowException {
116    
117                    return _workflowInstanceManager.startWorkflowInstance(
118                            companyId, groupId, userId, workflowDefinitionName,
119                            workflowDefinitionVersion, transitionName, workflowContext);
120            }
121    
122            public static WorkflowInstance updateWorkflowContext(
123                            long companyId, long workflowInstanceId,
124                            Map<String, Serializable> workflowContext)
125                    throws WorkflowException {
126    
127                    return _workflowInstanceManager.updateWorkflowContext(
128                            companyId, workflowInstanceId, workflowContext);
129            }
130    
131            public void setWorkflowInstanceManager(
132                    WorkflowInstanceManager workflowInstanceManager) {
133    
134                    _workflowInstanceManager = workflowInstanceManager;
135            }
136    
137            private static WorkflowInstanceManager _workflowInstanceManager;
138    
139    }