Difference between revisions of "Hello world!"
Line 8: | Line 8: | ||
<source lang="xml"> | <source lang="xml"> | ||
<?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||
− | <process-definition xmlns="" name=" | + | <process-definition |
− | + | xmlns="urn:jbpm.org:jpdl-3.2" | |
− | + | name="simple"> | |
− | + | <start-state name="start"> | |
− | + | <transition name="to_state" to="first"> | |
− | + | <action name="action" class="com.sample.action.MessageActionHandler"> | |
− | + | <message>Going to the first state!</message> | |
− | + | </action> | |
+ | </transition> | ||
+ | </start-state> | ||
+ | <state name="first"> | ||
+ | <transition name="to_end" to="end"> | ||
+ | <action name="action" class="com.sample.action.MessageActionHandler"> | ||
+ | <message>About to finish!</message> | ||
+ | </action> | ||
+ | </transition> | ||
+ | </state> | ||
+ | <end-state name="end"></end-state> | ||
</process-definition> | </process-definition> | ||
</source> | </source> |
Latest revision as of 14:14, 3 December 2012
A process definition is a directed graph, made up of nodes and transitions. The hello world process has 3 nodes. To see how the pieces fit together, we're going to start with a simple process without the use of the designer tool. The following picture shows the graphical representation of the hello world process:
And this is the XML which generates this process definition graph:
<?xml version="1.0" encoding="UTF-8"?>
<process-definition
xmlns="urn:jbpm.org:jpdl-3.2"
name="simple">
<start-state name="start">
<transition name="to_state" to="first">
<action name="action" class="com.sample.action.MessageActionHandler">
<message>Going to the first state!</message>
</action>
</transition>
</start-state>
<state name="first">
<transition name="to_end" to="end">
<action name="action" class="com.sample.action.MessageActionHandler">
<message>About to finish!</message>
</action>
</transition>
</state>
<end-state name="end"></end-state>
</process-definition>
This is a very basic example of a process definition. Is useless unless you make some improvements like adding an action.
You can see this workflow creation process at Basic workflow creation. |
Once the process definition is created, you can register it in the workflow engine. Log as okmAdmin and go to Administration → Workflow. The process definition list is actually empty. To register this new process definition go to Eclipse and to the Deployment tab. The Server Deployer input should be set to /OpenKM/workflow-register. Click on jBPM > Deploy Process menu.
If you go to the process definition list in the OpenKM administration, you can click on the "Reload" link and the new process will appear on the list. Here you can also upload a process definition archive, if you want.
If you register a process definition several times, the old definition persist until removed. This mean that will be several versions of a process definition. This is because you can update a process definition but the old one may be executing actually.
When you start a workflow related to a document, it always will use the last version of the process definition. |