Purchase workflow sample
Download the sample code Purchase.par.
The task will be assigned to an user called "manager" so you need to create this user and log as him to see the task assignment.
Also you can assign this task to another user from the process instance workflow administration.
Process image
Process definition
<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="purchase">
<start-state name="start">
<transition to="decision"></transition>
</start-state>
<decision name="decision">
<transition to="approved" name="is cheap">
<condition expression="#{price.value <= 500}"></condition>
</transition>
<transition to="manager" name="is expensive">
<condition expression="#{price.value > 500}"></condition>
</transition>
</decision>
<task-node name="manager">
<task name="evaluate price">
<description>The manager may deny purchase or go ahead.</description>
<assignment actor-id="manager"></assignment>
</task>
<transition to="denied" name="deny"></transition>
<transition to="approved" name="approve"></transition>
</task-node>
<state name="approved">
<description>The purchase has been approved.</description>
<timer duedate="15 seconds" name="approved timer" transition="toend">
<script>print("From APPROVED Go to END");</script>
</timer>
<transition to="end" name="toend"></transition>
</state>
<state name="denied">
<description>The purchase has been denied.</description>
<timer duedate="15 seconds" name="denied timer" transition="toend">
<script>print("From DENIED Go to END");</script>
</timer>
<transition to="end" name="toend"></transition>
</state>
<end-state name="end"></end-state>
</process-definition>
Process handlers
The sample has not process handlers.
Form definition
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE workflow-forms PUBLIC "-//OpenKM//DTD Workflow Forms 2.0//EN"
"http://www.openkm.com/dtd/workflow-forms-2.0.dtd">
<workflow-forms>
<workflow-form task="run_config">
<input label="Purchase price" name="price" />
<textarea label="Purchase description" name="description" />
<button name="submit" label="Submit" />
</workflow-form>
<workflow-form task="evaluate price">
<input label="Purchase price" name="price" data="price" readonly="true" />
<textarea label="Purchase description" name="description" data="description" readonly="true" />
<button name="approve" label="Approve" transition="approve"/>
<button name="deny" label="Deny" transition="deny"/>
</workflow-form>
</workflow-forms>