Activiti comment information

Source: Internet
Author: User

You need to describe some comments when submitting a task each time. For example, you need to describe the reason for asking for leave when submitting the leave process. If the leader rejects the request, you can annotate the reason for rejection.

1. Add comments   

// Because the process user context object is thread-independent, you must set it at the desired position to ensure that the setting and obtaining operations are authentication in the same thread. setauthenticateduserid (usercontext. get (). getname (); // The Name Of The annotator must be written. Otherwise, you do not know the person information when viewing it. // Add the annotator taskservice. addcomment (taskid, null, comment); // comment is the annotation content // complete taskservice. complete (taskid, vars); // vars is a variable.

  2. Obtain the annotation content

Public list <comment> getprocesscomments (string taskid) {list <comment> historycommnets = new arraylist <> (); // 1) obtain the ID of the Process instance task = This. taskservice. createtaskquery (). taskid (taskid ). singleresult (); processinstance Pi = runtimeservice. createprocessinstancequery (). processinstanceid (task. getprocessinstanceid ()). singleresult (); // 2) query all historical activity lists (User Task Type) through the process instance 

3. Display comments when preparing the task form page (put the list above into the value stack and traverse it using the struts2 tag)   

<! -- Display all the comments, for example, Zhang San: Hello, Li Si: You are also good --> <s: iterator value = "# comments"> <s: date name = "time" format = "yyyy-mm-dd hh: mm"/> <br/> <s: property value = "userid"/>:< s: property value = "fullmessage"/> <br/> </S: iterator>

 

 

  

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.