Jbpm5.1 introduction (4)

Source: Internet
Author: User
Tags jbpm

Eclipse plug-in

Requirement
Eclipse 3.6 or later

Graphiti framework, which uses the Update site

You can directly download and update graphiti.

Http://download.eclipse.org/graphiti/updates/0.7.1/

Update bpmn2.0 plug-in

Http://codehoop.com/bpmn2

You can also download it from the website and update it locally,

Https://github.com/droolsjbpm/bpmn2-eclipse-editor

Use eclipse to create hellojbpm

Open eclipse and create a jbpm Project

Enter the project name, followed by the next step

The project is created.

Modify Process Definition

Add two script tasks, modify the attributes, click nodes, and modify the attributes in the lower panel.

Add the code to be executed in action, either Java or mvel.

The process is shown as follows:

Execute the test process. The process will end directly and pass through two script tasks and output content.

public class ProcessTest {public static final void main(String[] args) {try {// load up the knowledge baseKnowledgeBase kbase = readKnowledgeBase();StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");// start a new process instanceksession.startProcess("com.sample.bpmn.hello");logger.close();} catch (Throwable t) {t.printStackTrace();}}private static KnowledgeBase readKnowledgeBase() throws Exception {KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();kbuilder.add(ResourceFactory.newClassPathResource("sample.bpmn"), ResourceType.BPMN2);return kbuilder.newKnowledgeBase();}}

Run the command to view the result.

Hello jbpm5 automated process goes down

 

Use eclipse to create hellojbpm

Open eclipse and import the sample project. The sample project path is jbpm-installer/sample/evaluation.

This is an example of an employee's self-evaluation and human resources and project manager approval. Two gateways in the middle are and, that is, the process must be completed after all the reviews of human resources and project managers are completed.

Employee: krisv

Human resources: Mary

Project Manager: John

See:

First run the example in the project to start the process

Select the human task view in the view.

At the beginning of the process, krisv began to add self-evaluation information. Then, the status is displayed in the human task view.

Enter krisv and refresh

You can see the process you want to process

Click Start to enter the inprogress status. Click Complete to end the process.

After the process is completed, enter a branch node. and is used to complete the process only after the personnel manager and project manager have passed the review.

If we enter Mary in the human task view, the to-do list of mary appears.

The process processing status is the same as that of krisv. You can also enter John to check that each person has a list of tasks to be processed, and you can see the results intuitively.

The process is completed only when both processes are completed.

Through the above example, we can see that manual nodes can be used, or script tasks can be added before the end or in the process to handle state changes at different times.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.