Start page / Plug-In Development / ContentCreator Extensions / Management Extensions / Workflow Executables / Functional Overview
Workflow Executables: Functional Overview
Workflow activities can be configured to trigger scripts that are located in the Template Store. These Beanshell scripts have access to the FirstSpirit APIs and can work directly with all project elements.
However, in order to make full use of Java's features, structure complex code and include third-party libraries and resources, FirstSpirit provides an interface to encapsulate executable functionality in plug-in Java classes. This functionality is then called from a script configured in a workflow activity.
Functionality
When an executable is triggered by a script in the Template Store, this code may operate within the context of the workflow task and on the store element that is subject of the workflow as well as related objects.
An executable class may use the FirstSpirit Access and Developer APIs to implement their individual functionality.
Specific to ContentCreator, all workflow activities must be accomplished using server-side functionality. While the FirstSpirit APIs offer methods that operate on store elements from the client side, these can only be used in the SiteArchitect. If a script or executable is to use client-side functionality when available, conditional branching should be implemented to determine if the script or executable class is run in ContentCreator; if so, server-side methods should be used. |
Project Configuration
Template Store
Workflows are configured specific to one project in the Template Store. Each workflow activity may trigger a script, which is selected in the "Properties" dialog for that activity.
Scripts may be executed automatically or manually and implement either Beanshell functionality or call a Java class implementing the interface Executable. If an activity is configured to execute code automatically, this code will be executed as soon as a transition advances the workflow to that activity. If manual execution is configured, the activity will be displayed to the user as a workflow dialog, allowing the user to specify activity settings such as users and groups that should work on the next workflow state, deadlines and priority.
Example Implementation
The ContentCreator Examples module source code package contains a Content Transport feature Zip file (export_delete_workflow.zip, located in src/files) that includes a sample workflow definition and an accompanying script. This workflow is intended to be used as the project's deletion workflow, specified in ServerManager. The script refers to the executable Java class Delete (see below).
Executable: Delete
The Java class Delete implements deletion functionality geared towards ContentCreator's simplified page model, but may be used within SiteArchitect as well: it uses the current page reference (shown in the preview pane) as a starting point to determine whether the web page to be deleted is a combination of page reference and page objects or a dataset displayed by content projection.
This executable class is called from a simple workflow that is provided in a Content Transport feature file. If this workflow is set as the project's deletion workflow, it is called by clicking on the menu item "Delete page '[page name]'" in the "Contents" menu.
The executable Java class is located in the module's package de.espirit.firstspirit.opt.example.webedit.workflow.
Code Example
The Workflow Executable Code Example introduces the layout and implementation requirements to call an executable Java class from a workflow activity.