Activiti (Workflow) How to correlate business tables

Source: Internet
Author: User

1. Deployment process (define process)
1 New fileinputstream (file); 2 New Zipinputstream (in); 3 processengine.  This . Getrepositoryservice () 4              . Createdeployment ()5             . Name (processName)6             . Addzipinputstream (zipinputstream)7              . Deploy ();
View Code2. Start the process (one instance of the defined process)
1 processengine (). Getruntimeservice () 2          /**  */3          . Startprocessinstancebykey ("Leave", "Leavebill", variables);
View Code

In this way, the business table is associated with the Activiti table (generally for convenience, a ProcessID is also stored in the business tables)

The correlation between its internal tables is as follows

3. View a person's task
1 /**2 * Tasks to be performed by the current login in the system (including personal tasks + group tasks)3      */4      PublicList<task>Gettasksbyassignee (String userId) {5List<task> Assigneetasks = This. Gettaskservice ()6 . Createtaskquery ()7. Taskassignee (UserId)//Participant, personal task query8 . Orderbytaskcreatetime ()9 . Desc ()Ten . List (); OneList<task> Candidatetasks = This. Gettaskservice () A . Createtaskquery () -. Taskcandidateuser (UserId)//contributor, group task query - . Orderbytaskcreatetime () the . Desc () - . List (); - Assigneetasks.addall (candidatetasks); -         returnAssigneetasks; +}
View Code4. According to task-"processinstance-" businesskey-"business table
1     /**2 * Find Businesskey according to TaskID3      */4      Publicstring Getbusinesskeybytaskid (String taskId) {5Task task = This. Processengine6 . Gettaskservice ()7 . Createtaskquery ()8 . TaskId (taskId)9 . Singleresult ();TenProcessInstance pi = This. Getruntimeservice () One . Createprocessinstancequery () A . Processinstanceid (Task.getprocessinstanceid ()) - . Singleresult (); -         returnPi.getbusinesskey (); the}
View Code

Activiti (Workflow) How to correlate business tables

Related Article

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.