Package org.opencms.workflow
Class CmsExtendedWorkflowManager
java.lang.Object
org.opencms.workflow.A_CmsWorkflowManager
org.opencms.workflow.CmsDefaultWorkflowManager
org.opencms.workflow.CmsExtendedWorkflowManager
- All Implemented Interfaces:
I_CmsWorkflowManager
The default workflow manager implementation, which supports 2 basic actions, Release and Publish.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The release workflow action.static final String
The parameter which points to the XML content used for notifications.static final String
The key for the configurable workflow project manager group.static final String
The key for the configurable workflow project user group.static final String
The key for the 'release' workflow.Fields inherited from class org.opencms.workflow.CmsDefaultWorkflowManager
ACTION_FORCE_PUBLISH, ACTION_PUBLISH, ATTR_CHECK_PUBLISH_RESOURCE_LIMIT, DEFAULT_RESOURCE_LIMIT, m_virtualProjects, PARAM_RESOURCE_LIMIT, WORKFLOW_PUBLISH
Fields inherited from class org.opencms.workflow.A_CmsWorkflowManager
m_adminCms, m_parameters
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected CmsWorkflowResponse
actionRelease
(CmsObject userCms, List<CmsResource> resources) Implementation of the 'release' workflow action.protected void
checkNewParentsInList
(CmsObject userCms, List<CmsResource> resources) Checks that the parent folders of new resources which are released are either not new or are also released.protected void
cleanupEmptyWorkflowProjects
(List<CmsProject> projects) Cleans up empty workflow projects.protected void
cleanupProjectIfEmpty
(CmsProject project) Removes a project if there are no longer any resources which have been last modified in that project.protected void
clearLocks
(CmsProject project, List<CmsResource> resources) Ensures that the resources to be released are unlocked.createFormatter
(CmsObject cms, CmsWorkflow workflow, CmsPublishOptions options) Creates the formatter for formatting the resources to be displayed to the user.executeAction
(CmsObject userCms, CmsWorkflowAction action, CmsPublishOptions options, List<CmsResource> resources) Executes a workflow action in the context of the current user.protected boolean
existsProject
(String projectName) Helper method to check whether a project exists.protected String
generateProjectDescription
(CmsObject userCms) Generates the description for a new workflow project based on the user for whom it is created.protected String
generateProjectName
(CmsObject userCms) Generates the name for a new workflow project based on the user for whom it is created.protected String
generateProjectName
(CmsObject userCms, boolean shortTime) Generates the name for a new workflow project based on the user for whom it is created.Gets the list of recipients for the notifications.protected String
Gets the resource notification content path.protected CmsWorkflowResponse
getPublishBrokenRelationsResponse
(CmsObject userCms, List<CmsPublishResource> publishResources) Helper method for generating the workflow response which should be sent when publishing the resources would break relations.getRealOrVirtualProject
(CmsUUID projectId) Gets the virtual project object identified by the given id.protected CmsWorkflowResponse
Gets the workflow response which should be sent when the resources have successfully been published.Gets the name of the group which should be used as the 'manager' group for newly created workflow projects.Gets the name of the group which should be used as the 'user' group for newly created workflow projects.getWorkflowResources
(CmsObject cms, CmsWorkflow workflow, CmsPublishOptions options, boolean canOverrideWorkflow, boolean ignoreLimit) Returns the resources for the given workflow and project.getWorkflows
(CmsObject cms) Returns the available workflows for the current user.void
initialize
(CmsObject adminCms) Initializes this workflow manager instance.protected boolean
isProjectEmpty
(CmsProject project) Checks whether there are resources which have last been modified in a given project.protected boolean
isProjectManager
(CmsObject userCms) Checks whether the user for a given CMS context can manage workflow projects.protected void
onFinishPublishJob
(CmsPublishJobRunning publishJob) Handles finished publish jobs by removing projects of resources in the publish job if they are empty workflow projects.protected void
onStartPublishJob
(CmsPublishJobEnqueued publishJob) This is called when a publish job is started.protected void
sendNotification
(CmsObject userCms, CmsUser recipient, CmsProject workflowProject, List<CmsResource> resources) Sends the notification for released resources.Methods inherited from class org.opencms.workflow.CmsDefaultWorkflowManager
actionForcePublish, actionPublish, cleanUpInvalidResourcesFromUserPublishList, createProjectBeanFromProject, executeAction, getLabel, getManageableProjects, getOuAwareName, getPublishListToken, getResourceLimit, getWorkflowForWorkflowProject
Methods inherited from class org.opencms.workflow.A_CmsWorkflowManager
getLocale, getParameter, getParameters, setParameters
-
Field Details
-
ACTION_RELEASE
The release workflow action.- See Also:
-
PARAM_NOTIFICATION_CONTENT
The parameter which points to the XML content used for notifications.- See Also:
-
PARAM_WORKFLOW_PROJECT_MANAGER_GROUP
The key for the configurable workflow project manager group.- See Also:
-
PARAM_WORKFLOW_PROJECT_USER_GROUP
The key for the configurable workflow project user group.- See Also:
-
WORKFLOW_RELEASE
The key for the 'release' workflow.- See Also:
-
-
Constructor Details
-
CmsExtendedWorkflowManager
public CmsExtendedWorkflowManager()
-
-
Method Details
-
getRealOrVirtualProject
Description copied from interface:I_CmsWorkflowManager
Gets the virtual project object identified by the given id.- Specified by:
getRealOrVirtualProject
in interfaceI_CmsWorkflowManager
- Overrides:
getRealOrVirtualProject
in classCmsDefaultWorkflowManager
- Parameters:
projectId
- the virtual project id- Returns:
- the virtual project object
- See Also:
-
getWorkflowProjectManagerGroup
Gets the name of the group which should be used as the 'manager' group for newly created workflow projects.- Returns:
- a group name
-
getWorkflowProjectUserGroup
Gets the name of the group which should be used as the 'user' group for newly created workflow projects.- Returns:
- a group name
-
getWorkflows
Description copied from interface:I_CmsWorkflowManager
Returns the available workflows for the current user.- Specified by:
getWorkflows
in interfaceI_CmsWorkflowManager
- Overrides:
getWorkflows
in classCmsDefaultWorkflowManager
- Parameters:
cms
- the user cms context- Returns:
- the available workflows
- See Also:
-
initialize
Description copied from interface:I_CmsWorkflowManager
Initializes this workflow manager instance.- Specified by:
initialize
in interfaceI_CmsWorkflowManager
- Overrides:
initialize
in classCmsDefaultWorkflowManager
- Parameters:
adminCms
- the CMS context with admin privileges- See Also:
-
actionRelease
protected CmsWorkflowResponse actionRelease(CmsObject userCms, List<CmsResource> resources) throws CmsException Implementation of the 'release' workflow action.- Parameters:
userCms
- the current user's CMS contextresources
- the resources which should be released- Returns:
- the workflow response for this action
- Throws:
CmsException
- if something goes wrong
-
checkNewParentsInList
protected void checkNewParentsInList(CmsObject userCms, List<CmsResource> resources) throws CmsException Checks that the parent folders of new resources which are released are either not new or are also released.- Parameters:
userCms
- the user CMS contextresources
- the resources to check- Throws:
CmsException
- if the check fails
-
cleanupEmptyWorkflowProjects
Cleans up empty workflow projects.- Parameters:
projects
- the workflow projects to clean up- Throws:
CmsException
- if something goes wrong
-
cleanupProjectIfEmpty
Removes a project if there are no longer any resources which have been last modified in that project.- Parameters:
project
- the project- Throws:
CmsException
- if something goes wrong
-
clearLocks
Ensures that the resources to be released are unlocked.- Parameters:
project
- the project in which to operateresources
- the resources for which the locks should be removed- Throws:
CmsException
- if something goes wrong
-
existsProject
Helper method to check whether a project exists.- Parameters:
projectName
- the project name- Returns:
- true if the project exists
-
generateProjectDescription
Generates the description for a new workflow project based on the user for whom it is created.- Parameters:
userCms
- the user's current CMS context- Returns:
- the workflow project description
-
generateProjectName
Generates the name for a new workflow project based on the user for whom it is created.- Parameters:
userCms
- the user's current CMS context- Returns:
- the workflow project name
-
generateProjectName
Generates the name for a new workflow project based on the user for whom it is created.- Parameters:
userCms
- the user's current CMS contextshortTime
- if true, the short time format will be used, else the medium time format- Returns:
- the workflow project name
-
getNotificationMailRecipients
Gets the list of recipients for the notifications.- Returns:
- the list of users which should be notified when resources are released
-
getNotificationResource
Gets the resource notification content path.- Parameters:
cms
- the cms context- Returns:
- the resource notification content path
-
getPublishBrokenRelationsResponse
protected CmsWorkflowResponse getPublishBrokenRelationsResponse(CmsObject userCms, List<CmsPublishResource> publishResources) Helper method for generating the workflow response which should be sent when publishing the resources would break relations.- Parameters:
userCms
- the user's CMS contextpublishResources
- the resources whose links would be broken- Returns:
- the workflow response
-
getSuccessResponse
Gets the workflow response which should be sent when the resources have successfully been published.- Returns:
- the successful workflow response
-
isProjectEmpty
Checks whether there are resources which have last been modified in a given project.- Parameters:
project
- the project which should be checked- Returns:
- true if there are no resources which have been last modified inside the project
- Throws:
CmsException
- if something goes wrong
-
isProjectManager
Checks whether the user for a given CMS context can manage workflow projects.- Parameters:
userCms
- the user CMS Context- Returns:
- true if this user can manage workflow projects
- Throws:
CmsException
- if something goes wrong
-
onFinishPublishJob
Handles finished publish jobs by removing projects of resources in the publish job if they are empty workflow projects.- Parameters:
publishJob
- the finished published job
-
onStartPublishJob
This is called when a publish job is started.- Parameters:
publishJob
- the publish job being started
-
sendNotification
protected void sendNotification(CmsObject userCms, CmsUser recipient, CmsProject workflowProject, List<CmsResource> resources) Sends the notification for released resources.- Parameters:
userCms
- the user's CMS contextrecipient
- the OpenCms user to whom the notification should be sentworkflowProject
- the workflow project whichresources
- the resources which have been affected by a workflow action