The Workflow Process Definition describes the tasks, sequence, and other elements of the workflow. Each element is a variable with name and object in an XML file. The XML file lives in <module>/resources/workflow/model and is named <processKey>.bpmn20.XML. The processKey is the unique name used for this workflow.

LabKey uses Activiti for designing workflows, and the Activiti process engine implements a subset of the BPMN 2.0 standard. If you are using a process definition generated with a different tool, all bpmn20 elements may not be supported. The XML elements provided by Activiti shown in our examples are prefixed with "activiti:". Details are available here:

Sample XML

Using a sample process definition will help illustrate some basic features, in this case a multiple assay workflow.

  • Review the contents of labWorkflow.bpmn20.xml.
    • If you download and unzipped the "labWork" module as part of the Workflow Tutorial, find this file in the /labWork/resources/workflow/model/ directory.
    • If not, download it here labWorkflow.bpmn20.xlm.
  • Open in an editor to review the features described below.

Definitions

The first section loads namespace and language definitions. One of the attributes of the <definitions> element is the targetNamespace. Change this to be a URN of the form "urn:lsid:labkey.com:workflow:module with the workflow resource". The workflow engine uses this to find permissions handlers, if any, that are used for the workflow. If your workflow does not use permissions handlers then this is less important, but in future, this part of the definition could be used for finding other module-specific resources. Replace "LabWork" with the name of your module in this line:

targetNamespace="urn:lsid:labkey.com:workflow:LabWork">

This process definition begins with the name and start event:

<process id="labWorkflow" name="Multiple Assay Workflow" isExecutable="true">
<startEvent id="startLabWork" name="Start"></startEvent>

userTask

<userTask id="runAssayA" name="Run Assay"></userTask>

In this case the user runs the assay.

serviceTask

Service, or system tasks, carry more information about the work required. Typically these are defined as classes to encapsulate similar tasks. In this example, an email notifier extended for workflow use:

<serviceTask id="notifyScientists" name="Notify  Scientists" activiti:class="org.labkey.workflow.delegate.EmailNotifier">
<extensionElements>
<activiti:field name="notificationClassName">
<activiti:string><![CDATA[org.labkey.labwork.workflow.WorkNotificationConfig]]></activiti:string>
</activiti:field>
</extensionElements>
</serviceTask>

Java Classes for Service Tasks

The following Java classes are available in the workflow module for handling different types of service tasks. The Activiti extensions for BPMN 2.0 allow you to provide the Java class name and the configuration data within the XML files.

DataManager

DataManager handles access to data. It expects as part of the configuration in the .bpmn20.xml definition a class that extends the abstract org.labkey.api.workflow.DataManagerConfig class.

EmailNotifier

EmailNotifier is used for sending email notifications. It expects as part of the configuration in the .bpmn20.xml definition, a class that extends the abstract org.labkey.api.workflow.NotificationConfig where you set the users and the email template.

SystemTaskManager

SystemTask Manager handles executing system tasks of any kind. It expects as part of the configuration in the .bpmn20.xml definition, a class that extends org.labkey.api.workflow.SystemTaskRunner

discussion

Discussion

Search 

Pages 

previousnext
 
expand all collapse all