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 be automatically triggered by some state of a document or may be initiated by users or by external agents. 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.
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)
If you put your workflow in a separate workflow category, you will not have that problem. Ensure you use a name that is not likely to be used by other addons.
Always type cast to your workflow:
FeaturedWorkflow featuredWorkflow = (FeaturedWorkflow) workflow; featuredWorkflow.feature();
The first workflow action you will need is that of adding a document. This is an workflow action of folder workflow. In folder workflow you can add, delete, move and reorder documents and subfolders.
The HST demo contains a sample of creating new documents through the site.