+

Search Tips   |   Advanced Search

Portal, V6.1


 

Create a custom workflow action class

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

 

Creating 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 calling the method webContentCustomWorkflowService.getCustomWorkflowService().createResult(Directive, String). If the CustomWorkflowActionResult does not indicate a failure changes to the document will be saved. See the WCM Javadoc for further information. The Javadoc HTML files are located under the was_profile_root\installedApps\node\wcm.ear\ilwwcm.war\webinterface\ folder.

    • Also see the WCM 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.

  4. Compile the java classes and create a portal application. This can either be an "ear" or "war" file.

 

Deploy the ear file in the Administrative Console

To ensure the new workflow action class is available each time your server is started you can register the ear file in the Administrative Console:

  1. Select Applications

  2. Select Install new application

  3. Browse for the ear file

  4. Select next until you reach step 2. Map modules to servers

  5. Select the tickbox for the custom action module

  6. In the Clusters and Servers section, select WebSphere_Portal and select apply

  7. Keep selecting next until the end when you select finish

  8. The screen titled updating will be shown. Select Manage Applications.

  9. Locate and select the application you just installed. This is named "WCM Sample Custom Workflow Action" by default.

  10. Under Detail Properties select Startup behavior.

  11. Under General Properties modify the Startup order to be the same weight as "wcm" and select Apply. By default, the weight is 20.

  12. Select Save directly to master configuration.

To update an existing ear file:

  1. Select Applications

  2. Select Enterprise Applications

  3. Search for the Application name

  4. Select the tickbox for the custom action application and click on update

  5. Select upload the replacement application and browse for the ear file

  6. Keep selecting next until the end when you select finish

  7. The screen titled 'updating' will be shown. Select Save to Master Configuration and then click save.

 

Create a plugin.xml file

Create a new file named plugin.xml under was_profile_root\installedApps\your_application.ear\your_application.war\WEB-INF\.

<?xml version="1.0" encoding="UTF-8"?>
<plugin id="com.ibm.workplace.wcm.api.custom"
        name="Sample Custom Workflow Action Factory"
        version="1.0.0"
        provider-name="IBM">
        
  <extension-point id="CustomWorkflowActionFactory" name="CustomWorkflowActionFactory"/>
  
  <extension
     point="com.ibm.workplace.wcm.api.custom.CustomWorkflowActionFactory"
     id="SimpleCustomWorkflowActionFactory">
     <provider class="com.ibm.workplace.wcm.sample.customworkflowaction.SimpleCustomWorkflowActionFactory"/>
  </extension>
 
</plugin>

You must then restart the server to activate the plugin.

 

Create a custom workflow action

Once your java class is installed, you can create a custom workflow action. The custom workflow action can be added to a workflow stage just like any other workflow action.

 

Parent topic

Creating a custom action