BOS Project Exercise (based on Activiti logistics distribution process, start, inquiry, processing, Project Knowledge Point Review)

Source: Internet
Author: User

Content:

1, design logistics distribution process

2. Start the logistics distribution process

3. Query Group task, pick Group task

4. Query personal tasks and personal tasks

1. Design the logistics distribution process

Logistics and distribution process

Task assignment based on group tasks, using exclusive gateways, branching selection using process variable implementations

Activiti Graphical Interface:

The ID value of the process corresponds to the key value in the flow definition table and can be used to start the latest version of the process instance



In the Task node:

The general ID value corresponds to the Task_def_key value in the task table that defines the method name for the task in Taskaction in the project Taskdefinitionkey



The value of the candidate Grops property of the Main config corresponds to the name of the roles role, the ID value of group in the Activiti table (role and group synchronization are saved when the value of the group Id should be set to the name of role, Because the ID value is UUID is not easy to read)



exclusive Gateway, branch selection using process variable implementation, condition expression in condition gets the value in the process variable to determine true or false to select branch

2. Start the process delivery process

Step One: Provide a list method in the work order Management workordermanageaction to query a work order with a start status of "0"

Service Code:

[Java] view plain copy public list<workordermanage> Findlistnotstart () {Detachedcriteria Detachedc       Riteria = Detachedcriteria. Forclass (Workordermanage.class);       Add Condition: Start = = 0 Detachedcriteria.add (restrictions.eq ("Start", "0"));   Return workordermanagedao.findbycondition (Detachedcriteria); }

Step two : Configure Struts.xml

Step three : Provide startranster.jsp page, show work order

Fourth Step : Start the Logistics delivery process by providing the Start method in the Work Order management action

Service Code:

Get the Workordermanage object by ID set start status to 1 start state, and start the logistics delivery process instance

[Java] View Plain copy @Resource private processengine processengine; Start the logistics distribution process, set the work order object to the process variable public void start (String id) {Workordermanage workordermanage = Workordermanagedao.fin       Dbyid (ID);       Workordermanage.setstart ("1"); String Processdefinitionkey = "transfer";//Logistics Distribution Process key map<string, object> variables = new hashmap<string, O       Bject> ();       Variables.put ("Business Data", workordermanage);   Processengine.getruntimeservice (). Startprocessinstancebykey (Processdefinitionkey, variables); }

3. Query group Tasks

First step : Create a taskaction, provide findgrouptask, query the group (public) task of the currently logged on user

[Java]   View plain  copy @Controller    @Scope ("prototype")    public class taskaction extends actionsupport {       @ resource       private ProcessEngine processEngine;           /**       *  Query group tasks         */       public string findgrouptask ()  {           //  Task Queries             taskquery query = processengine.gettaskservice (). Createtaskquery ();           string candidateuser = boscontext.getloginuser ( ). GetId ();  

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.