Java Activiti (4)--Querying historical task data and other information

Source: Internet
Author: User
Tags data structures
public class Activitihistorytest {private Processengine processengine = Processengines.getdefaultprocessengine (); 1. Deployment process definition @Test public void Deployleave () throws Exception {Deploymentbuilder builder = Processengin
        E.getrepositoryservice (). Createdeployment ();
        Builder.addclasspathresource ("FLOW/BAOXIAO.BPMN");
        Builder.addclasspathresource ("Flow/baoxiao.png");
        Builder.name ("Reimbursement process Deployment");
        Deployment deploy = Builder.deploy ();
    System.out.println ("deploy.getid () = =" + Deploy.getid ());
        //2, START process instance based on process definition key, the highest @Test public void Startprocessinstancebykey () throws Exception {
        String Processdefinitionkey = "Baoxiaoflow"; ProcessInstance processinstance = Processengine.getruntimeservice (). Startprocessinstancebykey (
        Processdefinitionkey);
        System.out.println ("processinstance.getid () = =" + Processinstance.getid ()); System.out.println ("Processinstance.getprocessdefinitionid ()" == = "+ Processinstance.getprocessdefinitionid ());
        //3, according to the process example, Query task list, explain a process definition corresponding to multiple process instances, a process instance corresponding to multiple task lists @Test public void Getprocesstask () throws Exception {
        String Processinstanceid = "5001";
        1 String assignee = "Tom";
        2//string assignee = "Jack";
        3//string Assignee = "Smith";
        Task List Taskquery taskquery = Processengine.gettaskservice (). Createtaskquery ();
        Query Tom's Task List Taskquery.taskassignee (assignee);
        Taskquery.orderbytaskcreatetime (). DESC ();
        list<task> tasks = Taskquery.list ();
        for (Task task:tasks) {System.out.println (Task.getid () + ":" + task.getname ()); }//4, processing tasks, after the completion of the third step will not find the task of Tom, ran to the next Jack's task, 5 and 6 are mutually repeated @Test public void Dealprocesstask () throws Ex  ception {//string taskId = "12506";//Submit String taskId = "37509"; Project manager approves Processengine.gettaskservice (). Complete (TASKID); //5.1, query history act_hi_procinst @Test public void Queryprocesstaskhistory () throws Exception {Historic
        Processinstancequery query = Processengine.gethistoryservice (). Createhistoricprocessinstancequery ();
        Query.orderbyprocessdefinitionid (). DESC ();
        Query.orderbyprocessinstanceendtime (). ASC ();
        list 

————————————————————————————————————————————————— – Java Architect Project Combat, high concurrency cluster distributed, large data high availability video tutorials, total 760G

Download Address:

https://item.taobao.com/item.htm?id=555888526201

01. High-level architect 42 Phases
02.Java Advanced System Training Architecture Course 148 hours
03.Java Senior Internet Architect Course
04.Java Internet Architecture Netty, Nio, Mina, etc.-Video tutorials
05.Java Advanced Architecture Design 2016 finishing-video tutorials
06. Architect Foundation, advanced film
07.Java Architect Required Linux Operation series courses
08.Java Advanced System Training Architecture Course 116 hours
+
Hadoop series tutorials, Java design patterns and data structures, Spring Cloud Micro service, Springboot Primer

—————————————————————————————————————————————————–

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.