伊利项目 模型转换应用增加 epc转bpmn
This commit is contained in:
parent
c4db99c679
commit
74cc0cc6dd
Binary file not shown.
@ -1,5 +1,7 @@
|
||||
package com.actionsoft.apps.coe.pal.modelconvert.cache;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.modelconvert.constant.ConvertType;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ -8,22 +10,30 @@ public class ConvertShapeIdMapping {
|
||||
private ConvertShapeIdMapping(){}
|
||||
private static ConvertShapeIdMapping convertShapeIdMapping = new ConvertShapeIdMapping();
|
||||
// 存储被转换文件图形ID与转换后的文件图形ID的映射关系
|
||||
private static Map<String,String> shapeIdMapping = new HashMap<>();
|
||||
private static Map<ConvertType,Map<String,String>> map = new HashMap<>();
|
||||
|
||||
private static Map<String,String> epcToFlowChartShapeIdMapping = new HashMap<>();
|
||||
private static Map<String,String> epcToBPMNShapeIdMapping = new HashMap<>();
|
||||
|
||||
static {
|
||||
map.put(ConvertType.EPC_FLOWCHART,epcToFlowChartShapeIdMapping);
|
||||
map.put(ConvertType.EPC_BPMN,epcToBPMNShapeIdMapping);
|
||||
}
|
||||
|
||||
public static ConvertShapeIdMapping getInstance(){
|
||||
return convertShapeIdMapping;
|
||||
}
|
||||
|
||||
public void load(String sourceShapeId,String targetShapeId){
|
||||
shapeIdMapping.put(sourceShapeId,targetShapeId);
|
||||
public void load(ConvertType type,String sourceShapeId,String targetShapeId){
|
||||
map.get(type).put(sourceShapeId,targetShapeId);
|
||||
}
|
||||
|
||||
public void clear(){
|
||||
shapeIdMapping.clear();
|
||||
public void clear(ConvertType type){
|
||||
map.get(type).clear();
|
||||
}
|
||||
|
||||
public String getTargetShapeId(String sourceShapeId){
|
||||
return shapeIdMapping.get(sourceShapeId);
|
||||
public String getTargetShapeId(ConvertType type,String sourceShapeId){
|
||||
return map.get(type).get(sourceShapeId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,8 +3,8 @@ package com.actionsoft.apps.coe.pal.modelconvert.constant;
|
||||
public enum ConvertType {
|
||||
|
||||
EPC_FLOWCHART("process.epc","process.flowchart","EPC转FlowChart"),
|
||||
EPC_BPMN("process.epc","process.bpmn","EPC转BPMN"),
|
||||
FLOWCHART_BPMN("process.flowchart","process.bpmn","FlowChart转BPMN");
|
||||
EPC_BPMN("process.epc","process.bpmn2","EPC转BPMN"),
|
||||
FLOWCHART_BPMN("process.flowchart","process.bpmn2","FlowChart转BPMN");
|
||||
|
||||
private ConvertType(String sourceMethod,String targetMethod,String desc){
|
||||
this.sourceMethod = sourceMethod;
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.actionsoft.apps.coe.pal.modelconvert.model;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class Position {
|
||||
private double x;
|
||||
private double y;
|
||||
@ -16,4 +18,18 @@ public class Position {
|
||||
public double getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Position position = (Position) o;
|
||||
return Double.compare(position.x, x) == 0 &&
|
||||
Double.compare(position.y, y) == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.actionsoft.apps.coe.pal.modelconvert.strategy;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.modelconvert.constant.ConvertType;
|
||||
import com.actionsoft.apps.coe.pal.modelconvert.strategy.impl.EpcToBPMN;
|
||||
import com.actionsoft.apps.coe.pal.modelconvert.strategy.impl.EpcToFlowChart;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -14,6 +15,7 @@ public class ModelConvertContext {
|
||||
|
||||
static {
|
||||
map.put(ConvertType.EPC_FLOWCHART,new EpcToFlowChart());
|
||||
map.put(ConvertType.EPC_BPMN,new EpcToBPMN());
|
||||
}
|
||||
|
||||
public static ModelConvertContext getInstance(){
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.actionsoft.apps.coe.pal.modelconvert.strategy.attribute.impl;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.modelconvert.cache.ConvertShapeIdMapping;
|
||||
import com.actionsoft.apps.coe.pal.modelconvert.constant.ConvertType;
|
||||
import com.actionsoft.apps.coe.pal.modelconvert.model.RelationAttributeModel;
|
||||
import com.actionsoft.apps.coe.pal.modelconvert.strategy.attribute.DataAttributeStrategy;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepositoryPropertyDao;
|
||||
@ -46,7 +47,7 @@ public class AwsOrgTypeAttrHandle implements DataAttributeStrategy {
|
||||
List<DesignerShapeRelationModel> sourceRelationModelList = shapeRelationDao.getModelListByFileId(sourceRepositoryId);
|
||||
// 关联类型的文件属性 关联表中 shapeId shapeText 字段是空值
|
||||
sourceRelationModelList = sourceRelationModelList.stream()
|
||||
.filter(model -> UtilString.isEmpty(model.getShapeId()) && UtilString.isEmpty(model.getShapeText()))
|
||||
.filter(model -> UtilString.isEmpty(model.getShapeId()))
|
||||
.filter(model -> attrId.equals(model.getAttrId()))
|
||||
.filter(model -> "00000000-0000-0000-0000-000000000000".equals(model.getRelationFileId()) && "00000000-0000-0000-0000-000000000000".equals(model.getRelationShapeId()))
|
||||
.collect(Collectors.toList());
|
||||
@ -73,6 +74,7 @@ public class AwsOrgTypeAttrHandle implements DataAttributeStrategy {
|
||||
String targetRepositoryId = (String) param.get("targetRepositoryId");
|
||||
String attrId = (String) param.get("attrId");
|
||||
String beforeShapeName = (String) param.get("beforeShapeName");
|
||||
ConvertType convertType = (ConvertType) param.get("convertType");
|
||||
// 1. definition 做处理
|
||||
BaseModel baseModel = CoeDesignerAPIManager.getInstance().getDefinition(sourceRepositoryId, 0);
|
||||
String definition = baseModel.getDefinition();
|
||||
@ -100,7 +102,7 @@ public class AwsOrgTypeAttrHandle implements DataAttributeStrategy {
|
||||
String targetDefinition = CoeDesignerAPIManager.getInstance().getDefinition(targetRepositoryId, 0).getDefinition();
|
||||
JSONObject targetDefineJsonObj = JSONObject.parseObject(targetDefinition);
|
||||
JSONObject targetElements = targetDefineJsonObj.getJSONObject("elements");
|
||||
JSONObject targetShape = targetElements.getJSONObject(ConvertShapeIdMapping.getInstance().getTargetShapeId(key));
|
||||
JSONObject targetShape = targetElements.getJSONObject(ConvertShapeIdMapping.getInstance().getTargetShapeId(convertType,key));
|
||||
if (targetShape.containsKey("dataAttributes") && targetShape.getJSONArray("dataAttributes") != null){
|
||||
JSONArray targetDataAttributes = targetShape.getJSONArray("dataAttributes");
|
||||
for (int k = 0; k < targetDataAttributes.size(); k++) {
|
||||
@ -109,7 +111,7 @@ public class AwsOrgTypeAttrHandle implements DataAttributeStrategy {
|
||||
JSONArray targetItemJSONArray = targetItem.getJSONArray("attributesJsonArray");
|
||||
for (int l = 0; l < targetItemJSONArray.size(); l++) {
|
||||
JSONObject targetObj = targetItemJSONArray.getJSONObject(l);
|
||||
if (targetObj == null) continue;
|
||||
if (targetObj == null || targetObj.size() == 0) continue;
|
||||
if (targetObj.getString("id").equals(attrId) && "awsorg".equals(targetObj.getString("type"))) targetItemJSONArray.remove(l);
|
||||
}
|
||||
JSONObject tempObj = new JSONObject();
|
||||
@ -130,7 +132,7 @@ public class AwsOrgTypeAttrHandle implements DataAttributeStrategy {
|
||||
}
|
||||
}
|
||||
|
||||
targetElements.put(ConvertShapeIdMapping.getInstance().getTargetShapeId(key),targetShape);
|
||||
targetElements.put(ConvertShapeIdMapping.getInstance().getTargetShapeId(convertType,key),targetShape);
|
||||
targetDefineJsonObj.put("elements",targetElements);
|
||||
BaseModel model = CoeDesignerAPIManager.getInstance().getDefinition(targetRepositoryId, 0);
|
||||
if (model == null) {
|
||||
@ -157,12 +159,12 @@ public class AwsOrgTypeAttrHandle implements DataAttributeStrategy {
|
||||
.collect(Collectors.toList());
|
||||
List<DesignerShapeRelationModel> result = new ArrayList<>();
|
||||
for (DesignerShapeRelationModel relationModel : shapeRelationModelList) {
|
||||
if (UtilString.isEmpty(ConvertShapeIdMapping.getInstance().getTargetShapeId(relationModel.getShapeId()))) { // 如果转换前为 事件 图形 直接跳过
|
||||
if (UtilString.isEmpty(ConvertShapeIdMapping.getInstance().getTargetShapeId(convertType,relationModel.getShapeId()))) { // 如果转换前为 事件 图形 直接跳过
|
||||
continue;
|
||||
}
|
||||
relationModel.setId(UUIDGener.getUUID());
|
||||
relationModel.setFileId(targetRepositoryId);
|
||||
relationModel.setShapeId(ConvertShapeIdMapping.getInstance().getTargetShapeId(relationModel.getShapeId()));
|
||||
relationModel.setShapeId(ConvertShapeIdMapping.getInstance().getTargetShapeId(convertType,relationModel.getShapeId()));
|
||||
relationModel.setShapeText(relationModel.getShapeText());
|
||||
relationModel.setAttrId(relationModel.getAttrId());
|
||||
relationModel.setRelationFileId(relationModel.getRelationFileId());
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.actionsoft.apps.coe.pal.modelconvert.strategy.attribute.impl;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.modelconvert.cache.ConvertShapeIdMapping;
|
||||
import com.actionsoft.apps.coe.pal.modelconvert.constant.ConvertType;
|
||||
import com.actionsoft.apps.coe.pal.modelconvert.model.RelationAttributeModel;
|
||||
import com.actionsoft.apps.coe.pal.modelconvert.strategy.attribute.DataAttributeStrategy;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepositoryPropertyDao;
|
||||
@ -51,7 +52,7 @@ public class RelationTypeAttrHandle implements DataAttributeStrategy {
|
||||
List<DesignerShapeRelationModel> sourceRelationModelList = shapeRelationDao.getModelListByFileId(sourceRepositoryId);
|
||||
// 关联类型的文件属性 关联表中 shapeId shapeText 字段是空值
|
||||
sourceRelationModelList = sourceRelationModelList.stream()
|
||||
.filter(model -> UtilString.isEmpty(model.getShapeId()) && UtilString.isEmpty(model.getShapeText()))
|
||||
.filter(model -> UtilString.isEmpty(model.getShapeId()))
|
||||
.filter(model -> attrId.equals(model.getAttrId()))
|
||||
.filter(model -> !"00000000-0000-0000-0000-000000000000".equals(model.getRelationFileId()) && !"00000000-0000-0000-0000-000000000000".equals(model.getRelationShapeId()))
|
||||
.collect(Collectors.toList());
|
||||
@ -78,6 +79,7 @@ public class RelationTypeAttrHandle implements DataAttributeStrategy {
|
||||
String targetRepositoryId = (String) param.get("targetRepositoryId");
|
||||
String attrId = (String) param.get("attrId");
|
||||
String beforeShapeName = (String) param.get("beforeShapeName");
|
||||
ConvertType convertType = (ConvertType) param.get("convertType");
|
||||
// 1. definition 做处理
|
||||
BaseModel baseModel = CoeDesignerAPIManager.getInstance().getDefinition(sourceRepositoryId, 0);
|
||||
String definition = baseModel.getDefinition();
|
||||
@ -99,13 +101,13 @@ public class RelationTypeAttrHandle implements DataAttributeStrategy {
|
||||
JSONArray attributesJsonArray = item.getJSONArray("attributesJsonArray");
|
||||
for (int j = 0; j < attributesJsonArray.size(); j++) {
|
||||
JSONObject object = attributesJsonArray.getJSONObject(j);
|
||||
if (object == null) continue;
|
||||
if (object == null || object.size() == 0) continue;
|
||||
if (object.getString("id").equals(attrId) && "relation".equals(object.getString("type"))){
|
||||
// 将当前的属性存入到转换后的文件中
|
||||
String targetDefinition = CoeDesignerAPIManager.getInstance().getDefinition(targetRepositoryId, 0).getDefinition();
|
||||
JSONObject targetDefineJsonObj = JSONObject.parseObject(targetDefinition);
|
||||
JSONObject targetElements = targetDefineJsonObj.getJSONObject("elements");
|
||||
JSONObject targetShape = targetElements.getJSONObject(ConvertShapeIdMapping.getInstance().getTargetShapeId(key));
|
||||
JSONObject targetShape = targetElements.getJSONObject(ConvertShapeIdMapping.getInstance().getTargetShapeId(convertType,key));
|
||||
if (targetShape.containsKey("dataAttributes") && targetShape.getJSONArray("dataAttributes") != null){
|
||||
JSONArray targetDataAttributes = targetShape.getJSONArray("dataAttributes");
|
||||
for (int k = 0; k < targetDataAttributes.size(); k++) {
|
||||
@ -114,7 +116,7 @@ public class RelationTypeAttrHandle implements DataAttributeStrategy {
|
||||
JSONArray targetItemJSONArray = targetItem.getJSONArray("attributesJsonArray");
|
||||
for (int l = 0; l < targetItemJSONArray.size(); l++) {
|
||||
JSONObject targetObj = targetItemJSONArray.getJSONObject(l);
|
||||
if (targetObj == null) continue;
|
||||
if (targetObj == null || targetObj.size() == 0) continue;
|
||||
if (targetObj.getString("id").equals(attrId) && "relation".equals(targetObj.getString("type"))) targetItemJSONArray.remove(l);
|
||||
}
|
||||
JSONObject tempObj = new JSONObject();
|
||||
@ -135,7 +137,7 @@ public class RelationTypeAttrHandle implements DataAttributeStrategy {
|
||||
}
|
||||
}
|
||||
|
||||
targetElements.put(ConvertShapeIdMapping.getInstance().getTargetShapeId(key),targetShape);
|
||||
targetElements.put(ConvertShapeIdMapping.getInstance().getTargetShapeId(convertType,key),targetShape);
|
||||
targetDefineJsonObj.put("elements",targetElements);
|
||||
BaseModel model = CoeDesignerAPIManager.getInstance().getDefinition(targetRepositoryId, 0);
|
||||
if (model == null) {
|
||||
@ -162,12 +164,12 @@ public class RelationTypeAttrHandle implements DataAttributeStrategy {
|
||||
.collect(Collectors.toList());
|
||||
List<DesignerShapeRelationModel> result = new ArrayList<>();
|
||||
for (DesignerShapeRelationModel relationModel : shapeRelationModelList) {
|
||||
if (UtilString.isEmpty(ConvertShapeIdMapping.getInstance().getTargetShapeId(relationModel.getShapeId()))) { // 如果转换前为 事件 图形 直接跳过
|
||||
if (UtilString.isEmpty(ConvertShapeIdMapping.getInstance().getTargetShapeId(convertType,relationModel.getShapeId()))) { // 如果转换前为 事件 图形 直接跳过
|
||||
continue;
|
||||
}
|
||||
relationModel.setId(UUIDGener.getUUID());
|
||||
relationModel.setFileId(targetRepositoryId);
|
||||
relationModel.setShapeId(ConvertShapeIdMapping.getInstance().getTargetShapeId(relationModel.getShapeId()));
|
||||
relationModel.setShapeId(ConvertShapeIdMapping.getInstance().getTargetShapeId(convertType,relationModel.getShapeId()));
|
||||
relationModel.setShapeText(relationModel.getShapeText());
|
||||
relationModel.setAttrId(relationModel.getAttrId());
|
||||
relationModel.setRelationFileId(relationModel.getRelationFileId());
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.actionsoft.apps.coe.pal.modelconvert.strategy.attribute.impl;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.modelconvert.cache.ConvertShapeIdMapping;
|
||||
import com.actionsoft.apps.coe.pal.modelconvert.constant.ConvertType;
|
||||
import com.actionsoft.apps.coe.pal.modelconvert.strategy.attribute.DataAttributeStrategy;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepositoryPropertyDao;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.manage.CoeDesignerAPIManager;
|
||||
@ -50,6 +51,7 @@ public class TextTypeAttrHandle implements DataAttributeStrategy {
|
||||
String attrId = (String) param.get("attrId");
|
||||
String beforeShapeName = (String) param.get("beforeShapeName");
|
||||
String afterShapeName = (String) param.get("afterShapeName");
|
||||
ConvertType convertType = (ConvertType) param.get("convertType");
|
||||
BaseModel baseModel = CoeDesignerAPIManager.getInstance().getDefinition(sourceRepositoryId, 0);
|
||||
String definition = baseModel.getDefinition();
|
||||
JSONObject defineJsonObj = JSONObject.parseObject(definition);
|
||||
@ -76,7 +78,7 @@ public class TextTypeAttrHandle implements DataAttributeStrategy {
|
||||
String targetDefinition = CoeDesignerAPIManager.getInstance().getDefinition(targetRepositoryId, 0).getDefinition();
|
||||
JSONObject targetDefineJsonObj = JSONObject.parseObject(targetDefinition);
|
||||
JSONObject targetElements = targetDefineJsonObj.getJSONObject("elements");
|
||||
JSONObject targetShape = targetElements.getJSONObject(ConvertShapeIdMapping.getInstance().getTargetShapeId(key));
|
||||
JSONObject targetShape = targetElements.getJSONObject(ConvertShapeIdMapping.getInstance().getTargetShapeId(convertType,key));
|
||||
if (targetShape.containsKey("dataAttributes") && targetShape.getJSONArray("dataAttributes") != null){
|
||||
JSONArray targetDataAttributes = targetShape.getJSONArray("dataAttributes");
|
||||
for (int k = 0; k < targetDataAttributes.size(); k++) {
|
||||
@ -85,7 +87,7 @@ public class TextTypeAttrHandle implements DataAttributeStrategy {
|
||||
JSONArray targetItemJSONArray = targetItem.getJSONArray("attributesJsonArray");
|
||||
for (int l = 0; l < targetItemJSONArray.size(); l++) {
|
||||
JSONObject targetObj = targetItemJSONArray.getJSONObject(l);
|
||||
if (targetObj == null) continue;
|
||||
if (targetObj == null || targetObj.size() == 0) continue;
|
||||
if (targetObj.getString("id").equals(attrId)) targetItemJSONArray.remove(l);
|
||||
}
|
||||
JSONObject tempObj = new JSONObject();
|
||||
@ -110,7 +112,7 @@ public class TextTypeAttrHandle implements DataAttributeStrategy {
|
||||
}
|
||||
}
|
||||
|
||||
targetElements.put(ConvertShapeIdMapping.getInstance().getTargetShapeId(key),targetShape);
|
||||
targetElements.put(ConvertShapeIdMapping.getInstance().getTargetShapeId(convertType,key),targetShape);
|
||||
targetDefineJsonObj.put("elements",targetElements);
|
||||
BaseModel model = CoeDesignerAPIManager.getInstance().getDefinition(targetRepositoryId, 0);
|
||||
if (model == null) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -4,6 +4,7 @@ import com.actionsoft.apps.coe.pal.constant.CoEConstant;
|
||||
import com.actionsoft.apps.coe.pal.modelconvert.cache.ConvertShapeIdMapping;
|
||||
import com.actionsoft.apps.coe.pal.modelconvert.cache.ConvertShapeNameMapping;
|
||||
import com.actionsoft.apps.coe.pal.modelconvert.cache.RepositoryModelCache;
|
||||
import com.actionsoft.apps.coe.pal.modelconvert.constant.ConvertType;
|
||||
import com.actionsoft.apps.coe.pal.modelconvert.constant.LinkerDefConstant;
|
||||
import com.actionsoft.apps.coe.pal.modelconvert.constant.ShapeConstant;
|
||||
import com.actionsoft.apps.coe.pal.modelconvert.dao.HistoryRecordDao;
|
||||
@ -194,7 +195,7 @@ public class EpcToFlowChart implements ModelConvertStrategy {
|
||||
private void handleEPCToFlowChart(UserContext _uc,String repositoryId,String newRepositoryId,String targetMethodId){
|
||||
|
||||
// 每次转换前将存储的图形ID的映射关系清空
|
||||
ConvertShapeIdMapping.getInstance().clear();
|
||||
ConvertShapeIdMapping.getInstance().clear(ConvertType.EPC_FLOWCHART);
|
||||
|
||||
// 3、根据当前EPC的define生成flowChart的define
|
||||
BaseModel baseModel = CoeDesignerAPIManager.getInstance().getDefinition(repositoryId, 0);
|
||||
@ -253,7 +254,7 @@ public class EpcToFlowChart implements ModelConvertStrategy {
|
||||
toBeDeletes.add(key);
|
||||
|
||||
// 存储一下转换前与转换后图形ID的映射关系
|
||||
ConvertShapeIdMapping.getInstance().load(key,_id);
|
||||
ConvertShapeIdMapping.getInstance().load(ConvertType.EPC_FLOWCHART,key,_id);
|
||||
}
|
||||
if (!"linker".equals(shapeName)) {
|
||||
element.put("category",targetMethodId);
|
||||
@ -262,7 +263,7 @@ public class EpcToFlowChart implements ModelConvertStrategy {
|
||||
|
||||
// 除判断条件中的图形外 其他图形的ID转换前与转换后是一致的 因为总体上是在转换前的 definition 上进行改造
|
||||
if (!("and".equals(shapeName) || "or".equals(shapeName) || "xor".equals(shapeName) || "event".equals(shapeName))){
|
||||
ConvertShapeIdMapping.getInstance().load(key,key);
|
||||
ConvertShapeIdMapping.getInstance().load(ConvertType.EPC_FLOWCHART,key,key);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -545,6 +546,7 @@ public class EpcToFlowChart implements ModelConvertStrategy {
|
||||
param.put("sourceRepositoryId",sourceRepositoryId);
|
||||
param.put("targetRepositoryId",targetRepositoryId);
|
||||
param.put("attrId",sourceFileAttr.getAttrId());
|
||||
param.put("convertType",ConvertType.EPC_FLOWCHART);
|
||||
attributeStrategy.fileAttrHandle(param);
|
||||
}
|
||||
});
|
||||
@ -569,6 +571,7 @@ public class EpcToFlowChart implements ModelConvertStrategy {
|
||||
param.put("beforeShapeName",sourceShapeAttr.getShapeName());
|
||||
param.put("afterShapeName",ConvertShapeNameMapping.getInstance().getShapeName(sourceShapeAttr.getShapeName()));
|
||||
param.put("attrId",sourceShapeAttr.getAttrId());
|
||||
param.put("convertType",ConvertType.EPC_FLOWCHART);
|
||||
attributeStrategy.shapeAttrHandle(param);
|
||||
}
|
||||
});
|
||||
|
||||
@ -6,13 +6,126 @@ import com.actionsoft.apps.coe.pal.modelconvert.model.Position;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
|
||||
public class ConvertUtil {
|
||||
|
||||
private static String gateWay0Key = "{\"ref\":\"gateway0\"}";
|
||||
private static String gateWay0Value = "[{\"action\":\"move\", \"x\":\"0\", \"y\":\"h*0.5\"},{\"action\":\"line\", \"x\":\"w*0.5\", \"y\":\"0\"}," +
|
||||
"{\"action\":\"line\", \"x\":\"w\", \"y\":\"h*0.5\"},{\"action\":\"line\", \"x\":\"w*0.5\", \"y\":\"h\"}," +
|
||||
"{\"action\":\"line\", \"x\":\"0\", \"y\":\"h*0.5\"},{\"action\":\"close\"}]";
|
||||
|
||||
private static String roundKey = "{\"ref\":\"round\"}";
|
||||
private static String roundValue = "[{\"action\":\"move\",\"x\":\"0\",\"y\":\"h/2\"}," +
|
||||
"{\"action\":\"curve\",\"x1\":\"0\",\"y1\":\"-h/6\",\"x2\":\"w\",\"y2\":\"-h/6\",\"x\":\"w\",\"y\":\"h/2\"}," +
|
||||
"{\"action\":\"curve\",\"x1\":\"w\",\"y1\":\"h+h/6\",\"x2\":\"0\",\"y2\":\"h+h/6\",\"x\":\"0\",\"y\":\"h/2\"}," +
|
||||
"{\"action\":\"close\"}]";
|
||||
|
||||
private static String roundRectangleKey = "{\"ref\":\"roundRectangle\"}";
|
||||
private static String roundRectangleValue = "[{\"action\":\"move\",\"x\":\"0\",\"y\":\"4\"}," +
|
||||
"{\"action\":\"quadraticCurve\",\"x1\":\"0\",\"y1\":\"0\",\"x\":\"4\",\"y\":\"0\"}," +
|
||||
"{\"action\":\"line\",\"x\":\"w-4\",\"y\":\"0\"}," +
|
||||
"{\"action\":\"quadraticCurve\",\"x1\":\"w\",\"y1\":\"0\",\"x\":\"w\",\"y\":\"4\"}," +
|
||||
"{\"action\":\"line\",\"x\":\"w\",\"y\":\"h-4\"}," +
|
||||
"{\"action\":\"quadraticCurve\",\"x1\":\"w\",\"y1\":\"h\",\"x\":\"w-4\",\"y\":\"h\"}," +
|
||||
"{\"action\":\"line\",\"x\":\"4\",\"y\":\"h\"}," +
|
||||
"{\"action\":\"quadraticCurve\",\"x1\":\"0\",\"y1\":\"h\",\"x\":\"0\",\"y\":\"h-4\"}," +
|
||||
"{\"action\":\"close\"}]";
|
||||
|
||||
private static String scriptTaskKey = "{\"ref\":\"script_task\"}";
|
||||
private static String scriptTaskValue = "[{\"action\":\"move\", \"x\":\"100*0.15- 100*0.05\", \"y\":\"60*0.24- 60*0.1\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"100*0.15 + 100*0.05\", \"y\":\"60*0.24 - 60*0.1\"},\n" +
|
||||
" {\"action\":\"curve\", \"x1\":\"100*0.15 + 100*0.02\", \"y1\":\"60*0.24 - 60*0.1\", \"x2\":\"100*0.15 + 100*0.02\", \"y2\":\"60*0.24\", \"x\":\"100*0.15 + 100*0.04\", \"y\":\"60*0.24\"},\n" +
|
||||
" {\"action\":\"curve\", \"x1\":\"100*0.15 + 100*0.06\", \"y1\":\"60*0.24\", \"x2\":\"100*0.15 + 100*0.06\", \"y2\":\"60*0.24 + 60*0.1\", \"x\":\"100*0.15 + 100*0.03\", \"y\":\"60*0.24 + 60*0.1\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"100*0.15 - 100*0.08\", \"y\":\"60*0.24 + 60*0.1\"},\n" +
|
||||
" {\"action\":\"curve\", \"x1\":\"100*0.15 - 100*0.05\", \"y1\":\"60*0.24 + 60*0.1\", \"x2\":\"100*0.15 - 100*0.05\", \"y2\":\"60*0.24\", \"x\":\"100*0.15 - 100*0.07\", \"y\":\"60*0.24\"},\n" +
|
||||
" {\"action\":\"curve\", \"x1\":\"100*0.15 - 100*0.09\", \"y1\":\"60*0.24\", \"x2\":\"100*0.15 - 100*0.09\", \"y2\":\"60*0.24 - 60*0.1\", \"x\":\"100*0.15 - 100*0.05\", \"y\":\"60*0.24 - 60*0.1\"},\n" +
|
||||
" {\"action\":\"close\"},\n" +
|
||||
" {\"action\":\"move\", \"x\":\"100*0.15 - 100*0.08\", \"y\":\"60*0.24 - 60*0.05\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"100*0.15 + 100*0.025\", \"y\":\"60*0.24 - 60*0.05\"},\n" +
|
||||
" {\"action\":\"move\", \"x\":\"100*0.15 - 100*0.07\", \"y\":\"60*0.24 - 0\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"100*0.15 + 100*0.04\", \"y\":\"60*0.24 - 0\"},\n" +
|
||||
" {\"action\":\"move\", \"x\":\"100*0.15 - 100*0.055\", \"y\":\"60*0.24 + 60*0.06\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"100*0.15 + 100*0.05\", \"y\":\"60*0.24 + 60*0.06\"}]";
|
||||
|
||||
private static String manualTaskKey = "{\"ref\":\"manual_task\"}";
|
||||
private static String manualTaskValue = "[{\"action\":\"move\", \"x\":\"100*0.15- 100*0.08\", \"y\":\"60*0.2\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"100*0.15- 100*0.04\", \"y\":\"60*0.2\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"100*0.15+ 100*0.01\", \"y\":\"60*0.13\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"100*0.15+ 100*0.04\", \"y\":\"60*0.13\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"100*0.15 + 100*0.04\", \"y\":\"60*0.17\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"100*0.15+ 100*0.01\", \"y\":\"60*0.17\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"100*0.15+ 100*0.1\", \"y\":\"60*0.17\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"100*0.15+ 100*0.1\", \"y\":\"60*0.21\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"100*0.15+ 100*0.01\", \"y\":\"60*0.21\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"100*0.15+ 100*0.06\", \"y\":\"60*0.21\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"100*0.15+ 100*0.06\", \"y\":\"60*0.25\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"100*0.15+ 100*0.01\", \"y\":\"60*0.25\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"100*0.15+ 100*0.06\", \"y\":\"60*0.25\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"100*0.15+ 100*0.06\", \"y\":\"60*0.29\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"100*0.15+ 100*0.06\", \"y\":\"60*0.29\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"100*0.15+ 100*0.04\", \"y\":\"60*0.29\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"100*0.15+ 100*0.04\", \"y\":\"60*0.33\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"100*0.15- 100*0.04\", \"y\":\"60*0.33\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"100*0.15- 100*0.08\", \"y\":\"60*0.28\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"100*0.15- 100*0.08\", \"y\":\"60*0.2\"},\n" +
|
||||
" {\"action\":\"close\"}]";
|
||||
|
||||
private static String rectangleKey = "{\"ref\":\"rectangle\"}";
|
||||
private static String rectangleValue = "[{\"action\": \"move\",\"x\": \"0\",\"y\": \"0\"},\n" +
|
||||
"{\"action\": \"line\",\"x\": \"w\",\"y\": \"0\"},\n" +
|
||||
"{\"action\": \"line\",\"x\": \"w\",\"y\": \"h\"},\n" +
|
||||
"{\"action\": \"line\",\"x\": \"0\",\"y\": \"h\"},\n" +
|
||||
"{\"action\": \"close\"}]";
|
||||
|
||||
private static String parallelGatewaykey = "{\"ref\":\"parallel_gateway\"}";
|
||||
private static String parallelGatewayValue = "[{\"action\":\"move\", \"x\":\"w*0.5 - Math.min(w,h)*0.04\", \"y\":\"h*0.5 - h*0.5*0.5\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"w*0.5 - Math.min(w,h)*0.04\", \"y\":\"h*0.5 + h*0.5*0.5\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"w*0.5 + Math.min(w,h)*0.04\", \"y\":\"h*0.5 + h*0.5*0.5\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"w*0.5 + Math.min(w,h)*0.04\", \"y\":\"h*0.5 - h*0.5*0.5\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"w*0.5 - Math.min(w,h)*0.04\", \"y\":\"h*0.5 - h*0.5*0.5\"},\n" +
|
||||
" {\"action\":\"close\"},\n" +
|
||||
" {\"action\":\"move\", \"x\":\"w*0.5 - w*0.5*0.5\", \"y\":\"h*0.5 - Math.min(w,h)*0.04\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"w*0.5 - w*0.5*0.5\", \"y\":\"h*0.5 + Math.min(w,h)*0.04\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"w*0.5 + w*0.5*0.5\", \"y\":\"h*0.5 + Math.min(w,h)*0.04\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"w*0.5 + w*0.5*0.5\", \"y\":\"h*0.5 - Math.min(w,h)*0.04\"},\n" +
|
||||
" {\"action\":\"line\", \"x\":\"w*0.5 - w*0.5*0.5\", \"y\":\"h*0.5 - Math.min(w,h)*0.04\"},\n" +
|
||||
" {\"action\":\"close\"}]";
|
||||
|
||||
private static String gRoundKey = "{\"ref\":\"g_round\"}";
|
||||
private static String getRoundValue = "[{\"action\":\"move\", \"x\":\"w*0.5 - w*0.25\", \"y\":\"h*0.5\"},\n" +
|
||||
" {\"action\":\"curve\", \"x1\":\"w*0.5 - w*0.25\", \"y1\":\"h*0.5 - h*2/3*0.5\", \"x2\":\"w*0.5 + w*0.25\", \"y2\":\"h*0.5 - h*2/3*0.5\", \"x\":\"w*0.5 + w*0.25\", \"y\":\"h*0.5\"},\n" +
|
||||
" {\"action\":\"curve\", \"x1\":\"w*0.5 + w*0.25\", \"y1\":\"h*0.5 + h*2/3*0.5\", \"x2\":\"w*0.5 - w*0.25\", \"y2\":\"h*0.5 + h*2/3*0.5\", \"x\":\"w*0.5 - w*0.25\", \"y\":\"h*0.5\"},\n" +
|
||||
" {\"action\":\"close\"}]";
|
||||
|
||||
// EPC与BPMN模型中的图形的映射关系
|
||||
public static Map<String,String> shapeNameMapping = new HashMap<>();
|
||||
|
||||
// 存储schema中图形ref的引用
|
||||
public static Map<String,String> schemaShapeMapping = new HashMap<>();
|
||||
|
||||
static {
|
||||
shapeNameMapping.put("method_approval_node","userTask"); // 线上审批 -> 人工任务
|
||||
shapeNameMapping.put("method_service_node","manualTask"); // 线下审批 -> 手工任务
|
||||
shapeNameMapping.put("method_approval_node3","manualTask"); // 系统任务 -> 手工任务
|
||||
shapeNameMapping.put("method_service_node4","manualTask"); // 人工任务 -> 手工任务
|
||||
shapeNameMapping.put("procedure","textAnnotation"); // 流程接口 -> 注释
|
||||
shapeNameMapping.put("and","inclusiveGateway"); // 与 -> 包容网关
|
||||
shapeNameMapping.put("or","parallelGateway"); // 或 -> 并行网关
|
||||
shapeNameMapping.put("xor","exclusiveGateway"); // 异或 -> 排它网关
|
||||
|
||||
shapeNameMapping.put("event","messageIntermediateThrowingEvent"); // 事件 -> 抛出消息事件
|
||||
|
||||
schemaShapeMapping.put(gateWay0Key,gateWay0Value);
|
||||
schemaShapeMapping.put(roundKey,roundValue);
|
||||
schemaShapeMapping.put(roundRectangleKey,roundRectangleValue);
|
||||
schemaShapeMapping.put(scriptTaskKey,scriptTaskValue);
|
||||
schemaShapeMapping.put(manualTaskKey,manualTaskValue);
|
||||
schemaShapeMapping.put(rectangleKey,rectangleValue);
|
||||
schemaShapeMapping.put(parallelGatewaykey,parallelGatewayValue);
|
||||
schemaShapeMapping.put(gRoundKey,getRoundValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 匹配转换的类型
|
||||
* @param sourceMethod
|
||||
@ -82,4 +195,14 @@ public class ConvertUtil {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// 根据EPC的图形名称获取映射后的BPMN的图形名称
|
||||
public static String epcToBPMNShapeMapping(String shapeName){
|
||||
return shapeNameMapping.get(shapeName);
|
||||
}
|
||||
|
||||
public static Map<String,String> getSchemaShapeMapping(){
|
||||
return schemaShapeMapping;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user