SimplestWorkflowDevelop...
|
Simplest Workflow#In this article we will describe how to start jBPM project, how to create simplest workflow, 3 major jBPM notes and how to deploy created workflow into EmForge.Here we suppose you already installed jBoss GPD - an Eclipse plugin for jBPM process development. Configure JBPM Runtime Location#Before you will able to start working with workflows, you need to configure your workspace to point jBPM Runtime, you want to use. You will need to download jBPM-JPDL from jBoss site (at current moment latest version is 3.2.2) and unzip it in some place.
Then you need to add this runtime into your workplace. To do it open "Window"->"Preferences" and there "JBoss jBPM"->"Runtime Locations"
In opened dialog click "Add" and specify location there you unziped jBPM (name will be specified automatically). Create jBPM project.#To start jBPM workflows development you need to start jBPM project. It may be done from standard Eclipse "Start Project Dialog", in "Project Explorer" New"->"Project" and select "JBoss jBPM"->"Process Project" in "New Project" wizard
Enter Project Name and Project Location in next screen (standard Eclipse form) and then choose jBPM Version, will be used in this project (Previosly configured in Eclipse).
After creation you will see your new project in "Project Explorer"
Create New Workflow#By default, new Project Wizard create a new simplest workflow in the project, but we will create owr own: right-click on the "src/main/jpdl" in the "Project Explorer" -> "New" -> "Other" -> "JBoss JBPM" -> "Process Definition"
And specify name ("SimplestWorkflow" for example). New Workflow will be created and Workflow Editor (currently empty) will be opened. This editor has Toolbox with available graphical objects, for all select graphical objects you can specify different properties in "Properties" Tab. You can always switch Workflow Editor from default "Diagram" mode to "Design" or "Source" (tabs at the bottom of editor) to see generated XML file. Now, we can start to develop our first simplest workflow. This workflow should describe simplest personal task, then somebody may create task for himself, and then complete it at some moment. Create Start and End Nodes.#Every workflow should be somewhere started and somewhere finished. To create these places in our workflow we should create "Start" and "End" nodes. Simple click on "Start" on Toolbox and then click somewhere in Graphical area to create new Start-Node. Clicking on node name will allow you to edit it (another way: Select Node and in properties tab - at the bottom of Eclipse - select General and edit "Name" input-box)By same way you can create End-Node "Personal Task Finished"
For Start-Node we need to specify task - some action - some action, performed by person. To do in, select Start-Node in our workflow and in properties tab select "Task" and turn-on "Configure Task". In Enabled "Task" dialog we can specify task options: specify Name ("Start Personal Task") and some description on General Tab.
Specify User Variable#All tasks in EmForge has "Title" - there you can specify title for concrete task. But, let say in our case we need to specify one more additional property for all "Personal Tasks": "Category". To configure it go to "Controller Tab", select "Default" in Combobox, and "Add" new "User Variable" with properties:
Create Task Node and Transitions#OK, in start node we will start the task (Process Instance in jBPM term) - but after task will be started - it should be performed. So, we need to add node, there task itself will be performed. So, click on "Task Node" in Toolbox, and then click on Diagram to place it. Same, specify Node name (Perform Personal Task), and add Task into node: in the node properties select Tasks -> Right-Click on empty Listbox and "New Task". For this task, by same way as for start task, you can specify name and description.
Lets Add Required "Comments" Variable for this task, as we create variable for Start-Task.
Now, we need to link our nodes with transitions: select transition on Toolbox, and then click once on "Start Personal Task" Node and then second time on "Perform Personal Task" node. Transition will be created. by same way transition from "Perform Personal Task" to "Personal Task Finished" may be created. To simplify placing nodes on diagram you can turn-on grid ("View"->"Show Grid" in main menu) Specify owner of task#Every task in jBPM has the "actor", person, who will perform this task. Actor may be some user (specified by "actorId"), may be some swimlane (for example "Developers"), it is possible to specify own "assignmentHandler" - java-code, responsible to specify, who will be assigned to do this task.In our case we need "Perform Personal Task" be processed by same person, who created the Start-Task. To support such assignment EmForge stored name of user, created the Task in the special hidden variable "_owner" (Here you can get the list of special variables, created by EmForge) But you should not care about this variable at all. To be able to assign task to "Process Instance Owner" - you need simple specify task assignment to special "_processOwner" swimlane:
Next Article will describe how to deploy created workflow into EmForge. |
| Last Modified by Alexey Kakunin 1 year ago |