In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces "how to realize the node highlight color handled by flowable workflow". In the daily operation, I believe that many people have doubts about how to realize the node description highlight color handled by flowable workflow. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubt of "how to realize the node description highlight color handled by flowable workflow". Next, please follow the editor to study!
In a normal flowable, the current node is displayed, and the path needs to be obtained by ourselves, especially the rejection back and forth will lead to node confusion. Here is how to display the flow chart correctly.
Effect:
A process that has been completed
The process being executed
Code: 1. Generate pictures
/ / Source code www.fhadmin.orgpublic byte [] createImage2 (String processInstanceId) {/ / 1. Get the current process instance ProcessInstance processInstance = runtimeService.createProcessInstanceQuery (). ProcessInstanceId (processInstanceId). SingleResult (); String processDefinitionId = null;List activeActivityIds = null;//2. Get all the history track objects List list = historyService.createHistoricActivityInstanceQuery (). ProcessInstanceId (processInstanceId). List (); Map hisActivityMap = new HashMap (); list.forEach (historicActivityInstance-> {if (! hisActivityMap.containsKey (historicActivityInstance.getActivityId () {hisActivityMap.put (historicActivityInstance.getActivityId (), historicActivityInstance);}}); / / 3. Get the process definition id and the highlighted node idif (processInstance! = null) {/ / 3.1. Running process instance processDefinitionId = processInstance.getProcessDefinitionId (); activeActivityIds = runtimeService.getActiveActivityIds (processInstanceId);} else {/ / 3.2. Closed process instance HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery (). ProcessInstanceId (processInstanceId). SingleResult (); processDefinitionId = historicProcessInstance.getProcessDefinitionId (); activeActivityIds = new ArrayList (); List endEvents = bpmnModelService.findEndFlowElement (processDefinitionId); List finalActiveActivityIds = activeActivityIds; endEvents.forEach (endEvent-> {if (hisActivityMap.containsKey (endEvent.getId () {finalActiveActivityIds.add (endEvent.getId () });} / / 4. Get all the node information defined by the process List flowNodes = bpmnModelService.findFlowNodes (processDefinitionId); Map activityMap = flowNodes.stream (). Collect (Collectors.toMap (FlowNode::getId, flowNode-> flowNode)); List highLightedFlows = new ArrayList (); / / 5. The highlight line activeActivityIds.forEach (activeActivityId-> this.getHighLightedFlows (activityMap, hisActivityMap, activeActivityId, highLightedFlows, activeActivityId) is obtained recursively. Get the bpmnModel object BpmnModel bpmnModel = bpmnModelService.getBpmnModelByProcessDefId (processDefinitionId); / / 7. Generate image stream InputStream inputStream = flowProcessDiagramGenerator.generateDiagram (bpmnModel, activeActivityIds, highLightedFlows); / / 8. Convert to byte to facilitate network transmission byte [] datas = IoUtil.readInputStream (inputStream, "image inputStream name"); return datas;}
Recursively get high
/ / java project www.fhadmin.orgprivate void getHighLightedFlows (Map flowNodeMap,Map hisActivityMap,String activeActivityId, List highLightedFlows,String oldActivityId) {FlowNode flowNode = flowNodeMap.get (activeActivityId); List incomingFlows = flowNode.getIncomingFlows (); for (SequenceFlow sequenceFlow: incomingFlows) {String sourceRefId = sequenceFlow.getSourceRef (); if (hisActivityMap.containsKey (sourceRefId) & &! oldActivityId.equals (sourceRefId)) {highLightedFlows.add (sequenceFlow.getId ()) This.getHighLightedFlows (flowNodeMap, hisActivityMap, sourceRefId, highLightedFlows, oldActivityId);} else {if (hisActivityMap.containsKey (sourceRefId)) {highLightedFlows.add (sequenceFlow.getId ());} break At this point, the study on "how to realize the node highlight color processed by flowable workflow" is over. I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.