001    /**
002     * Copyright (c) 2000-2010 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     */
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    }