001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.workflow; 029 030import org.opencms.ade.publish.I_CmsVirtualProject; 031import org.opencms.ade.publish.shared.CmsProjectBean; 032import org.opencms.ade.publish.shared.CmsPublishListToken; 033import org.opencms.ade.publish.shared.CmsPublishOptions; 034import org.opencms.ade.publish.shared.CmsWorkflow; 035import org.opencms.ade.publish.shared.CmsWorkflowAction; 036import org.opencms.ade.publish.shared.CmsWorkflowResponse; 037import org.opencms.file.CmsObject; 038import org.opencms.file.CmsResource; 039import org.opencms.main.CmsException; 040import org.opencms.util.CmsUUID; 041 042import java.util.List; 043import java.util.Map; 044 045/** 046 * Workflow manager interface.<p> 047 */ 048public interface I_CmsWorkflowManager { 049 050 /** 051 * Creates the formatter for formatting the resources to be displayed to the user.<p> 052 * @param cms the CMS context to use 053 * @param workflow the current workflow 054 * @param options the publish options 055 * 056 * @return the publish resource formatter to use 057 */ 058 I_CmsPublishResourceFormatter createFormatter(CmsObject cms, CmsWorkflow workflow, CmsPublishOptions options); 059 060 /** 061 * Executes a workflow action for a publish list token instead of a resource list.<p> 062 * 063 * @param cms the CMS context to use 064 * @param action the action to perform 065 * @param token the publish list token to use 066 * 067 * @return the workflow response 068 * @throws CmsException if something goes wrong 069 070 */ 071 CmsWorkflowResponse executeAction(CmsObject cms, CmsWorkflowAction action, CmsPublishListToken token) 072 throws CmsException; 073 074 /** 075 * Executes a workflow action in the context of the current user.<p> 076 * 077 * @param userCms the current user's CMS context 078 * @param action the workflow action 079 * @param options the publish options 080 * @param resources the resources to be processed 081 * 082 * @return the workflow response for the executed action 083 * 084 * @throws CmsException if something goes wrong 085 */ 086 CmsWorkflowResponse executeAction( 087 CmsObject userCms, 088 CmsWorkflowAction action, 089 CmsPublishOptions options, 090 List<CmsResource> resources) 091 throws CmsException; 092 093 /** 094 * Returns the current user's manageable projects.<p> 095 * 096 * @param cms the CMS context to use 097 * @param params the publish parameters 098 * 099 * @return the current user's manageable projects 100 */ 101 List<CmsProjectBean> getManageableProjects(CmsObject cms, Map<String, String> params); 102 103 /** 104 * Gets the parameters of the workflow manager.<p> 105 * 106 * @return the configuration parameters of the workflow manager 107 */ 108 Map<String, String> getParameters(); 109 110 /** 111 * Gets a publish list token for the given parameters which can be used later to reconstruct the publish list.<p> 112 * 113 * @param cms the CMS context to use 114 * @param workflow the workflow 115 * @param options the publish options 116 * 117 * @return the publish list token 118 */ 119 CmsPublishListToken getPublishListToken(CmsObject cms, CmsWorkflow workflow, CmsPublishOptions options); 120 121 /** 122 * Gets the virtual project object identified by the given id.<p> 123 * 124 * @param projectId the virtual project id 125 * @return the virtual project object 126 */ 127 I_CmsVirtualProject getRealOrVirtualProject(CmsUUID projectId); 128 129 /** 130 * Gets the resource limit.<p> 131 * 132 * Publish lists which exceed this limit (counted before adding any related resources, siblings etc.) are not displayed to the user.<p> 133 * 134 * @return the resource limit 135 */ 136 int getResourceLimit(); 137 138 /** 139 * Gets the workflow id which should be used for a given workflow project.<p> 140 * 141 * @param projectId the project id 142 * 143 * @return the workflow id for the project 144 */ 145 String getWorkflowForWorkflowProject(CmsUUID projectId); 146 147 /** 148 * Returns the resources for the given workflow and project.<p> 149 * 150 * @param cms the user cms context 151 * @param workflow the workflow 152 * @param options the resource options 153 * @param canOverride flag to indicate whether the workflow manager should be able to override the selected workflow 154 * @param ignoreLimit true if the workflow manager's resource limit should be ignored 155 * 156 * @return the workflow resources 157 */ 158 CmsWorkflowResources getWorkflowResources( 159 CmsObject cms, 160 CmsWorkflow workflow, 161 CmsPublishOptions options, 162 boolean canOverride, 163 boolean ignoreLimit); 164 165 /** 166 * Returns the available workflows for the current user.<p> 167 * 168 * @param cms the user cms context 169 * 170 * @return the available workflows 171 */ 172 Map<String, CmsWorkflow> getWorkflows(CmsObject cms); 173 174 /** 175 * Initializes this workflow manager instance.<p> 176 * 177 * @param adminCms the CMS context with admin privileges 178 */ 179 void initialize(CmsObject adminCms); 180 181 /** 182 * Sets the configuration parameters of the workflow manager.<p> 183 * 184 * @param parameters the map of configuration parameters 185 */ 186 void setParameters(Map<String, String> parameters); 187 188}