Creating simple process - bluesoft-rnd/aperte-workflow-core GitHub Wiki
Like in most of the BPM solutions, business process in Aperte Workflow is composed out of states and transitions between them. Aperte Workflow is built on this stable foundation while also extending it with features provided by 3rd party frameworks like Vaadin or Liferay.
This tutorial will show you how to create a simple process with both human and automated tasks and then deploy it onto existing Aperte Workflow installation.
Because your process will be distributed as an OSGi bundle, it won't be easy to run it directly from the IDE. That's why it's convenient to set up the project with automatic build system.
- Select New > Other ..., pick Maven Project and press Next
- Currently there are no predefined archetypes for Aperte Workflow bundles so check Create Simple Project (skip archetype selection) and press Next.
- Enter artifact properties: groupId org.aperteworkflow, artifactId tutorial-process, version 0.1 and press Finish.
- Create new package org.aperteworkflow.tutorial.process inside src/main/resources source folder.
- Open the pom.xml file and add configuration for maven-bundle-plugin. The configuration is shown here
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<version>2.1.0</version>
<configuration>
<instructions>
<Bundle-Name>Tutorial Process</Bundle-Name>
<Bundle-SymbolicName>org.aperteworkflow.tutorial.process</Bundle-SymbolicName>
<Bundle-Version>0.1</Bundle-Version>
<Import-Package>org.osgi.framework</Import-Package>
<ProcessTool-Process-Deployment>
org.aperteworkflow.tutorial.process
</ProcessTool-Process-Deployment>
</instructions>
</configuration>
</plugin>
Although jPDL can be written by hand, here we are going to use Eclipse IDE with jBPMv4 GPD plugin. This approach does not require knowledge of jPDL syntax and is pretty straightforward.
- Select New > Other ..., pick jBPM4 Process Definition from the list and press Next.
- Name the file processdefinition.jpdl.xml and press Finish.
- Open the file processdefinition.jpdl.xml by double clicking it. That should open a new, empty jBPM jPDL4 Editor tab:
- Select Start block from Components palette and add it to the diagram.
- Now select Task block and add it to the diagram. Rename it to ENTER_DATA.
- Repeat previous step with another Task block, this time renaming it to REVIEW_DATA.
- Select End symbol and add it to the diagram.
- Connect all the previously used blocks with transitions. The result should look like that:
- Change the process name to tutorialprocess
- Switch to source view
- In the task with name="ENTER_DATA" specify new asignee attribute
assignee="#{initiator}"
- Create new swimline element for the REQUEST_QUEUE queue
This tutorial process demonstrates basic use of task queues. One queue with the name REQUEST_QUEUE will be used.
- Create new queues-config.xml file under the org.aperteworkflow.tutorial.process package.
- Choose the parent folder src/main/resources/org/aperteworkflow/tutorial/process, name the file queues-config.xml' and press Finish.
- Open the file queues-config.xml by double clicking it.
- Create one queue definition with the name REQUEST_QUEUE. The configuration is shown below
<?xml version="1.0" encoding="UTF-8"?>
<list>
<config.ProcessQueueConfig name="REQUEST_QUEUE" description="Submissions">
<rights>
<config.ProcessQueueRight roleName=".*" browseAllowed="true"/>
</rights>
</config.ProcessQueueConfig>
</list>
- Create new processtool-config.xml file under the org.aperteworkflow.tutorial.process package.
- Create new root element config.ProcessDefinitionConfig and supply arguments to match the process name provided in jPDL file.
<?xml version="1.0" encoding="UTF-8"?>
<config.ProcessDefinitionConfig
bpmDefinitionKey="tutorialprocess"
description="Tutorial Process"
processName="tutorialprocess">
</config.ProcessDefinitionConfig>
- Create new state definition with name ENTER_DATA. As one may guess, it's name matches the name of the task.
<?xml version="1.0" encoding="UTF-8"?>
<config.ProcessDefinitionConfig
bpmDefinitionKey="tutorialprocess"
description="Tutorial Process"
processName="tutorialprocess">
<states>
<config.ProcessStateConfiguration description="Provide details" name="ENTER_DATA">
<commentary><![CDATA[Please provide data]]></commentary>
<widgets>
</widgets>
<actions>
</actions>
</config.ProcessStateConfiguration>
</states>
</config.ProcessDefinitionConfig>
- Define new actions and which widgets will be used to render the interface. Entire step configuration is shown here
<?xml version="1.0" encoding="UTF-8"?>
<config.ProcessDefinitionConfig
bpmDefinitionKey="tutorialprocess"
description="Tutorial Process"
processName="tutorialprocess">
<states>
<config.ProcessStateConfiguration description="Provide details" name="ENTER_DATA">
<commentary><![CDATA[Please provide data]]></commentary>
<widgets>
<config.ProcessStateWidget className="VerticalLayout" priority="1">
<attributes>
<config.ProcessStateWidgetAttribute name="caption" value="Enter the data" />
</attributes>
<children>
<config.ProcessStateWidget className="ProcessData" priority="15">
<permissions>
<config.ProcessStateWidgetPermission priviledgeName="EDIT" roleName=".*" />
</permissions>
<attributes>
<config.ProcessStateWidgetAttribute name="caption" value="Your details" />
<config.ProcessStateWidgetAttribute name="widgetsDefinition">
<value><![CDATA[
<widgetsDefinition>
<input caption="First name" bind="first_name" width="100%" required="true"/>
<input caption="Last name" bind="last_name" width="100%" required="true"/>
<text caption="Few words about you" bind="info" width="100%" required="true"/>
</widgetsDefinition>
]]></value>
</config.ProcessStateWidgetAttribute>
</attributes>
</config.ProcessStateWidget>
</children>
</config.ProcessStateWidget>
</widgets>
<actions>
<config.ProcessStateAction bpmName="to REVIEW_DATA"
label="Continue" description="Confirm data and process with data review"
priority="10" autohide="true">
<permissions>
<config.ProcessStateActionPermission roleName=".*" />
</permissions>
</config.ProcessStateAction>
</actions>
</config.ProcessStateConfiguration>
</states>
</config.ProcessDefinitionConfig>