JBPM API Initial Knowledge

Source: Internet
Author: User
Tags jbpm

JBPM provides us with a range of services for managing processes. From defining processes to instantiating process definitions, process instance execution, process management, process completion, historical processes, and management. JBPM 's process management provides a complete APIto improve the efficiency of process execution.

JBPM the services provided API for us to achieve:

(1) Process Deployment

(2) Process Instance

(3) Process Tasks

(4) Process History

Processengine provides a 6 a service API . processengine is built by The configuration class, which is generated by the workflow engine based on the configurations.

(1) Repositoryservice --Interface of the process Resource service. Provides deployment, query, delete, and other actions on the process definition

(2) Executionservice --interface of the Process Execution service. Provides an example of starting a process, performing a push, setting a process variable, and so on.

(3) Managementservice --interface of the Process management Control service.

(4) Taskservice --Task service interface. Provides operations such as creating, submitting, querying, saving, and deleting tasks.

(5) Historyservice --Process History service interface. Provides queries for records such as historical process instances, historical activity instances, and so on.

(6) Identityservice --The interface of the identity authentication service. Provides services related to process users, user groups, and group memberships.

PrivateRepositoryservice repositoryservice;// deployment Process Service

Privateexecutionservice executionservice;// Process Execution Service

Privatetaskservice taskservice;// Task Service

Privatehistoryservice historyservice;// History Service

Privatemanagementservice managementservice;// Process Management Services

Privateidentityservice identityservice;// identity Authentication Service

Processengineprocessengine = Configuration.getprocessengine ();

Repositoryservice=processengine.getrepositoryservice ();

Executionservice=processengine.getexecutionservice ();

Taskservice=processengine.gettaskservice ();

Historyservice=processengine.gethistoryservice ();

Managementservice=processengine.getmanagementservice ();

Identityservice=processengine.getidentityservice ();

}

1 , the deployment process definition

public void Deploy () {

Repositoryservice.createdeployment (). Addresourcefromclasspath ("Task.jpdl.xml"). Deploy ()

}

2. Start the process instance

Public Voidcreateinstance () {

Processinstanceprocessinstance = Executionservice.startprocessinstancebykey ("task");

print (" process instance ID", Processinstance.getid ());

}

3 , get personal tasks

Public void Get Personal Task (StringuserId) {

list<task>tasks=taskservice.findpersonaltasks (userId); // get personal tasks based on the name of the person who handles

print (" number of tasks ", tasks.size ());

print (" Task Name ", Tasks.get (0). Getactivityname ());

print (" task ID", Tasks.get (0). GetId ());

}

4 , gets the group task

Public void Get Grouptask s (String userId) {

list<task> taskList =processengine.gettaskservice (). Findgrouptasks (userId); // get group tasks according to the name of the person who processed

}

5 , assign Tasks

public void Assintask (String taskid,string userId) {

Taskservice. Assigntask (taskId,userId); // the Task Id to be taskId the tasks assigned to userId

}

6 , Pickup task

public void Tasktask (String taskid,string userId) {

Taskservice. Taketask (taskId,userId); // User userId Pickup Task taskId

}

5 to get the current task

Public void GetCurrent Task (String processinstanceid) { stringname=executionservice.createprocessinstancequery (). Processinstanceid (proce Ssinstanceid). Uniqueresult (). Findactiveactivitynames (). toString ();

// Depending on the process instance Id get the task you are currently performing

print (" current node name:", name);

}   

6 , complete the task

Public void Completetask (String taskId) {

taskservice.completetask (taskId); // according to the task Id , complete the task

}

......

JBPM Span lang= "ZH-CN" provides the entire process management of the service API jbpm provides api almost perfect, of course, there are a few imperfect places, but enough to apply. To be proficient in using the jbpm api Span lang= "ZH-CN" is the first step.

at present, the university JBPM the application arrangement, the first stage: complete several Demo , to be familiar with API and the second stage: combining the specific business in universities, combining JBPM , the third stage: according to the business JBPM the application of the public part of the abstract; Stage four: study back, sign, free flow, Fifth stage: revision, Perfection, sixth stage: application; seventh stage: maintenance, improvement

currently in the 23rd stage, that is, the start + Ascension phase.

JBPM API Initial Knowledge

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.