JBoss.orgCommunity Documentation

Chapter 8. Governance Human Tasks

8.1. Overview
8.2. Using Human Tasks in a Workflow
8.3. Custom Task Forms
8.4. Fail Button
8.5. Customizing the Task API

Overlord: DTgov uses an embedded version of jBPM by default. However, human tasks can easily be included in Governance Workflows because the Task Inbox is integrated directly into the DTGov User Interface.

Out of the box, Human Task functionality should work seamlessly. However, it is also possible to integrate a separate task system by providing an alternative (custom) Task API implementation.

To use a human task in a Governance workflow, you can simply drop a human task activity onto the canvas (when you are authoring your workflow using, for example, the Eclipse BPMN editor). Please see the documentation for your BPMN editor for more details on using jBPM human task activities. Note that, by default, a human task that executes in a Governance workflow will create a task instance that will appear in the Governance Task Inbox user interface provided with DTGov.

Whenever a task is created in a governance workflow (using a human task activity as discussed above), the Task Inbox is responsible for presenting the details of the task to relevant users. The Task Inbox allows users to perform human task related actions such as claiming, starting, and completing the tasks assigned to them.

It is important to understand that the Task Inbox must have access to a Form for each type of task it is expected to display. This is accomplished by creating a Task Form XML file for each type of task used in your Governance workflow(s). A Task Form XML file is simply an HTML5 snippet with the presentation markup specific to a task type. The Task Form XML file must be added to the S-RAMP repository that the DTGov system is connected to, so that it can be looked up when DTGov is presenting the task instance to a user.

An example Task Form XML file follows:

<form>
  <fieldset>
    <label>Notification</label>
    <p>
      You are hereby notified that a new Schema artifact named
      <b><span data-name="SchemaName">Unknown</span></b> has
      been added to the repository.  Please review it.
    </p>
    <label>Validation</label>
    <label class="radio">
      <input type="radio" name="Status" value="pass"></input>
      Schema accepted as valid
    </label>
    <label class="radio">
      <input type="radio" name="Status" value="fail"></input>
      Schema <em>not</em> accepted
    </label>
  </fieldset>
</form>

Custom task forms in DTGov will be pulled from the S-RAMP repository when needed and displayed dynamically in the user interface. Any input variables configured in the human task activity (in the governance workflow) will be used as inputs to the form. Inputs can be substituted into the following HTML elements:

  • input type="text"
  • input type="hidden"
  • textarea
  • input type="checkbox"
  • input type="radio"
  • select
  • div
  • span
  • label

For HTML elements with name attributes (e.g. input, select, textarea), the name of the element must match the input variable name. For all other HTML elements the name must be specified in a data-name attribute.

When the user completes or fails a task, the data they entered in the task form is gathered up and submitted to the task engine (and is consequently sent back to the governance workflow).

Once the Task Form XML file is written, it must be added to the S-RAMP repository. The name of the file (and thus the name of the artifact in the S-RAMP repository) must be of the form:

<taskName>-taskform.xml

The taskName can be identified and configured when setting up the human task activity in your workflow. For example, if you configure the task name in your workflow to be mycompany.appx.VerifySchema then the Task Form XML file should be added to S-RAMP with a name of mycompany.appx.VerifySchema-taskform.xml.

For code newer than version 1.2 the Fail button in the TaskDetail form next to the Complete button is no longer visible. However in certain cases it may make sense to have a Fail button . To make this button visible you need to open the edit user task screen in your workflow editor and add an Input Parameter Mapping:

From: true (use expression and no language)
To: FailButtonIsVisible (type String)

Simply put, the Task API system used by the DTGov user interface can be swapped out by setting the following property in the DTGov UI configuration file (dtgov-ui.properties):

dtgov-ui.task-client.class

This property must point to a fully qualified Java class that implements the following interface:

org.overlord.dtgov.ui.server.services.tasks.ITaskClient

Of course, any Governance Workflows that create Human Task instances must also point to the alternate task system. That configuration is out of the scope of this guide.