Workflow API
The Workflow API provides the services, facades, interceptors to support workflows. It makes it possible for SmartEdit to retrieve workflows, verify if users can edit items in workflow actions, or block users from editing items in active workflows. It also provides services to display modal forms for users to perform workflow actions.
Backend
Services
The Workflow API provides the following services:
- CMSWorkflowActionService provides the functionality to retrieve workflow actions and decisions.
- CMSWorkflowParticipantService provides the functionality to verify if the current user is a participant of the currently active action or of any action in the workflow.
- CMSWorkflowService provides the functionality to work with workflows, such as retrieving workflows for an item, verifying if a user can edit an item in a workflow, or verifying if an item in an active is editable.
-
CMSWorkflowTemplateService provides the functionality to work with workflow templates, such as retrieving workflow templates for a specified catalog version.
Facades
The Workflow API provides the following facades:
- CMSWorkflowActionFacade provides the functionality to work with workflow actions, action comments, and workflow tasks.
- CMSWorkflowFacade provides the functionality to create, start, and edit workflows, as well as perform different operations for workflows.
- CMSWorkflowTemplateFacade provides the functionality to retrieve the list of templates available in catalog version.
Spring Configuration
The workflow feature declares its Spring beans in the cmsfacades-workflow-spring.xml and cms2-workflow-spring.xml files.
Automated Jobs
The Workflow API provides automated jobs that are automatically initiated when users executing tasks in a workflow make specific decisions. The automated jobs are as follows:
- ApprovePageAutomatedWorkflowAction: Approves all pages in a workflow. The job is executed when the workflow is approved.
- RejectEditingAutomatedWorkflowAction: Switches all active actions to pending state. The job is executed when an active action is rejected.
- PublishPostWorkflowAction: Publishes all items in a workflow. The job is executed when the publish action is executed.
Interceptors
The Workflow API provides interceptors that block users from editing, removing, or deleting items from an active workflow. It provides the following interceptors:
- CmsItemWorkflowInterceptor: Blocks users from editing or removing components.
- PageRestrictionWorkflowInterceptor: Blocks users from editing or removing restrictions from pages.
- PageWorkflowInterceptor: Blocks users from performing page level operations, such as adding, editing, moving, or removing components; applying or removing restrictions; moving a page to trash; or permanently deleting a page.
If a CMS item is already in a workflow attachment, users shouldn’t edit it; this ensures that the CMS Item preserves a consistent state. In such cases, SmartEdit returns a status code 409 - Conflict error in the HTTP response.
Frontend
Services
The WorkflowService performs operations such as:
- Retrieving a workflow for an active page.
- Retrieving all workflows.
- Retrieving workflows tasks.
- Canceling workflows.
The WorkflowInboxAnnouncementService is used to display announcements for workflow inbox tasks.
Facades
The WorkflowFacade provides the functionality to perform operations such as display a modal form to start or cancel a workflow, as well as to select a decision in a workflow task.