"vscode:/vscode.git/clone" did not exist on "0a2ae87e449210ff31bdeda3d02c368447202867"
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 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