Package org.opencms.workflow
Class CmsDefaultWorkflowManager
- java.lang.Object
-
- org.opencms.workflow.A_CmsWorkflowManager
-
- org.opencms.workflow.CmsDefaultWorkflowManager
-
- All Implemented Interfaces:
I_CmsWorkflowManager
- Direct Known Subclasses:
CmsExtendedWorkflowManager
public class CmsDefaultWorkflowManager extends A_CmsWorkflowManager
The default implementation of the workflow manager interface, which offers only publish functionality.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ACTION_FORCE_PUBLISH
The forced publish workflow action.static java.lang.String
ACTION_PUBLISH
The publish workflow action.static java.lang.String
ATTR_CHECK_PUBLISH_RESOURCE_LIMIT
If a request context attribute of this name is set, some internal methods used to collect lists of resources for publishing will 'give up' and throw an exception when the number of resources exceeds the resource limit of the workflow manager.static int
DEFAULT_RESOURCE_LIMIT
Default value for the maximum number of resources in the initial publish list.protected java.util.Map<CmsUUID,I_CmsVirtualProject>
m_virtualProjects
The map of registered virtual projects.static java.lang.String
PARAM_RESOURCE_LIMIT
The parameter name for the resource limit.static java.lang.String
WORKFLOW_PUBLISH
The name for the publish action.-
Fields inherited from class org.opencms.workflow.A_CmsWorkflowManager
m_adminCms, m_parameters
-
-
Constructor Summary
Constructors Constructor Description CmsDefaultWorkflowManager()
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CmsWorkflowResponse
actionForcePublish(CmsObject userCms, CmsPublishOptions options, java.util.List<CmsResource> resources)
The implementation of the "forcepublish" workflow action.protected CmsWorkflowResponse
actionPublish(CmsObject userCms, CmsPublishOptions options, java.util.List<CmsResource> resources)
The implementation of the "publish" workflow action.I_CmsPublishResourceFormatter
createFormatter(CmsObject cms, CmsWorkflow workflow, CmsPublishOptions options)
Creates the formatter for formatting the resources to be displayed to the user.static CmsProjectBean
createProjectBeanFromProject(CmsObject cms, CmsProject project)
Creates a project bean from a real project.CmsWorkflowResponse
executeAction(CmsObject cms, CmsWorkflowAction action, CmsPublishListToken token)
Executes a workflow action for a publish list token instead of a resource list.CmsWorkflowResponse
executeAction(CmsObject userCms, CmsWorkflowAction action, CmsPublishOptions options, java.util.List<CmsResource> resources)
Executes a workflow action in the context of the current user.java.lang.String
getLabel(CmsObject cms, java.lang.String key)
Gets the localized label for a given CMS context and key.java.util.List<CmsProjectBean>
getManageableProjects(CmsObject cms, java.util.Map<java.lang.String,java.lang.String> params)
Returns the current user's manageable projects.protected static java.lang.String
getOuAwareName(CmsObject cms, java.lang.String name)
Returns the simple name if the ou is the same as the current user's ou.CmsPublishListToken
getPublishListToken(CmsObject cms, CmsWorkflow workflow, CmsPublishOptions options)
Gets a publish list token for the given parameters which can be used later to reconstruct the publish list.I_CmsVirtualProject
getRealOrVirtualProject(CmsUUID projectId)
Gets the virtual project object identified by the given id.int
getResourceLimit()
Gets the resource limit.java.lang.String
getWorkflowForWorkflowProject(CmsUUID projectId)
Gets the workflow id which should be used for a given workflow project.CmsWorkflowResources
getWorkflowResources(CmsObject cms, CmsWorkflow workflow, CmsPublishOptions options, boolean canOverride, boolean ignoreLimit)
Returns the resources for the given workflow and project.java.util.Map<java.lang.String,CmsWorkflow>
getWorkflows(CmsObject cms)
Returns the available workflows for the current user.void
initialize(CmsObject adminCms)
Initializes this workflow manager instance.-
Methods inherited from class org.opencms.workflow.A_CmsWorkflowManager
getLocale, getParameter, getParameters, setParameters
-
-
-
-
Field Detail
-
ACTION_FORCE_PUBLISH
public static final java.lang.String ACTION_FORCE_PUBLISH
The forced publish workflow action.- See Also:
- Constant Field Values
-
ACTION_PUBLISH
public static final java.lang.String ACTION_PUBLISH
The publish workflow action.- See Also:
- Constant Field Values
-
DEFAULT_RESOURCE_LIMIT
public static int DEFAULT_RESOURCE_LIMIT
Default value for the maximum number of resources in the initial publish list.
-
PARAM_RESOURCE_LIMIT
public static final java.lang.String PARAM_RESOURCE_LIMIT
The parameter name for the resource limit.- See Also:
- Constant Field Values
-
WORKFLOW_PUBLISH
public static final java.lang.String WORKFLOW_PUBLISH
The name for the publish action.- See Also:
- Constant Field Values
-
ATTR_CHECK_PUBLISH_RESOURCE_LIMIT
public static final java.lang.String ATTR_CHECK_PUBLISH_RESOURCE_LIMIT
If a request context attribute of this name is set, some internal methods used to collect lists of resources for publishing will 'give up' and throw an exception when the number of resources exceeds the resource limit of the workflow manager.- See Also:
- Constant Field Values
-
m_virtualProjects
protected java.util.Map<CmsUUID,I_CmsVirtualProject> m_virtualProjects
The map of registered virtual projects.
-
-
Constructor Detail
-
CmsDefaultWorkflowManager
public CmsDefaultWorkflowManager()
Constructor.
-
-
Method Detail
-
createProjectBeanFromProject
public static CmsProjectBean createProjectBeanFromProject(CmsObject cms, CmsProject project)
Creates a project bean from a real project.- Parameters:
cms
- the CMS contextproject
- the project- Returns:
- the bean containing the project information
-
getOuAwareName
protected static java.lang.String getOuAwareName(CmsObject cms, java.lang.String name)
Returns the simple name if the ou is the same as the current user's ou.- Parameters:
cms
- the CMS contextname
- the fully qualified name to check- Returns:
- the simple name if the ou is the same as the current user's ou
-
createFormatter
public I_CmsPublishResourceFormatter createFormatter(CmsObject cms, CmsWorkflow workflow, CmsPublishOptions options)
Description copied from interface:I_CmsWorkflowManager
Creates the formatter for formatting the resources to be displayed to the user.- Parameters:
cms
- the CMS context to useworkflow
- the current workflowoptions
- the publish options- Returns:
- the publish resource formatter to use
- See Also:
I_CmsWorkflowManager.createFormatter(org.opencms.file.CmsObject, org.opencms.ade.publish.shared.CmsWorkflow, org.opencms.ade.publish.shared.CmsPublishOptions)
-
executeAction
public CmsWorkflowResponse executeAction(CmsObject cms, CmsWorkflowAction action, CmsPublishListToken token) throws CmsException
Description copied from interface:I_CmsWorkflowManager
Executes a workflow action for a publish list token instead of a resource list.- Parameters:
cms
- the CMS context to useaction
- the action to performtoken
- the publish list token to use- Returns:
- the workflow response
- Throws:
CmsException
- if something goes wrong- See Also:
I_CmsWorkflowManager.executeAction(org.opencms.file.CmsObject, org.opencms.ade.publish.shared.CmsWorkflowAction, org.opencms.ade.publish.shared.CmsPublishListToken)
-
executeAction
public CmsWorkflowResponse executeAction(CmsObject userCms, CmsWorkflowAction action, CmsPublishOptions options, java.util.List<CmsResource> resources) throws CmsException
Description copied from interface:I_CmsWorkflowManager
Executes a workflow action in the context of the current user.- Parameters:
userCms
- the current user's CMS contextaction
- the workflow actionoptions
- the publish optionsresources
- the resources to be processed- Returns:
- the workflow response for the executed action
- Throws:
CmsException
- if something goes wrong- See Also:
I_CmsWorkflowManager.executeAction(org.opencms.file.CmsObject, org.opencms.ade.publish.shared.CmsWorkflowAction, org.opencms.ade.publish.shared.CmsPublishOptions, java.util.List)
-
getLabel
public java.lang.String getLabel(CmsObject cms, java.lang.String key)
Gets the localized label for a given CMS context and key.- Parameters:
cms
- the CMS contextkey
- the localization key- Returns:
- the localized label
-
getManageableProjects
public java.util.List<CmsProjectBean> getManageableProjects(CmsObject cms, java.util.Map<java.lang.String,java.lang.String> params)
Description copied from interface:I_CmsWorkflowManager
Returns the current user's manageable projects.- Parameters:
cms
- the CMS context to useparams
- the publish parameters- Returns:
- the current user's manageable projects
- See Also:
I_CmsWorkflowManager.getManageableProjects(org.opencms.file.CmsObject, java.util.Map)
-
getPublishListToken
public CmsPublishListToken getPublishListToken(CmsObject cms, CmsWorkflow workflow, CmsPublishOptions options)
Description copied from interface:I_CmsWorkflowManager
Gets a publish list token for the given parameters which can be used later to reconstruct the publish list.- Parameters:
cms
- the CMS context to useworkflow
- the workflowoptions
- the publish options- Returns:
- the publish list token
- See Also:
I_CmsWorkflowManager.getPublishListToken(org.opencms.file.CmsObject, org.opencms.ade.publish.shared.CmsWorkflow, org.opencms.ade.publish.shared.CmsPublishOptions)
-
getRealOrVirtualProject
public I_CmsVirtualProject getRealOrVirtualProject(CmsUUID projectId)
Description copied from interface:I_CmsWorkflowManager
Gets the virtual project object identified by the given id.- Parameters:
projectId
- the virtual project id- Returns:
- the virtual project object
- See Also:
I_CmsWorkflowManager.getRealOrVirtualProject(org.opencms.util.CmsUUID)
-
getResourceLimit
public int getResourceLimit()
Description copied from interface:I_CmsWorkflowManager
Gets the resource limit.Publish lists which exceed this limit (counted before adding any related resources, siblings etc.) are not displayed to the user.
- Returns:
- the resource limit
- See Also:
I_CmsWorkflowManager.getResourceLimit()
-
getWorkflowForWorkflowProject
public java.lang.String getWorkflowForWorkflowProject(CmsUUID projectId)
Description copied from interface:I_CmsWorkflowManager
Gets the workflow id which should be used for a given workflow project.- Parameters:
projectId
- the project id- Returns:
- the workflow id for the project
- See Also:
I_CmsWorkflowManager.getWorkflowForWorkflowProject(org.opencms.util.CmsUUID)
-
getWorkflowResources
public CmsWorkflowResources getWorkflowResources(CmsObject cms, CmsWorkflow workflow, CmsPublishOptions options, boolean canOverride, boolean ignoreLimit)
Description copied from interface:I_CmsWorkflowManager
Returns the resources for the given workflow and project.- Parameters:
cms
- the user cms contextworkflow
- the workflowoptions
- the resource optionscanOverride
- flag to indicate whether the workflow manager should be able to override the selected workflowignoreLimit
- true if the workflow manager's resource limit should be ignored- Returns:
- the workflow resources
- See Also:
I_CmsWorkflowManager.getWorkflowResources(org.opencms.file.CmsObject, org.opencms.ade.publish.shared.CmsWorkflow, org.opencms.ade.publish.shared.CmsPublishOptions, boolean, boolean)
-
getWorkflows
public java.util.Map<java.lang.String,CmsWorkflow> getWorkflows(CmsObject cms)
Description copied from interface:I_CmsWorkflowManager
Returns the available workflows for the current user.- Parameters:
cms
- the user cms context- Returns:
- the available workflows
- See Also:
I_CmsWorkflowManager.getWorkflows(org.opencms.file.CmsObject)
-
initialize
public void initialize(CmsObject adminCms)
Description copied from interface:I_CmsWorkflowManager
Initializes this workflow manager instance.- Specified by:
initialize
in interfaceI_CmsWorkflowManager
- Overrides:
initialize
in classA_CmsWorkflowManager
- Parameters:
adminCms
- the CMS context with admin privileges- See Also:
A_CmsWorkflowManager.initialize(org.opencms.file.CmsObject)
-
actionForcePublish
protected CmsWorkflowResponse actionForcePublish(CmsObject userCms, CmsPublishOptions options, java.util.List<CmsResource> resources) throws CmsException
The implementation of the "forcepublish" workflow action.- Parameters:
userCms
- the user CMS contextresources
- the resources which the action should processoptions
- the publish options to use- Returns:
- the workflow response
- Throws:
CmsException
- if something goes wrong
-
actionPublish
protected CmsWorkflowResponse actionPublish(CmsObject userCms, CmsPublishOptions options, java.util.List<CmsResource> resources) throws CmsException
The implementation of the "publish" workflow action.- Parameters:
userCms
- the user CMS contextoptions
- the publish optionsresources
- the resources which the action should process- Returns:
- the workflow response
- Throws:
CmsException
- if something goes wrong
-
-