In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how springboot2 uses the activiti6 idea plug-in. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Activiti BPMN visualizer plug-in
Import com.alibaba.fastjson.JSON;import com.schinta.util.DateTimeUtil;import lombok.extern.slf4j.Slf4j;import org.activiti.engine.*;import org.activiti.engine.history.*;import org.activiti.engine.impl.identity.Authentication;import org.activiti.engine.repository.Deployment;import org.activiti.engine.runtime.ProcessInstance;import org.activiti.engine.task.Comment;import org.activiti.engine.task.Task;import org.junit.jupiter.api.Test;import org.springframework.beans.factory.annotation.Autowired Import org.springframework.boot.test.context.SpringBootTest;import org.springframework.util.CollectionUtils;import java.util.*;//spring boot2 Integration activiti6 A series of exception documents https://www.jianshu.com/p/77fa5f932f4f@Slf4j@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) class WebApplicationTests {@ Autowired private ProcessEngine processEngine; private RepositoryService repositoryService; private RuntimeService runtimeService; private TaskService taskService; private HistoryService historyService @ Test public void deployProcess () {/ / deployment template Deployment deploy = repositoryService.createDeployment () .addClasspathResource ("processes/wh.bpmn20.xml") .deploy (); System.out.println (deploy.getId ());} public void start () {String instanceKey = "wh"; log.info ("start the leave process.") Map map = new HashMap (); / / in wh.bpmn, the task of filling out the leave application is dynamically passed into userId, which simulates an id map.put ("user1", 1); map.put ("user2", 2); Authentication.setAuthenticatedUserId ("1"); ProcessInstance instance = runtimeService.startProcessInstanceByKey (instanceKey, map) Log.info ("start process instance successfully: {}", instance); log.info ("process instance ID: {}", instance.getId ()); log.info ("process definition ID: {}", instance.getProcessDefinitionId ()); public void taskQuery () {/ / query all self-initiated approvals / List historicProcessInstanceList = historyService.createHistoricProcessInstanceQuery (). StartedBy (userId). List () / / according to the key defined by the process, the person in charge assignee implements the current user's to-do list query List list = taskService.createTaskQuery () .processDefinitionKey (instanceKey) .taskAssignee ("2") .list () If (list! = null & & list.size () > 0) {for (Task task: list) {System.out.println ("Task ID:" + task.getId ()); System.out.println ("Task name:" + task.getName ()); System.out.println ("creation time of the task:" + task.getCreateTime ()) System.out.println ("Task Manager:" + task.getAssignee ()); System.out.println ("process instance ID:" + task.getProcessInstanceId ()); System.out.println ("execution object ID:" + task.getExecutionId ()); System.out.println ("process definition ID:" + task.getProcessDefinitionId ()) System.out.println ("getOwner:" + task.getOwner ()); System.out.println ("getCategory:" + task.getCategory ()); System.out.println ("getDescription:" + task.getDescription ()); System.out.println ("getFormKey:" + task.getFormKey ()); Map map = task.getProcessVariables () For (Map.Entry m: map.entrySet ()) {System.out.println ("key:" + m.getKey () + "value:" + m.getValue ()) } for (Map.Entry m: task.getTaskLocalVariables (). EntrySet ()) {} / * * approval * / public void employeeApply () {String instanceId = "130001"; / / execute process instance id Task task = taskService.createTaskQuery () .processInstanceId (instanceId) .singleResult () / / agree or not, 1 dismiss map.put ("status", "0"); taskService.addComment (task.getId (), instanceId, "Test Review 34"); taskService.complete (task.getId (), map); log.info ("process push to the next step") * instance details public void queryHistoryTask () {List list = historyService.createHistoricTaskInstanceQuery () / create historical activity instance query .processInstanceId (instanceId) / execute process instance id .orderByTaskCreateTime () .asc () for (HistoricTaskInstance hai: list) {System.out.println ("=") System.out.println ("activity ID:" + hai.getId ()); System.out.println ("process instance ID:" + hai.getProcessInstanceId ()); System.out.println ("activity name:" + hai.getName ()); System.out.println ("Manager:" + hai.getAssignee ()) System.out.println ("start time:" + hai.getStartTime ()); System.out.println ("end time:" + hai.getEndTime ()); List comments = taskService.getTaskComments (hai.getId ()); System.out.println ("comments:" + JSON.toJSONString (comments));} Thank you for reading! This is the end of this article on "how to use the activiti6 idea plug-in for springboot2". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.