Commit 08c32267 authored by Sun's avatar Sun
Browse files

no commit message

parent e9629e7a
1、官网下载dubbo源码
https://github.com/alibaba/dubbo
2、编译dubbo-admin工程,打成war包 dubbo-admin-2.5.8.war
3、进入 WEB-INF 目录修改文件 dubbo.properties
dubbo.registry.address=zookeeper://127.0.0.1:2181
dubbo.admin.root.password=root
dubbo.admin.guest.password=guest
4、在tomcat 中部署dubbo-admin-2.5.8.war
5、用户密码都root/root
@echo off
rem /**
rem */
echo.
echo [Ϣ] ļ
echo.
echo.
cd /d %~dp0
cd..
call mvn clean
cd bin
pause
\ No newline at end of file
@echo off
rem /**
rem */
echo.
echo [Ϣ] compileļ
echo.
cd /d %~dp0
cd..
call mvn compile
cd bin
pause
\ No newline at end of file
@echo off
rem /**
rem */
echo.
echo [Ϣ] ģwebappjeespring-web
echo.
pause
cd /d %~dp0
cd..
xcopy jeespring-cms\src\main\webapp\*.* jeespring-web\src\main\webapp /s /e /y
xcopy jeespring-company\src\main\webapp\*.* jeespring-web\src\main\webapp /s /e /y
cd bin
pause
\ No newline at end of file
@echo off
rem /**
rem */
echo.
echo [info] del project info and target?
echo.
cd ..\
if exist .\jeespring-web\target (
rmdir /s/q .\jeespring-web\target
echo [info] del .\jeespring-web\target
)
if exist .\jeespring-web\.settings (
rmdir /s/q .\jeespring-web\.settings
echo [info] del .\jeespring-web\.settings
)
del .\jeespring-web\.classpath
del .\jeespring-web\.project
if exist .\jeespring-webDubboProvider\target (
rmdir /s/q .\jeespring-webDubboProvider\target
echo [info] del .\jeespring-webDubboProvider\target
)
if exist .\jeespring-webDubboProvider\.settings (
rmdir /s/q .\jeespring-webDubboProvider\.settings
echo [info] del .\jeespring-webDubboProvider\.settings
)
del .\jeespring-webDubboProvider\.classpath
del .\jeespring-webDubboProvider\.project
if exist .\jeespring-mq\target (
rmdir /s/q .\jeespring-mq\target
echo [info] del .\jeespring-mq\target
)
if exist .\jeespring-mq\.settings (
rmdir /s/q .\jeespring-mq\.settings
echo [info] del .\jeespring-mq\.settings
)
del .\jeespring-mq\.classpath
del .\jeespring-mq\.project
if exist .\jeespring-framework\target (
rmdir /s/q .\jeespring-framework\target
echo [info] del .\jeespring-framework\target
)
if exist .\jeespring-framework\.settings (
rmdir /s/q .\jeespring-framework\.settings
echo [info] del .\jeespring-framework\.settings
)
del .\jeespring-framework\.classpath
del .\jeespring-framework\.project
if exist .\jeespring-company\target (
rmdir /s/q .\jeespring-company\target
echo [info] del .\jeespring-company\target
)
if exist .\jeespring-company\.settings (
rmdir /s/q .\jeespring-company\.settings
echo [info] del .\jeespring-company\.settings
)
del .\jeespring-company\.classpath
del .\jeespring-company\.project
if exist .\jeespring-cms\target (
rmdir /s/q .\jeespring-cms\target
echo [info] del .\jeespring-cms\target
)
if exist .\jeespring-cms\.settings (
rmdir /s/q .\jeespring-cms\.settings
echo [info] del .\jeespring-cms\.settings
)
del .\jeespring-cms\.classpath
del .\jeespring-cms\.project
if exist .\jeespring-act\target (
rmdir /s/q .\jeespring-act\target
echo [info] del .\jeespring-act\target
)
if exist .\jeespring-act\.settings (
rmdir /s/q .\jeespring-act\.settings
echo [info] del .\jeespring-act\.settings
)
del .\jeespring-act\.classpath
del .\jeespring-act\.project
if exist .\jeespring-gencode\target (
rmdir /s/q .\jeespring-gencode\target
echo [info] del .\jeespring-gencode\target
)
if exist .\jeespring-gencode\.settings (
rmdir /s/q .\jeespring-gencode\.settings
echo [info] del .\jeespring-gencode\.settings
)
del .\jeespring-gencode\.classpath
del .\jeespring-gencode\.project
if exist .\.settings (
rmdir /s/q .\.settings
echo [info] del .\.settings
)
del .project
echo [info] deal end
pause
\ No newline at end of file
@echo off
rem /**
rem */
echo.
echo [Ϣ] Eclipseļ
echo.
cd /d %~dp0
cd..
call mvn -Declipse.workspace=%cd% eclipse:eclipse
cd bin
pause
\ No newline at end of file
@echo off
rem /**
rem */
echo.
echo [info] del project info and target.
echo.
cd ..\
if exist .\jeespring-web\target (
rmdir /s/q .\jeespring-web\target
echo [info] del .\jeespring-web\target
)
del .\jeespring-web\*.iml
if exist .\jeespring-webDubboProvider\target (
rmdir /s/q .\jeespring-webDubboProvider\target
echo [info] del .\jeespring-webDubboProvider\target
)
del .\jeespring-webDubboProvider\*.iml
if exist .\jeespring-mq\target (
rmdir /s/q .\jeespring-mq\target
echo [info] del .\jeespring-mq\target
)
del .\jeespring-mq\*.iml
if exist .\jeespring-framework\target (
rmdir /s/q .\jeespring-framework\target
echo [info] del .\jeespring-mq\target
)
del .\jeespring-framework\*.iml
if exist .\jeespring-company\target (
rmdir /s/q .\jeespring-company\target
echo [info] del .\jeespring-company\target
)
del .\jeespring-company\*.iml
if exist .\jeespring-cms\target (
rmdir /s/q .\jeespring-cms\target
echo [info] del .\jeespring-cms\target
)
del .\jeespring-cms\*.iml
if exist .\jeespring-act\target (
rmdir /s/q .\jeespring-act\target
echo [info] del .\jeespring-act\target
)
del .\jeespring-act\*.iml
if exist .\jeespring-gencode\target (
rmdir /s/q .\jeespring-gencode\target
echo [info] del .\jeespring-gencode\target
)
del .\jeespring-gencode\*.iml
if exist .\projectFilesBackup (
rmdir /s/q .\projectFilesBackup
echo [info] del .\projectFilesBackup
)
del jeespring.iml
del jeespring.ipr
del jeespring.iws
echo [info] deal end
pause
\ No newline at end of file
@echo off
rem /**
rem */
echo.
echo [Ϣ] Eclipseļ
echo.
cd /d %~dp0
cd..
call mvn idea:idea
cd bin
pause
\ No newline at end of file
@echo off
rem /**
rem */
echo.
echo [Ϣ] install
echo.
cd /d %~dp0
cd..
call mvn install -f pom-install.xml
cd bin
pause
\ No newline at end of file
@echo off
rem /**
rem */
echo.
echo [Ϣ] packageļ
echo.
cd /d %~dp0
cd..
call mvn package
cd bin
pause
\ No newline at end of file
@echo off
rem /**
rem */
echo.
echo [Ϣ] йļ
echo.
cd /d %~dp0
cd ../jeespring-web/target
java -jar jeespring-web-3.0.0.war
cd bin
pause
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.jeespring</groupId>
<artifactId>jeespring-act</artifactId>
<name>jeespring-act</name>
<description>jeespring-act</description>
<version>1.0.0</version>
<packaging>jar</packaging>
<parent>
<groupId>com.jeespring</groupId>
<artifactId>jeespring</artifactId>
<version>1.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>com.jeespring</groupId>
<artifactId>jeespring-framework</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
</project>
\ No newline at end of file
/**
* Copyright &copy; 2012-2016 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpring</a> All rights reserved.
*/
package com.jeespring.common.persistence;
import java.io.Serializable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.jeespring.modules.act.entity.Act;
/**
* Activiti Entity类
* @author JeeSpring
* @version 2013-05-28
*/
public abstract class ActEntity<T> extends AbstractBaseEntity<T> implements Serializable {
private static final long serialVersionUID = 1L;
protected Act act; // 流程任务对象
public ActEntity() {
super();
}
public ActEntity(String id) {
super(id);
}
@JsonIgnore
public Act getAct() {
if (act == null){
act = new Act();
}
return act;
}
public void setAct(Act act) {
this.act = act;
}
/**
* 获取流程实例ID
* @return
*/
public String getProcInsId() {
return this.getAct().getProcInsId();
}
/**
* 设置流程实例ID
* @param procInsId
*/
public void setProcInsId(String procInsId) {
this.getAct().setProcInsId(procInsId);
}
}
package com.jeespring.modules.act;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
@Configuration
@ImportResource(locations= {"classpath:spring-context-activiti.xml"})
public class ActConfig{
}
/**
* Copyright &copy; 2012-2016 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpring</a> All rights reserved.
*/
package com.jeespring.modules.act.dao;
import com.jeespring.common.persistence.InterfaceBaseDao;
import com.jeespring.common.persistence.annotation.MyBatisDao;
import com.jeespring.modules.act.entity.Act;
import org.apache.ibatis.annotations.Mapper;
/**
* 审批DAO接口
* @author thinkgem
* @version 2014-05-16
*/
@Mapper
public interface ActDao extends InterfaceBaseDao<Act> {
public int updateProcInsIdByBusinessId(Act act);
}
/**
* Copyright &copy; 2012-2016 <a href="https://gitee.com/JeeHuangBingGui/jeeSpringCloud">JeeSpring</a> All rights reserved.
*/
package com.jeespring.modules.act.entity;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.activiti.engine.history.HistoricActivityInstance;
import org.activiti.engine.history.HistoricTaskInstance;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.jeespring.common.persistence.AbstractBaseEntity;
import com.jeespring.common.utils.StringUtils;
import com.jeespring.common.utils.TimeUtils;
import com.jeespring.modules.act.utils.Variable;
/**
* 工作流Entity
* @author JeeSpring
* @version 2013-11-03
*/
public class Act extends AbstractBaseEntity<Act> {
private static final long serialVersionUID = 1L;
private String taskId; // 任务编号
private String taskName; // 任务名称
private String taskDefKey; // 任务定义Key(任务环节标识)
private String procInsId; // 流程实例ID
private String procDefId; // 流程定义ID
private String procDefKey; // 流程定义Key(流程定义标识)
private String businessTable; // 业务绑定Table
private String businessId; // 业务绑定ID
private String title; // 任务标题
private String status; // 任务状态(todo/claim/finish)
// private String procExecUrl; // 流程执行(办理)RUL
private String comment; // 任务意见
private String flag; // 意见状态
private Task task; // 任务对象
private ProcessDefinition procDef; // 流程定义对象
private ProcessInstance procIns; // 流程实例对象
private HistoricTaskInstance histTask; // 历史任务
private HistoricActivityInstance histIns; //历史活动任务
private String assignee; // 任务执行人编号
private String assigneeName; // 任务执行人名称
private Variable vars; // 流程变量
// private Variable taskVars; // 流程任务变量
private Date beginDate; // 开始查询日期
private Date endDate; // 结束查询日期
private List<Act> list; // 任务列表
public Act() {
super();
}
public String getTaskId() {
if (taskId == null && task != null){
taskId = task.getId();
}
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public String getTaskName() {
if (taskName == null && task != null){
taskName = task.getName();
}
return taskName;
}
public void setTaskName(String taskName) {
this.taskName = taskName;
}
public String getTaskDefKey() {
if (taskDefKey == null && task != null){
taskDefKey = task.getTaskDefinitionKey();
}
return taskDefKey;
}
public void setTaskDefKey(String taskDefKey) {
this.taskDefKey = taskDefKey;
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
public Date getTaskCreateDate() {
if (task != null){
return task.getCreateTime();
}
return null;
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
public Date getTaskEndDate() {
if (histTask != null){
return histTask.getEndTime();
}
return null;
}
@JsonIgnore
public Task getTask() {
return task;
}
public void setTask(Task task) {
this.task = task;
}
@JsonIgnore
public ProcessDefinition getProcDef() {
return procDef;
}
public void setProcDef(ProcessDefinition procDef) {
this.procDef = procDef;
}
public String getProcDefName() {
return procDef.getName();
}
@JsonIgnore
public ProcessInstance getProcIns() {
return procIns;
}
public void setProcIns(ProcessInstance procIns) {
this.procIns = procIns;
if (procIns != null && procIns.getBusinessKey() != null){
String[] ss = procIns.getBusinessKey().split(":");
setBusinessTable(ss[0]);
setBusinessId(ss[1]);
}
}
// public String getProcExecUrl() {
// return procExecUrl;
// }
//
// public void setProcExecUrl(String procExecUrl) {
// this.procExecUrl = procExecUrl;
// }
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
@JsonIgnore
public HistoricTaskInstance getHistTask() {
return histTask;
}
public void setHistTask(HistoricTaskInstance histTask) {
this.histTask = histTask;
}
@JsonIgnore
public HistoricActivityInstance getHistIns() {
return histIns;
}
public void setHistIns(HistoricActivityInstance histIns) {
this.histIns = histIns;
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
public Date getBeginDate() {
return beginDate;
}
public void setBeginDate(Date beginDate) {
this.beginDate = beginDate;
}
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public String getFlag() {
return flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
public String getProcDefId() {
if (procDefId == null && task != null){
procDefId = task.getProcessDefinitionId();
}
return procDefId;
}
public void setProcDefId(String procDefId) {
this.procDefId = procDefId;
}
public String getProcInsId() {
if (procInsId == null && task != null){
procInsId = task.getProcessInstanceId();
}
return procInsId;
}
public void setProcInsId(String procInsId) {
this.procInsId = procInsId;
}
public String getBusinessId() {
return businessId;
}
public void setBusinessId(String businessId) {
this.businessId = businessId;
}
public String getBusinessTable() {
return businessTable;
}
public void setBusinessTable(String businessTable) {
this.businessTable = businessTable;
}
public String getAssigneeName() {
return assigneeName;
}
public void setAssigneeName(String assigneeName) {
this.assigneeName = assigneeName;
}
public String getAssignee() {
if (assignee == null && task != null){
assignee = task.getAssignee();
}
return assignee;
}
public void setAssignee(String assignee) {
this.assignee = assignee;
}
public List<Act> getList() {
return list;
}
public void setList(List<Act> list) {
this.list = list;
}
public Variable getVars() {
return vars;
}
public void setVars(Variable vars) {
this.vars = vars;
}
/**
* 通过Map设置流程变量值
* @param map
*/
public void setVars(Map<String, Object> map) {
this.vars = new Variable(map);
}
// public Variable getTaskVars() {
// return taskVars;
// }
//
// public void setTaskVars(Variable taskVars) {
// this.taskVars = taskVars;
// }
//
// /**
// * 通过Map设置流程任务变量值
// * @param map
// */
// public void setTaskVars(Map<String, Object> map) {
// this.taskVars = new Variable(map);
// }
/**
* 获取流程定义KEY
* @return
*/
public String getProcDefKey() {
if (StringUtils.isBlank(procDefKey) && StringUtils.isNotBlank(procDefId)){
procDefKey = StringUtils.split(procDefId, ":")[0];
}
return procDefKey;
}
public void setProcDefKey(String procDefKey) {
this.procDefKey = procDefKey;
}
/**
* 获取过去的任务历时
* @return
*/
public String getDurationTime(){
if (histIns!=null && histIns.getDurationInMillis() != null){
return TimeUtils.toTimeString(histIns.getDurationInMillis());
}
return "";
}
/**
* 是否是一个待办任务
* @return
*/
public boolean isTodoTask(){
return "todo".equals(status) || "claim".equals(status);
}
/**
* 是否是已完成任务
* @return
*/
public boolean isFinishTask(){
return "finish".equals(status) || StringUtils.isBlank(taskId);
}
@Override
public void preInsert() {
}
@Override
public void preUpdate() {
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeespring.modules.act.rest.diagram.services;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.ActivitiObjectNotFoundException;
import org.activiti.engine.HistoryService;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.history.HistoricActivityInstance;
import org.activiti.engine.impl.bpmn.behavior.BoundaryEventActivityBehavior;
import org.activiti.engine.impl.bpmn.behavior.CallActivityBehavior;
import org.activiti.engine.impl.bpmn.parser.BpmnParse;
import org.activiti.engine.impl.bpmn.parser.ErrorEventDefinition;
import org.activiti.engine.impl.bpmn.parser.EventSubscriptionDeclaration;
import org.activiti.engine.impl.jobexecutor.TimerDeclarationImpl;
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
import org.activiti.engine.impl.pvm.PvmTransition;
import org.activiti.engine.impl.pvm.delegate.ActivityBehavior;
import org.activiti.engine.impl.pvm.process.ActivityImpl;
import org.activiti.engine.impl.pvm.process.Lane;
import org.activiti.engine.impl.pvm.process.LaneSet;
import org.activiti.engine.impl.pvm.process.ParticipantProcess;
import org.activiti.engine.impl.pvm.process.TransitionImpl;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.Execution;
import org.activiti.engine.runtime.ProcessInstance;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
public class BaseProcessDefinitionDiagramLayoutResource {
@Autowired
private RuntimeService runtimeService;
@Autowired
private RepositoryService repositoryService;
@Autowired
private HistoryService historyService;
public ObjectNode getDiagramNode(String processInstanceId, String processDefinitionId) {
List<String> highLightedFlows = Collections.<String> emptyList();
List<String> highLightedActivities = Collections.<String> emptyList();
Map<String, ObjectNode> subProcessInstanceMap = new HashMap<String, ObjectNode>();
ProcessInstance processInstance = null;
if (processInstanceId != null) {
processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
if (processInstance == null) {
throw new ActivitiObjectNotFoundException("Process instance could not be found");
}
processDefinitionId = processInstance.getProcessDefinitionId();
List<ProcessInstance> subProcessInstances = runtimeService.createProcessInstanceQuery().superProcessInstanceId(processInstanceId).list();
for (ProcessInstance subProcessInstance : subProcessInstances) {
String subDefId = subProcessInstance.getProcessDefinitionId();
String superExecutionId = ((ExecutionEntity) subProcessInstance).getSuperExecutionId();
ProcessDefinitionEntity subDef = (ProcessDefinitionEntity) repositoryService.getProcessDefinition(subDefId);
ObjectNode processInstanceJSON = new ObjectMapper().createObjectNode();
processInstanceJSON.put("processInstanceId", subProcessInstance.getId());
processInstanceJSON.put("superExecutionId", superExecutionId);
processInstanceJSON.put("processDefinitionId", subDef.getId());
processInstanceJSON.put("processDefinitionKey", subDef.getKey());
processInstanceJSON.put("processDefinitionName", subDef.getName());
subProcessInstanceMap.put(superExecutionId, processInstanceJSON);
}
}
if (processDefinitionId == null) {
throw new ActivitiObjectNotFoundException("No process definition id provided");
}
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) repositoryService.getProcessDefinition(processDefinitionId);
if (processDefinition == null) {
throw new ActivitiException("Process definition " + processDefinitionId + " could not be found");
}
ObjectNode responseJSON = new ObjectMapper().createObjectNode();
// Process definition
JsonNode pdrJSON = getProcessDefinitionResponse(processDefinition);
if (pdrJSON != null) {
responseJSON.put("processDefinition", pdrJSON);
}
// Highlighted activities
if (processInstance != null) {
ArrayNode activityArray = new ObjectMapper().createArrayNode();
ArrayNode flowsArray = new ObjectMapper().createArrayNode();
highLightedActivities = runtimeService.getActiveActivityIds(processInstanceId);
highLightedFlows = getHighLightedFlows(processInstanceId, processDefinition);
for (String activityName : highLightedActivities) {
activityArray.add(activityName);
}
for (String flow : highLightedFlows) {
flowsArray.add(flow);
}
responseJSON.put("highLightedActivities", activityArray);
responseJSON.put("highLightedFlows", flowsArray);
}
// Pool shape, if process is participant in collaboration
if (processDefinition.getParticipantProcess() != null) {
ParticipantProcess pProc = processDefinition.getParticipantProcess();
ObjectNode participantProcessJSON = new ObjectMapper().createObjectNode();
participantProcessJSON.put("id", pProc.getId());
if (StringUtils.isNotEmpty(pProc.getName())) {
participantProcessJSON.put("name", pProc.getName());
} else {
participantProcessJSON.put("name", "");
}
participantProcessJSON.put("x", pProc.getX());
participantProcessJSON.put("y", pProc.getY());
participantProcessJSON.put("width", pProc.getWidth());
participantProcessJSON.put("height", pProc.getHeight());
responseJSON.put("participantProcess", participantProcessJSON);
}
// Draw lanes
if (processDefinition.getLaneSets() != null && !processDefinition.getLaneSets().isEmpty()) {
ArrayNode laneSetArray = new ObjectMapper().createArrayNode();
for (LaneSet laneSet : processDefinition.getLaneSets()) {
ArrayNode laneArray = new ObjectMapper().createArrayNode();
if (laneSet.getLanes() != null && !laneSet.getLanes().isEmpty()) {
for (Lane lane : laneSet.getLanes()) {
ObjectNode laneJSON = new ObjectMapper().createObjectNode();
laneJSON.put("id", lane.getId());
if (StringUtils.isNotEmpty(lane.getName())) {
laneJSON.put("name", lane.getName());
} else {
laneJSON.put("name", "");
}
laneJSON.put("x", lane.getX());
laneJSON.put("y", lane.getY());
laneJSON.put("width", lane.getWidth());
laneJSON.put("height", lane.getHeight());
List<String> flowNodeIds = lane.getFlowNodeIds();
ArrayNode flowNodeIdsArray = new ObjectMapper().createArrayNode();
for (String flowNodeId : flowNodeIds) {
flowNodeIdsArray.add(flowNodeId);
}
laneJSON.put("flowNodeIds", flowNodeIdsArray);
laneArray.add(laneJSON);
}
}
ObjectNode laneSetJSON = new ObjectMapper().createObjectNode();
laneSetJSON.put("id", laneSet.getId());
if (StringUtils.isNotEmpty(laneSet.getName())) {
laneSetJSON.put("name", laneSet.getName());
} else {
laneSetJSON.put("name", "");
}
laneSetJSON.put("lanes", laneArray);
laneSetArray.add(laneSetJSON);
}
if (laneSetArray.size() > 0) {
responseJSON.put("laneSets", laneSetArray);
}
}
ArrayNode sequenceFlowArray = new ObjectMapper().createArrayNode();
ArrayNode activityArray = new ObjectMapper().createArrayNode();
// Activities and their sequence-flows
for (ActivityImpl activity : processDefinition.getActivities()) {
getActivity(processInstanceId, activity, activityArray, sequenceFlowArray, processInstance, highLightedFlows, subProcessInstanceMap);
}
responseJSON.put("activities", activityArray);
responseJSON.put("sequenceFlows", sequenceFlowArray);
return responseJSON;
}
private List<String> getHighLightedFlows(String processInstanceId, ProcessDefinitionEntity processDefinition) {
List<String> highLightedFlows = new ArrayList<String>();
List<HistoricActivityInstance> historicActivityInstances = historyService.createHistoricActivityInstanceQuery()
.processInstanceId(processInstanceId).orderByHistoricActivityInstanceStartTime().asc().list();
List<String> historicActivityInstanceList = new ArrayList<String>();
for (HistoricActivityInstance hai : historicActivityInstances) {
historicActivityInstanceList.add(hai.getActivityId());
}
// add current activities to list
List<String> highLightedActivities = runtimeService.getActiveActivityIds(processInstanceId);
historicActivityInstanceList.addAll(highLightedActivities);
// activities and their sequence-flows
for (ActivityImpl activity : processDefinition.getActivities()) {
int index = historicActivityInstanceList.indexOf(activity.getId());
if (index >= 0 && index + 1 < historicActivityInstanceList.size()) {
List<PvmTransition> pvmTransitionList = activity.getOutgoingTransitions();
for (PvmTransition pvmTransition : pvmTransitionList) {
String destinationFlowId = pvmTransition.getDestination().getId();
if (destinationFlowId.equals(historicActivityInstanceList.get(index + 1))) {
highLightedFlows.add(pvmTransition.getId());
}
}
}
}
return highLightedFlows;
}
private void getActivity(String processInstanceId, ActivityImpl activity, ArrayNode activityArray, ArrayNode sequenceFlowArray,
ProcessInstance processInstance, List<String> highLightedFlows, Map<String, ObjectNode> subProcessInstanceMap) {
ObjectNode activityJSON = new ObjectMapper().createObjectNode();
// Gather info on the multi instance marker
String multiInstance = (String) activity.getProperty("multiInstance");
if (multiInstance != null) {
if (!"sequential".equals(multiInstance)) {
multiInstance = "parallel";
}
}
ActivityBehavior activityBehavior = activity.getActivityBehavior();
// Gather info on the collapsed marker
Boolean collapsed = (activityBehavior instanceof CallActivityBehavior);
Boolean expanded = (Boolean) activity.getProperty(BpmnParse.PROPERTYNAME_ISEXPANDED);
if (expanded != null) {
collapsed = !expanded;
}
Boolean isInterrupting = null;
if (activityBehavior instanceof BoundaryEventActivityBehavior) {
isInterrupting = ((BoundaryEventActivityBehavior) activityBehavior).isInterrupting();
}
// Outgoing transitions of activity
for (PvmTransition sequenceFlow : activity.getOutgoingTransitions()) {
String flowName = (String) sequenceFlow.getProperty("name");
boolean isHighLighted = (highLightedFlows.contains(sequenceFlow.getId()));
boolean isConditional = sequenceFlow.getProperty(BpmnParse.PROPERTYNAME_CONDITION) != null
&& !((String) activity.getProperty("type")).toLowerCase().contains("gateway");
boolean isDefault = sequenceFlow.getId().equals(activity.getProperty("default"))
&& ((String) activity.getProperty("type")).toLowerCase().contains("gateway");
List<Integer> waypoints = ((TransitionImpl) sequenceFlow).getWaypoints();
ArrayNode xPointArray = new ObjectMapper().createArrayNode();
ArrayNode yPointArray = new ObjectMapper().createArrayNode();
for (int i = 0; i < waypoints.size(); i += 2) { // waypoints.size()
// minimally 4: x1, y1,
// x2, y2
xPointArray.add(waypoints.get(i));
yPointArray.add(waypoints.get(i + 1));
}
ObjectNode flowJSON = new ObjectMapper().createObjectNode();
flowJSON.put("id", sequenceFlow.getId());
flowJSON.put("name", flowName);
flowJSON.put("flow", "(" + sequenceFlow.getSource().getId() + ")--" + sequenceFlow.getId() + "-->("
+ sequenceFlow.getDestination().getId() + ")");
if (isConditional) {
flowJSON.put("isConditional", isConditional);
}
if (isDefault) {
flowJSON.put("isDefault", isDefault);
}
if (isHighLighted) {
flowJSON.put("isHighLighted", isHighLighted);
}
flowJSON.put("xPointArray", xPointArray);
flowJSON.put("yPointArray", yPointArray);
sequenceFlowArray.add(flowJSON);
}
// Nested activities (boundary events)
ArrayNode nestedActivityArray = new ObjectMapper().createArrayNode();
for (ActivityImpl nestedActivity : activity.getActivities()) {
nestedActivityArray.add(nestedActivity.getId());
}
Map<String, Object> properties = activity.getProperties();
ObjectNode propertiesJSON = new ObjectMapper().createObjectNode();
for (String key : properties.keySet()) {
Object prop = properties.get(key);
if (prop instanceof String) {
propertiesJSON.put(key, (String) properties.get(key));
} else if (prop instanceof Integer) {
propertiesJSON.put(key, (Integer) properties.get(key));
} else if (prop instanceof Boolean) {
propertiesJSON.put(key, (Boolean) properties.get(key));
} else if ("initial".equals(key)) {
ActivityImpl act = (ActivityImpl) properties.get(key);
propertiesJSON.put(key, act.getId());
} else if ("timerDeclarations".equals(key)) {
ArrayList<TimerDeclarationImpl> timerDeclarations = (ArrayList<TimerDeclarationImpl>) properties.get(key);
ArrayNode timerDeclarationArray = new ObjectMapper().createArrayNode();
if (timerDeclarations != null) {
for (TimerDeclarationImpl timerDeclaration : timerDeclarations) {
ObjectNode timerDeclarationJSON = new ObjectMapper().createObjectNode();
timerDeclarationJSON.put("isExclusive", timerDeclaration.isExclusive());
if (timerDeclaration.getRepeat() != null) {
timerDeclarationJSON.put("repeat", timerDeclaration.getRepeat());
}
timerDeclarationJSON.put("retries", String.valueOf(timerDeclaration.getRetries()));
timerDeclarationJSON.put("type", timerDeclaration.getJobHandlerType());
timerDeclarationJSON.put("configuration", timerDeclaration.getJobHandlerConfiguration());
//timerDeclarationJSON.put("expression", timerDeclaration.getDescription());
timerDeclarationArray.add(timerDeclarationJSON);
}
}
if (timerDeclarationArray.size() > 0) {
propertiesJSON.put(key, timerDeclarationArray);
}
// TODO: implement getting description
} else if ("eventDefinitions".equals(key)) {
ArrayList<EventSubscriptionDeclaration> eventDefinitions = (ArrayList<EventSubscriptionDeclaration>) properties.get(key);
ArrayNode eventDefinitionsArray = new ObjectMapper().createArrayNode();
if (eventDefinitions != null) {
for (EventSubscriptionDeclaration eventDefinition : eventDefinitions) {
ObjectNode eventDefinitionJSON = new ObjectMapper().createObjectNode();
if (eventDefinition.getActivityId() != null) {
eventDefinitionJSON.put("activityId", eventDefinition.getActivityId());
}
eventDefinitionJSON.put("eventName", eventDefinition.getEventName());
eventDefinitionJSON.put("eventType", eventDefinition.getEventType());
eventDefinitionJSON.put("isAsync", eventDefinition.isAsync());
eventDefinitionJSON.put("isStartEvent", eventDefinition.isStartEvent());
eventDefinitionsArray.add(eventDefinitionJSON);
}
}
if (eventDefinitionsArray.size() > 0) {
propertiesJSON.put(key, eventDefinitionsArray);
}
// TODO: implement it
} else if ("errorEventDefinitions".equals(key)) {
ArrayList<ErrorEventDefinition> errorEventDefinitions = (ArrayList<ErrorEventDefinition>) properties.get(key);
ArrayNode errorEventDefinitionsArray = new ObjectMapper().createArrayNode();
if (errorEventDefinitions != null) {
for (ErrorEventDefinition errorEventDefinition : errorEventDefinitions) {
ObjectNode errorEventDefinitionJSON = new ObjectMapper().createObjectNode();
if (errorEventDefinition.getErrorCode() != null) {
errorEventDefinitionJSON.put("errorCode", errorEventDefinition.getErrorCode());
} else {
errorEventDefinitionJSON.putNull("errorCode");
}
errorEventDefinitionJSON.put("handlerActivityId", errorEventDefinition.getHandlerActivityId());
errorEventDefinitionsArray.add(errorEventDefinitionJSON);
}
}
if (errorEventDefinitionsArray.size() > 0) {
propertiesJSON.put(key, errorEventDefinitionsArray);
}
}
}
if ("callActivity".equals(properties.get("type"))) {
CallActivityBehavior callActivityBehavior = null;
if (activityBehavior instanceof CallActivityBehavior) {
callActivityBehavior = (CallActivityBehavior) activityBehavior;
}
if (callActivityBehavior != null) {
propertiesJSON.put("processDefinitonKey", callActivityBehavior.getProcessDefinitonKey());
// get processDefinitonId from execution or get last processDefinitonId
// by key
ArrayNode processInstanceArray = new ObjectMapper().createArrayNode();
if (processInstance != null) {
List<Execution> executionList = runtimeService.createExecutionQuery().processInstanceId(processInstanceId)
.activityId(activity.getId()).list();
if (!executionList.isEmpty()) {
for (Execution execution : executionList) {
ObjectNode processInstanceJSON = subProcessInstanceMap.get(execution.getId());
processInstanceArray.add(processInstanceJSON);
}
}
}
// If active activities nas no instance of this callActivity then add
// last definition
if (processInstanceArray.size() == 0 && StringUtils.isNotEmpty(callActivityBehavior.getProcessDefinitonKey())) {
// Get last definition by key
ProcessDefinition lastProcessDefinition = repositoryService.createProcessDefinitionQuery()
.processDefinitionKey(callActivityBehavior.getProcessDefinitonKey()).latestVersion().singleResult();
// TODO: unuseful fields there are processDefinitionName, processDefinitionKey
if (lastProcessDefinition != null) {
ObjectNode processInstanceJSON = new ObjectMapper().createObjectNode();
processInstanceJSON.put("processDefinitionId", lastProcessDefinition.getId());
processInstanceJSON.put("processDefinitionKey", lastProcessDefinition.getKey());
processInstanceJSON.put("processDefinitionName", lastProcessDefinition.getName());
processInstanceArray.add(processInstanceJSON);
}
}
if (processInstanceArray.size() > 0) {
propertiesJSON.put("processDefinitons", processInstanceArray);
}
}
}
activityJSON.put("activityId", activity.getId());
activityJSON.put("properties", propertiesJSON);
if (multiInstance != null) {
activityJSON.put("multiInstance", multiInstance);
}
if (collapsed) {
activityJSON.put("collapsed", collapsed);
}
if (nestedActivityArray.size() > 0) {
activityJSON.put("nestedActivities", nestedActivityArray);
}
if (isInterrupting != null) {
activityJSON.put("isInterrupting", isInterrupting);
}
activityJSON.put("x", activity.getX());
activityJSON.put("y", activity.getY());
activityJSON.put("width", activity.getWidth());
activityJSON.put("height", activity.getHeight());
activityArray.add(activityJSON);
// Nested activities (boundary events)
for (ActivityImpl nestedActivity : activity.getActivities()) {
getActivity(processInstanceId, nestedActivity, activityArray, sequenceFlowArray, processInstance, highLightedFlows, subProcessInstanceMap);
}
}
private JsonNode getProcessDefinitionResponse(ProcessDefinitionEntity processDefinition) {
ObjectMapper mapper = new ObjectMapper();
ObjectNode pdrJSON = mapper.createObjectNode();
pdrJSON.put("id", processDefinition.getId());
pdrJSON.put("name", processDefinition.getName());
pdrJSON.put("key", processDefinition.getKey());
pdrJSON.put("version", processDefinition.getVersion());
pdrJSON.put("deploymentId", processDefinition.getDeploymentId());
pdrJSON.put("isGraphicNotationDefined", isGraphicNotationDefined(processDefinition));
return pdrJSON;
}
private boolean isGraphicNotationDefined(ProcessDefinitionEntity processDefinition) {
return ((ProcessDefinitionEntity) repositoryService.getProcessDefinition(processDefinition.getId())).isGraphicalNotationDefined();
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeespring.modules.act.rest.diagram.services;
import org.apache.shiro.authz.annotation.RequiresUser;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.node.ObjectNode;
@RestController
public class ProcessDefinitionDiagramLayoutResource extends BaseProcessDefinitionDiagramLayoutResource {
@RequiresUser
@RequestMapping(value = "/act/service/process-definition/{processDefinitionId}/diagram-layout", method = RequestMethod.GET, produces = "application/json")
public ObjectNode getDiagram(@PathVariable String processDefinitionId) {
return getDiagramNode(null, processDefinitionId);
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeespring.modules.act.rest.diagram.services;
import org.apache.shiro.authz.annotation.RequiresUser;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.node.ObjectNode;
@RestController
public class ProcessInstanceDiagramLayoutResource extends BaseProcessDefinitionDiagramLayoutResource {
@RequiresUser
@RequestMapping(value = "/act/service/process-instance/{processInstanceId}/diagram-layout", method = RequestMethod.GET, produces = "application/json")
public ObjectNode getDiagram(@PathVariable String processInstanceId) {
return getDiagramNode(processInstanceId, null);
}
}
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jeespring.modules.act.rest.diagram.services;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.activiti.engine.HistoryService;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.history.HistoricActivityInstance;
import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
import org.activiti.engine.impl.pvm.PvmTransition;
import org.activiti.engine.impl.pvm.process.ActivityImpl;
import org.activiti.engine.runtime.ProcessInstance;
import org.apache.shiro.authz.annotation.RequiresUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
@RestController
public class ProcessInstanceHighlightsResource {
@Autowired
private RuntimeService runtimeService;
@Autowired
private RepositoryService repositoryService;
@Autowired
private HistoryService historyService;
protected ObjectMapper objectMapper = new ObjectMapper();
@RequiresUser
@RequestMapping(value = "/act/service/process-instance/{processInstanceId}/highlights", method = RequestMethod.GET, produces = "application/json")
public ObjectNode getHighlighted(@PathVariable String processInstanceId) {
ObjectNode responseJSON = objectMapper.createObjectNode();
responseJSON.put("processInstanceId", processInstanceId);
ArrayNode activitiesArray = objectMapper.createArrayNode();
ArrayNode flowsArray = objectMapper.createArrayNode();
try {
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) repositoryService.getProcessDefinition(processInstance
.getProcessDefinitionId());
responseJSON.put("processDefinitionId", processInstance.getProcessDefinitionId());
List<String> highLightedActivities = runtimeService.getActiveActivityIds(processInstanceId);
List<String> highLightedFlows = getHighLightedFlows(processDefinition, processInstanceId);
for (String activityId : highLightedActivities) {
activitiesArray.add(activityId);
}
for (String flow : highLightedFlows) {
flowsArray.add(flow);
}
} catch (Exception e) {
e.printStackTrace();
}
responseJSON.put("activities", activitiesArray);
responseJSON.put("flows", flowsArray);
return responseJSON;
}
/**
* getHighLightedFlows
*
* @param processDefinition
* @param processInstanceId
* @return
*/
private List<String> getHighLightedFlows(ProcessDefinitionEntity processDefinition, String processInstanceId) {
List<String> highLightedFlows = new ArrayList<String>();
List<HistoricActivityInstance> historicActivityInstances = historyService.createHistoricActivityInstanceQuery()
.processInstanceId(processInstanceId)
//order by startime asc is not correct. use default order is correct.
//.orderByHistoricActivityInstanceStartTime().asc()/*.orderByActivityId().asc()*/
.list();
LinkedList<HistoricActivityInstance> hisActInstList = new LinkedList<HistoricActivityInstance>();
hisActInstList.addAll(historicActivityInstances);
getHighlightedFlows(processDefinition.getActivities(), hisActInstList, highLightedFlows);
return highLightedFlows;
}
/**
* getHighlightedFlows
*
* code logic: 1. Loop all activities by id asc order; 2. Check each activity's outgoing transitions and eventBoundery outgoing transitions, if
* outgoing transitions's destination.id is in other executed activityIds, add this transition to highLightedFlows List; 3. But if activity is not
* a parallelGateway or inclusiveGateway, only choose the earliest flow.
*
* @param activityList
* @param hisActInstList
* @param highLightedFlows
*/
private void getHighlightedFlows(List<ActivityImpl> activityList, LinkedList<HistoricActivityInstance> hisActInstList,
List<String> highLightedFlows) {
//check out startEvents in activityList
List<ActivityImpl> startEventActList = new ArrayList<ActivityImpl>();
Map<String, ActivityImpl> activityMap = new HashMap<String, ActivityImpl>(activityList.size());
for (ActivityImpl activity : activityList) {
activityMap.put(activity.getId(), activity);
String actType = (String) activity.getProperty("type");
if (actType != null && actType.toLowerCase().indexOf("startevent") >= 0) {
startEventActList.add(activity);
}
}
//These codes is used to avoid a bug:
//ACT-1728 If the process instance was started by a callActivity, it will be not have the startEvent activity in ACT_HI_ACTINST table
//Code logic:
//Check the first activity if it is a startEvent, if not check out the startEvent's highlight outgoing flow.
HistoricActivityInstance firstHistActInst = hisActInstList.getFirst();
String firstActType = (String) firstHistActInst.getActivityType();
if (firstActType != null && firstActType.toLowerCase().indexOf("startevent") < 0) {
PvmTransition startTrans = getStartTransaction(startEventActList, firstHistActInst);
if (startTrans != null) {
highLightedFlows.add(startTrans.getId());
}
}
while (!hisActInstList.isEmpty()) {
HistoricActivityInstance histActInst = hisActInstList.removeFirst();
ActivityImpl activity = activityMap.get(histActInst.getActivityId());
if (activity != null) {
boolean isParallel = false;
String type = histActInst.getActivityType();
if ("parallelGateway".equals(type) || "inclusiveGateway".equals(type)) {
isParallel = true;
} else if ("subProcess".equals(histActInst.getActivityType())) {
getHighlightedFlows(activity.getActivities(), hisActInstList, highLightedFlows);
}
List<PvmTransition> allOutgoingTrans = new ArrayList<PvmTransition>();
allOutgoingTrans.addAll(activity.getOutgoingTransitions());
allOutgoingTrans.addAll(getBoundaryEventOutgoingTransitions(activity));
List<String> activityHighLightedFlowIds = getHighlightedFlows(allOutgoingTrans, hisActInstList, isParallel);
highLightedFlows.addAll(activityHighLightedFlowIds);
}
}
}
/**
* Check out the outgoing transition connected to firstActInst from startEventActList
*
* @param startEventActList
* @param firstActInst
* @return
*/
private PvmTransition getStartTransaction(List<ActivityImpl> startEventActList, HistoricActivityInstance firstActInst) {
for (ActivityImpl startEventAct : startEventActList) {
for (PvmTransition trans : startEventAct.getOutgoingTransitions()) {
if (trans.getDestination().getId().equals(firstActInst.getActivityId())) {
return trans;
}
}
}
return null;
}
/**
* getBoundaryEventOutgoingTransitions
*
* @param activity
* @return
*/
private List<PvmTransition> getBoundaryEventOutgoingTransitions(ActivityImpl activity) {
List<PvmTransition> boundaryTrans = new ArrayList<PvmTransition>();
for (ActivityImpl subActivity : activity.getActivities()) {
String type = (String) subActivity.getProperty("type");
if (type != null && type.toLowerCase().indexOf("boundary") >= 0) {
boundaryTrans.addAll(subActivity.getOutgoingTransitions());
}
}
return boundaryTrans;
}
/**
* find out single activity's highlighted flowIds
*
* @param activity
* @param hisActInstList
* @param isExclusive if true only return one flowId(Such as exclusiveGateway, BoundaryEvent On Task)
* @return
*/
private List<String> getHighlightedFlows(List<PvmTransition> pvmTransitionList, LinkedList<HistoricActivityInstance> hisActInstList,
boolean isParallel) {
List<String> highLightedFlowIds = new ArrayList<String>();
PvmTransition earliestTrans = null;
HistoricActivityInstance earliestHisActInst = null;
for (PvmTransition pvmTransition : pvmTransitionList) {
String destActId = pvmTransition.getDestination().getId();
HistoricActivityInstance destHisActInst = findHisActInst(hisActInstList, destActId);
if (destHisActInst != null) {
if (isParallel) {
highLightedFlowIds.add(pvmTransition.getId());
} else if (earliestHisActInst == null || (earliestHisActInst.getId().compareTo(destHisActInst.getId()) > 0)) {
earliestTrans = pvmTransition;
earliestHisActInst = destHisActInst;
}
}
}
if ((!isParallel) && earliestTrans != null) {
highLightedFlowIds.add(earliestTrans.getId());
}
return highLightedFlowIds;
}
private HistoricActivityInstance findHisActInst(LinkedList<HistoricActivityInstance> hisActInstList, String actId) {
for (HistoricActivityInstance hisActInst : hisActInstList) {
if (hisActInst.getActivityId().equals(actId)) {
return hisActInst;
}
}
return null;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment