001    /**
002     * Copyright (c) 2000-2011 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.InputStream;
020    
021    import java.util.List;
022    
023    /**
024     * @author Micha Kiener
025     * @author Shuyang Zhou
026     * @author Brian Wing Shun Chan
027     * @author Marcellus Tavares
028     * @author Eduardo Lundgren
029     */
030    public class WorkflowDefinitionManagerUtil {
031    
032            public static WorkflowDefinition deployWorkflowDefinition(
033                            long companyId, long userId, String title, InputStream inputStream)
034                    throws WorkflowException {
035    
036                    return _workflowDefinitionManager.deployWorkflowDefinition(
037                            companyId, userId, title, inputStream);
038            }
039    
040            public static int getActiveWorkflowDefinitionCount(long companyId)
041                    throws WorkflowException {
042    
043                    return _workflowDefinitionManager.getActiveWorkflowDefinitionCount(
044                            companyId);
045            }
046    
047            public static int getActiveWorkflowDefinitionCount(
048                            long companyId, String name)
049                    throws WorkflowException {
050    
051                    return _workflowDefinitionManager.getActiveWorkflowDefinitionCount(
052                            companyId, name);
053            }
054    
055            public static List<WorkflowDefinition> getActiveWorkflowDefinitions(
056                            long companyId, int start, int end,
057                            OrderByComparator orderByComparator)
058                    throws WorkflowException {
059    
060                    return _workflowDefinitionManager.getActiveWorkflowDefinitions(
061                            companyId, start, end,orderByComparator);
062            }
063    
064            public static List<WorkflowDefinition> getActiveWorkflowDefinitions(
065                            long companyId, String name, int start, int end,
066                            OrderByComparator orderByComparator)
067                    throws WorkflowException {
068    
069                    return _workflowDefinitionManager.getActiveWorkflowDefinitions(
070                            companyId, name, start, end,orderByComparator);
071            }
072    
073            public static WorkflowDefinition getLatestKaleoDefinition(
074                            long companyId, String name)
075                    throws WorkflowException {
076    
077                    return _workflowDefinitionManager.getLatestKaleoDefinition(
078                            companyId, name);
079            }
080    
081            public static WorkflowDefinition getWorkflowDefinition(
082                            long companyId, String name, int version)
083                    throws WorkflowException {
084    
085                    return _workflowDefinitionManager.getWorkflowDefinition(
086                            companyId, name, version);
087            }
088    
089            public static int getWorkflowDefinitionCount(long companyId)
090                    throws WorkflowException {
091    
092                    return _workflowDefinitionManager.getWorkflowDefinitionCount(companyId);
093            }
094    
095            public static int getWorkflowDefinitionCount(long companyId, String name)
096                    throws WorkflowException {
097    
098                    return _workflowDefinitionManager.getWorkflowDefinitionCount(
099                            companyId, name);
100            }
101    
102            public static WorkflowDefinitionManager getWorkflowDefinitionManager() {
103                    return _workflowDefinitionManager;
104            }
105    
106            public static List<WorkflowDefinition> getWorkflowDefinitions(
107                            long companyId, int start, int end,
108                            OrderByComparator orderByComparator)
109                    throws WorkflowException {
110    
111                    return _workflowDefinitionManager.getWorkflowDefinitions(
112                            companyId, start, end, orderByComparator);
113            }
114    
115            public static List<WorkflowDefinition> getWorkflowDefinitions(
116                            long companyId, String name, int start, int end,
117                            OrderByComparator orderByComparator)
118                    throws WorkflowException {
119    
120                    return _workflowDefinitionManager.getWorkflowDefinitions(
121                            companyId, name, start, end, orderByComparator);
122            }
123    
124            public static void undeployWorkflowDefinition(
125                            long companyId, long userId, String name, int version)
126                    throws WorkflowException {
127    
128                    _workflowDefinitionManager.undeployWorkflowDefinition(
129                            companyId, userId, name, version);
130            }
131    
132            public static WorkflowDefinition updateActive(
133                            long companyId, long userId, String name, int version,
134                            boolean active)
135                    throws WorkflowException {
136    
137                    return _workflowDefinitionManager.updateActive(
138                            companyId, userId, name, version, active);
139            }
140    
141            public static WorkflowDefinition updateTitle(
142                            long companyId, long userId, String name, int version,
143                            String title)
144                    throws WorkflowException {
145    
146                    return _workflowDefinitionManager.updateTitle(
147                            companyId, userId, name, version, title);
148            }
149    
150            public void setWorkflowDefinitionManager(
151                    WorkflowDefinitionManager workflowDefinitionManager) {
152    
153                    _workflowDefinitionManager = workflowDefinitionManager;
154            }
155    
156            private static WorkflowDefinitionManager _workflowDefinitionManager;
157    
158    }