Sun GlassFish Web Space Server 10.0 Administration Guide

Creating a Workflow

To create a workflow, you need to create a workflow definition file in XML format that conforms to the jBPM Process Definition Language (JPDL) standard.

For example, say that you are creating a workflow for a leave application and approval process.

    The following is the scenario involved:

  1. The admin user creates a workflow definition called LeaveApproval.

  2. The admin user creates a workflow instance (Workflow State 1).

  3. The test user uses the workflow instance to apply for leave (Workflow State 2).

  4. The manager receives the holiday request. The manager can approve or reject the request, or can send the request for reconsideration (Workflow State 2).

  5. The test user can verify to see whether the process has ended.

    The following procedures provide the detailed process steps:

  1. To Add a Workflow Definition

  2. To Create a Workflow Instance

  3. Workflow Process Steps: To Request an Holiday

  4. Workflow Process Steps: To Evaluate Holiday Request

  5. Workflow Process Steps: To Ascertain the Request Status

ProcedureTo Add a Workflow Definition

  1. Log in to Web Space Server as the admin user.

  2. Create a new page by clicking Add Page.

  3. Type a name for the page and click Save.

    For example, name it Workflow.

  4. Click the tab for the page.

    The page opens.

  5. Choose Add Applications from the Welcome menu, and add the Workflow portlet to the page.

  6. Click the Add Definition button.

  7. Add the workflow definition in XML format and click the Save New Version button.

    You can copy and paste a workflow definition. In this example, LeaveApproval version 1.0 is the name of the workflow definition.

    Figure 4–15 Adding a Workflow Definition

    To add a Workflow Definition

    A workflow is created with a version number associated with it.

  8. Log out and log in back in to Web Space Server for the changes to take effect.

ProcedureTo Create a Workflow Instance

  1. Log in to Web Space Server as the admin user.

  2. Choose Add Applications from the Welcome menu, and add the Workflow portlet to the page.

  3. Click Search Definitions on the Workflow portlet to view all workflow definitions.

    Figure 4–16 Creating a Workflow Instance

    To Create a Workflow Instance

  4. Click the Add Instances button next to a workflow definition.

    In this example, you can create an instance for version 1.0 of the LeaveApproval workflow definition.

    An instance is created for the Workflow Definition. Provide values for the fields such as the Definition Name, Definition Version, Start Date (Range), and End Date (Range), and click Search to search for the instance. To hide the instances that have already ended, select the Hide the instances that have already ended checkbox.

    You can create any number of instances for a version of Workflow Definition.

    Figure 4–17 Adding Workflow Instances

    To Create a Workflow Instance

  5. Click the Manage button for the instance.

  6. Click Save to save the task.

    The task will be assigned to a requester.


    Note –

    If the admin user clicks the Signal button next to an Instance, the instance is promoted to the next state of workflow. The requester is not allowed to use an instance which is promoted to the next state of the workflow.


Accessing a Workflow Instance

Accessing a workflow instance follows the series of steps necessary to complete the workflow cycle for the instance.

ProcedureWorkflow Process Steps: To Request an Holiday

  1. Log in to Web Space Server as Paul, the test user.

  2. Click the Tasks tab on the Workflow portlet.

    You can use the Task Name, Definition Name, Current Date, Start Date, and End Date fields to search for a task. To hide the instances that have already ended, select the Hide the instances that have already ended checkbox.

  3. Click a Task for an Instance which have not ended.

    In this example, click the Holiday Request task for an Instance. Select a start date and an end date.

    Figure 4–18 Workflow Process Steps: To Request an Holiday

    Workflow Process Steps: To Request an Holiday

  4. Click Save.

ProcedureWorkflow Process Steps: To Evaluate Holiday Request

  1. Log in to Sun GlassFish Web Space Server as Mary Manager.

  2. Click the Tasks tab on the Workflow portlet.

  3. Click a Task for an Instance which have not ended.

    In this example, click the Evaluate Holiday Request task for an Instance.

    The manager can place comments against the request. The manager can exercise Approve, Reject, and Send Back for Review options.

    The Instance ends on clicking the Approve or Reject button.

ProcedureWorkflow Process Steps: To Ascertain the Request Status

  1. Log in to Sun GlassFish Web Space Server as Paul, the test user.

  2. Click the Tasks tab on the Workflow portlet.

    The End Date field next to the task name has the date and time of approval on it.