+

Search Tips   |   Advanced Search

Create a custom workflow action class

We can create custom workflow action classes to enable you to use custom workflow actions in a workflow.


Create the custom workflow action class

  1. Create a java class that implements the interface com.ibm.workplace.wcm.api.custom.CustomWorkflowAction . This class must implement the following methods:

    • public Date getExecuteDate(Document p_document) {} (This specifies when the custom action will be executed)

    • public CustomWorkflowActionResult execute(Document p_document) {} (This method contains the code that will run when the custom action is executed.)

  2. Implement execute()method . This method contains the code that will be executed against the supplied Document. This method must return a com.ibm.workplace.wcm.api.custom.CustomWorkflowActionResult object to indicate the result of the custom code through the use of com.ibm.workplace.wcm.api.custom.Directives.

    • A custom workflow action result object is created by first retrieving a reference to the WebContentCustomWorkflowService object, and then calling the method webContentCustomWorkflowService.getCustomWorkflowService().createResult. If the CustomWorkflowActionResult does not indicate a failure, changes to the document will be saved. See the Web Content Manager Javadoc for further information. The Javadoc HTML files are located under the PROFILE_ROOT\installedApps\nodename\wcm.ear\ilwwcm.war\webinterface\ folder.

    • Also see the Web Content Manager Javadoc for further information on valid directives.

  3. Create a custom workflow action factory class that implements the interface com.ibm.workplace.wcm.api.custom.CustomWorkflowActionFactory.


Create a plugin.xml file

A plugin.xml file is needed whether the deployment is done using a WAR or EAR, or using a loose jar. If deploying via an application in a WAR or EAR, include the plugin.xml file in the application's "WEB-INF" folder. When using a jar, include the plugin.xml in the root of the jar.

<?xml version="1.0" encoding="UTF-8"?>
<plugin id="com.ibm.workplace.wcm.sample.customworkflowaction"
name="Sample Custom Workflow Action Factory"
version="1.0.0"
provider-name="IBM">

<extension
point="com.ibm.workplace.wcm.api.CustomWorkflowActionFactory"
id="SimpleCustomWorkflowActionFactory">
<provider class="com.ibm.workplace.wcm.sample.customworkflowaction.SimpleCustomWorkflowActionFactory"/>
</extension>

</plugin>

Naming conventions:

If we create a new plugin application with the same names and IDs as an existing plugin, the new plugin may override the first. When creating plugin applications ensure that the following are unique across your system:


Parent: Create custom plug-ins