Let Activiti record variable history information

Source: Internet
Author: User

You may be troubled by this problem, because you need to get the value of the variables set in the process when you track the completed process (you can analyze the detailed status of each node), and today we'll explore how.

1.ACTIVITI Table Structure Design

The table structure design of Activiti is divided into two types: runtime (Act_ru), History (Act_hi).

1.1 Run-time variables

All runtime variables are stored in the table:act_ru_variable , which can be inserted into the database in the startup process, the completion of the task, and the dynamic addition, so that the process can determine the direction of the process based on the value of the variable in its processing.

1.2 What about historical variables?

Why not act_hi_variable this watch?

I was also troubled at the beginning. Why not have this table, resulting in the tracking of historical process information can not get variables.

2. Understanding Historical Levels

Activit provides a 4 history level by default:

    • None: The system performance can be improved by not saving any history records;

    • activity: Save all the process instances, tasks, activity information;

    • Audit: is also the default level of Activiti, saving all process instances, tasks, activities, form attributes;

    • Full: The most complete history, in addition to the information containing the audit level, can be saved in detail, for example: process variables.

For several levels, depending on the requirements of the feature, you can turn on full if you need to track details later.

3. Configure the history level3.1 Configuring in XML

Configuration in Engine beanprocessengineconfiguration :

<bean id= "processengineconfiguration" class= "Org.activiti.spring.SpringProcessEngineConfiguration" > < Property name= ' History ' value= ' full ' ></property></bean>
3.2 Dynamic Configuration
Processengine processengine = processengineconfiguration. Createprocessengineconfigurationfromresourcedefault (). Sethistory ("full"). Buildprocessengine ();
4. Reading historical variables

Now restart your app, start the process or view the data for the act_hi_detail table after the task complete has been recorded.

4.1 Java code-before version 5.10
list4.2 Java code-after version 5.11

Version 5.11 has been changed in terms of variable saving, creating a single table act_hi_varinst Save variables, you can read the variables in the code below. See also: Activiti 5.11 Release

list5. Read Only form fields
list

Let Activiti record variable history information

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.