Workflow
Workflow in Hippo CMS is completely integrated with content management. Workflow consists of workflow actions. A workflow action is an action that changes a document, folder or other node. A change in the content of the document counts as a change, but a document may also be published, reviewed, created, deleted, moved, etc. Any change of state of the document (or folder) is done by a workflow action. You can customize what is part of the state of a document by adding properties to its document type.
Workflow actions may only be possible for documents in a particular state and may be forbidden for users that have no permission to perform that particular workflow action.
Access Workflow
To call a workflow action, first get a workflow instance via the workflow manager:
WorkflowManager wflManager = ((HippoWorkspace) session.getWorkspace()).getWorkflowManager(); Workflow workflow = wflManager.getWorkflow( String workflowCategory, Node nodeToChange );
The arguments for getWorkflow are the name of the workflow category and the node that will be changed (which can be a document, folder or other node). The entries in the workflow category will be checked one by one and the first that is allowed for the given node will be used.
A workflow instance of the (custom) workflow implementation specified in the entry is returned. If you add your workflow to an existing category you must be aware that another workflow than you expect may be returned. You can check for your workflow:
if (workflow instanceof FeaturedWorkflow)
Always type cast to your workflow:
FeaturedWorkflow featuredWorkflow = (FeaturedWorkflow) workflow; featuredWorkflow.feature();