模型、清单导入批处理关联属性校验由路径校验改为只用名称校验
This commit is contained in:
parent
4500661a91
commit
0ceb6fcfec
Binary file not shown.
@ -1,11 +1,6 @@
|
||||
package com.actionsoft.apps.coe.pal.batch.web.create.process.valid.impl.type;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import com.actionsoft.apps.AppsConst;
|
||||
import com.actionsoft.apps.coe.pal.batch.util.BatchUtil;
|
||||
@ -78,81 +73,43 @@ public class ValidRelation implements ValidCell {
|
||||
isOk = false;
|
||||
msg = "单选属性不支持多个值";
|
||||
} else {
|
||||
for (String path : valueSet) {
|
||||
String [] pathArr = path.split("/");
|
||||
boolean flag = true;
|
||||
List<String> tmpList = new ArrayList<String>();
|
||||
for (int j = 0; j < pathArr.length; j++) {
|
||||
if (UtilString.isEmpty(pathArr[j])) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]不存在";
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
if (j == 0) {// 寻找流程大类是否存在
|
||||
if (!pathArr[j].equals(I18nRes.findValue(CoEConstant.APP_ID, category))) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]不存在";
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
tmpList.add(category);
|
||||
} else {
|
||||
// 获取子节点
|
||||
List<String> tmpList2 = new ArrayList<String>();
|
||||
for (String pid : tmpList) {
|
||||
List<PALRepositoryModel> list = PALRepositoryCache.getAllSubModelsByPid(wsId, pid);
|
||||
for (PALRepositoryModel model : list) {
|
||||
if (model.isUse() && model.getName().equals(pathArr[j])) {
|
||||
if (j == pathArr.length - 1) {
|
||||
if ("default".equals(model.getMethodId())) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]末级流程不允许是文件夹";
|
||||
flag = false;
|
||||
break;
|
||||
} else if (!model.getMethodId().contains(method)) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]末级流程不符合属性范围要求";
|
||||
} else {
|
||||
tmpList2.add(model.getId());
|
||||
}
|
||||
} else {
|
||||
tmpList2.add(model.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag && tmpList2.size() == 0) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]不存在";
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
tmpList = tmpList2;
|
||||
Iterator<PALRepositoryModel> iterator = PALRepositoryCache.getByWsId(wsId);
|
||||
Map<String, String> map = new HashMap<>();
|
||||
while (iterator.hasNext()) {
|
||||
PALRepositoryModel model = iterator.next();
|
||||
if (model.isUse()) {
|
||||
map.put(model.getId(), model.getName().trim());
|
||||
}
|
||||
}
|
||||
for (String name : valueSet) {
|
||||
List<String> ids = new ArrayList<>();
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
if (name.equals(entry.getValue())) {
|
||||
ids.add(entry.getKey());
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
if (tmpList.size() == 0) {
|
||||
if (ids.size() == 0) {
|
||||
isOk = false;
|
||||
msg = "[" + name + "]不存在";
|
||||
break;
|
||||
} if (ids.size() > 1) {
|
||||
isOk = false;
|
||||
msg = "[" + name + "]出现多个匹配";
|
||||
break;
|
||||
} else {
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(ids.get(0));
|
||||
if ("default".equals(model.getMethodId())) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]不存在";
|
||||
msg = "[" + name + "]不允许是文件夹";
|
||||
break;
|
||||
} else if (tmpList.size() > 1) {
|
||||
} else if (!model.getMethodId().contains(method)) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]存在多个,无法匹配";
|
||||
break;
|
||||
} else if (tmpList.get(0).length() < 36) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]不存在";
|
||||
msg = "[" + name + "]不符合属性范围要求";
|
||||
break;
|
||||
} else {
|
||||
isOk = true;
|
||||
repositoryIds.add(tmpList.get(0));
|
||||
repositoryIds.add(model.getId());
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -169,7 +126,7 @@ public class ValidRelation implements ValidCell {
|
||||
}
|
||||
}
|
||||
attr.put("relations", result);
|
||||
} else {// 关联的是形状
|
||||
} else if ("shape".equals(type)) {// 关联的是形状
|
||||
Set<String> fileShapeIds = new HashSet<>();
|
||||
String [] valueArr = value.split(",");
|
||||
// 过滤掉空值
|
||||
@ -183,108 +140,70 @@ public class ValidRelation implements ValidCell {
|
||||
isOk = false;
|
||||
msg = "单选属性不支持多个值";
|
||||
} else {
|
||||
for (String path : valueSet) {
|
||||
String [] pathArr = path.split("/");
|
||||
boolean flag = true;
|
||||
List<String> tmpList = new ArrayList<String>();
|
||||
for (int j = 0; j < pathArr.length; j++) {
|
||||
if (UtilString.isEmpty(pathArr[j])) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]不存在";
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
if (j == 0) {// 寻找流程大类是否存在
|
||||
if (!pathArr[j].equals(I18nRes.findValue(CoEConstant.APP_ID, category))) {
|
||||
isOk = false;
|
||||
msg = "大类路径[" + path + "]不存在";
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
tmpList.add(category);
|
||||
} else {
|
||||
// 获取子节点
|
||||
List<String> tmpList2 = new ArrayList<String>();
|
||||
for (String pid : tmpList) {
|
||||
List<PALRepositoryModel> list = PALRepositoryCache.getAllSubModelsByPid(wsId, pid);
|
||||
String repositoryName = null;
|
||||
String shapeName = null;
|
||||
if (j == pathArr.length - 1) {
|
||||
// 拆分名称为名称+节点名称
|
||||
String [] namePath = pathArr[j].split(":");
|
||||
if (namePath.length == 2 && !UtilString.isEmpty(namePath[0]) && !UtilString.isEmpty(namePath[1])) {
|
||||
repositoryName = namePath[0];
|
||||
shapeName = namePath[1];
|
||||
} else {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]末级流程与节点信息错误";
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j == pathArr.length - 1) {// 最后一个层级
|
||||
for (PALRepositoryModel model : list) {
|
||||
if (model.isUse() && model.getName().equals(repositoryName)) {
|
||||
if ("default".equals(model.getMethodId())) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]末级流程不允许是文件夹";
|
||||
flag = false;
|
||||
break;
|
||||
} else if (!model.getMethodId().contains(method)) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]末级流程不符合属性范围要求";
|
||||
} else {
|
||||
// 获取节点数据
|
||||
String definition = PALRepositoryQueryAPIManager.getInstance().getProcessDefinition(null, model.getId());
|
||||
List<JSONObject> shapes = ShapeUtil.getShapeJsonToJsonObject(definition);
|
||||
for (JSONObject shape : shapes) {
|
||||
if (shapeName.equals(shape.getString("text"))) {
|
||||
// 获取匹配的节点数据
|
||||
tmpList2.add(model.getId() + ":" + shape.getString("id") + ":" + shape.getString("text"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (PALRepositoryModel model : list) {
|
||||
if (model.isUse() && model.getName().equals(pathArr[j])) {
|
||||
tmpList2.add(model.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag && tmpList2.size() == 0) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]不存在";
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
tmpList = tmpList2;
|
||||
Iterator<PALRepositoryModel> iterator = PALRepositoryCache.getByWsId(wsId);
|
||||
Map<String, String> map = new HashMap<>();
|
||||
while (iterator.hasNext()) {
|
||||
PALRepositoryModel model = iterator.next();
|
||||
if (model.isUse()) {
|
||||
map.put(model.getId(), model.getName().trim());
|
||||
}
|
||||
}
|
||||
for (String nameArr : valueSet) {
|
||||
// 拆分名称为名称+节点名称
|
||||
String name = null;
|
||||
String shapeName = null;
|
||||
String [] namePath = nameArr.split(":");
|
||||
if (namePath.length == 2 && !UtilString.isEmpty(namePath[0]) && !UtilString.isEmpty(namePath[1])) {
|
||||
name = namePath[0];
|
||||
shapeName = namePath[1];
|
||||
} else {
|
||||
isOk = false;
|
||||
msg = "[" + nameArr + "]末级模型与节点信息错误";
|
||||
break;
|
||||
}
|
||||
List<String> ids = new ArrayList<>();
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
if (name.equals(entry.getValue())) {
|
||||
ids.add(entry.getKey());
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
if (tmpList.size() == 0) {
|
||||
if (ids.size() == 0) {
|
||||
isOk = false;
|
||||
msg = "[" + name + "]不存在";
|
||||
break;
|
||||
} if (ids.size() > 1) {
|
||||
isOk = false;
|
||||
msg = "[" + name + "]出现多个匹配";
|
||||
break;
|
||||
} else {
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(ids.get(0));
|
||||
if ("default".equals(model.getMethodId())) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]不存在";
|
||||
msg = "[" + name + "]不允许是文件夹";
|
||||
break;
|
||||
} else if (tmpList.size() > 1) {
|
||||
} else if (!model.getMethodId().contains(method)) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]存在多个,无法匹配";
|
||||
break;
|
||||
} else if (tmpList.get(0).length() < 36) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]不存在";
|
||||
msg = "[" + name + "]不符合属性范围要求";
|
||||
break;
|
||||
} else {
|
||||
String result = null;
|
||||
// 获取节点数据
|
||||
String definition = PALRepositoryQueryAPIManager.getInstance().getProcessDefinition(null, model.getId());
|
||||
List<JSONObject> shapes = ShapeUtil.getShapeJsonToJsonObject(definition);
|
||||
for (JSONObject shape : shapes) {
|
||||
if (shapeName.equals(shape.getString("text"))) {
|
||||
// 获取匹配的节点数据
|
||||
result = model.getId() + ":" + shape.getString("id") + ":" + shape.getString("text");
|
||||
}
|
||||
}
|
||||
if (result == null) {
|
||||
isOk = false;
|
||||
msg = "[" + shapeName + "]不存在";
|
||||
break;
|
||||
}
|
||||
isOk = true;
|
||||
fileShapeIds.add(tmpList.get(0));
|
||||
fileShapeIds.add(result);
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -300,6 +219,8 @@ public class ValidRelation implements ValidCell {
|
||||
shapes.add(object);
|
||||
}
|
||||
attr.put("relations", shapes);
|
||||
} else {
|
||||
msg = "不支持形状和模型同时选择的类型";
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("name", title);
|
||||
|
||||
@ -1,14 +1,11 @@
|
||||
package com.actionsoft.apps.coe.pal.batch.web.create.shape.valid.impl.type;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import com.actionsoft.apps.AppsConst;
|
||||
import com.actionsoft.apps.coe.pal.batch.util.BatchUtil;
|
||||
import com.actionsoft.apps.coe.pal.batch.web.create.process.ProcessConst;
|
||||
import com.actionsoft.apps.coe.pal.batch.web.create.process.valid.ValidCell;
|
||||
import com.actionsoft.apps.coe.pal.batch.web.create.shape.ShapeConst;
|
||||
import com.actionsoft.apps.coe.pal.batch.web.create.shape.valid.ValidShapeCell;
|
||||
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
|
||||
@ -22,9 +19,13 @@ import com.actionsoft.i18n.I18nRes;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* 校验关联PAL模型和形状类型
|
||||
* @author sunlh
|
||||
*
|
||||
*/
|
||||
public class ValidShapeRelation implements ValidShapeCell {
|
||||
|
||||
|
||||
private String getCategoryId(String categoryName) {
|
||||
Map<String, String> result = new HashMap<>();
|
||||
String [] methodArray = PALMethodCache.getPALMethodList(true).toArray(new String[0]);
|
||||
@ -36,7 +37,7 @@ public class ValidShapeRelation implements ValidShapeCell {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object validTableCell(Object param) {
|
||||
JSONObject paramObj = JSONObject.parseObject(param.toString());
|
||||
@ -74,81 +75,43 @@ public class ValidShapeRelation implements ValidShapeCell {
|
||||
isOk = false;
|
||||
msg = "单选属性不支持多个值";
|
||||
} else {
|
||||
for (String path : valueSet) {
|
||||
String [] pathArr = path.split("/");
|
||||
boolean flag = true;
|
||||
List<String> tmpList = new ArrayList<String>();
|
||||
for (int j = 0; j < pathArr.length; j++) {
|
||||
if (UtilString.isEmpty(pathArr[j])) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]不存在";
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
if (j == 0) {// 寻找流程大类是否存在
|
||||
if (!pathArr[j].equals(I18nRes.findValue(CoEConstant.APP_ID, category))) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]不存在";
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
tmpList.add(category);
|
||||
} else {
|
||||
// 获取子节点
|
||||
List<String> tmpList2 = new ArrayList<String>();
|
||||
for (String pid : tmpList) {
|
||||
List<PALRepositoryModel> list = PALRepositoryCache.getAllSubModelsByPid(wsId, pid);
|
||||
for (PALRepositoryModel model : list) {
|
||||
if (model.isUse() && model.getName().equals(pathArr[j])) {
|
||||
if (j == pathArr.length - 1) {
|
||||
if ("default".equals(model.getMethodId())) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]末级流程不允许是文件夹";
|
||||
flag = false;
|
||||
break;
|
||||
} else if (!model.getMethodId().contains(method)) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]末级流程不符合属性范围要求";
|
||||
} else {
|
||||
tmpList2.add(model.getId());
|
||||
}
|
||||
} else {
|
||||
tmpList2.add(model.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag && tmpList2.size() == 0) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]不存在";
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
tmpList = tmpList2;
|
||||
Iterator<PALRepositoryModel> iterator = PALRepositoryCache.getByWsId(wsId);
|
||||
Map<String, String> map = new HashMap<>();
|
||||
while (iterator.hasNext()) {
|
||||
PALRepositoryModel model = iterator.next();
|
||||
if (model.isUse()) {
|
||||
map.put(model.getId(), model.getName().trim());
|
||||
}
|
||||
}
|
||||
for (String name : valueSet) {
|
||||
List<String> ids = new ArrayList<>();
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
if (name.equals(entry.getValue())) {
|
||||
ids.add(entry.getKey());
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
if (tmpList.size() == 0) {
|
||||
if (ids.size() == 0) {
|
||||
isOk = false;
|
||||
msg = "[" + name + "]不存在";
|
||||
break;
|
||||
} if (ids.size() > 1) {
|
||||
isOk = false;
|
||||
msg = "[" + name + "]出现多个匹配";
|
||||
break;
|
||||
} else {
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(ids.get(0));
|
||||
if ("default".equals(model.getMethodId())) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]不存在";
|
||||
msg = "[" + name + "]不允许是文件夹";
|
||||
break;
|
||||
} else if (tmpList.size() > 1) {
|
||||
} else if (!model.getMethodId().contains(method)) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]存在多个,无法匹配";
|
||||
break;
|
||||
} else if (tmpList.get(0).length() < 36) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]不存在";
|
||||
msg = "[" + name + "]不符合属性范围要求";
|
||||
break;
|
||||
} else {
|
||||
isOk = true;
|
||||
repositoryIds.add(tmpList.get(0));
|
||||
repositoryIds.add(model.getId());
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -165,7 +128,7 @@ public class ValidShapeRelation implements ValidShapeCell {
|
||||
}
|
||||
}
|
||||
attr.put("relations", result);
|
||||
} else {// 关联的是形状
|
||||
} else if ("shape".equals(type)) {// 关联的是形状
|
||||
Set<String> fileShapeIds = new HashSet<>();
|
||||
String [] valueArr = value.split(",");
|
||||
// 过滤掉空值
|
||||
@ -179,113 +142,75 @@ public class ValidShapeRelation implements ValidShapeCell {
|
||||
isOk = false;
|
||||
msg = "单选属性不支持多个值";
|
||||
} else {
|
||||
for (String path : valueSet) {
|
||||
String [] pathArr = path.split("/");
|
||||
boolean flag = true;
|
||||
List<String> tmpList = new ArrayList<String>();
|
||||
for (int j = 0; j < pathArr.length; j++) {
|
||||
if (UtilString.isEmpty(pathArr[j])) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]不存在";
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
if (j == 0) {// 寻找流程大类是否存在
|
||||
if (!pathArr[j].equals(I18nRes.findValue(CoEConstant.APP_ID, category))) {
|
||||
isOk = false;
|
||||
msg = "大类路径[" + path + "]不存在";
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
tmpList.add(category);
|
||||
} else {
|
||||
// 获取子节点
|
||||
List<String> tmpList2 = new ArrayList<String>();
|
||||
for (String pid : tmpList) {
|
||||
List<PALRepositoryModel> list = PALRepositoryCache.getAllSubModelsByPid(wsId, pid);
|
||||
String repositoryName = null;
|
||||
String shapeName = null;
|
||||
if (j == pathArr.length - 1) {
|
||||
// 拆分名称为名称+节点名称
|
||||
String [] namePath = pathArr[j].split(":");
|
||||
if (namePath.length == 2 && !UtilString.isEmpty(namePath[0]) && !UtilString.isEmpty(namePath[1])) {
|
||||
repositoryName = namePath[0];
|
||||
shapeName = namePath[1];
|
||||
} else {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]末级流程与节点信息错误";
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j == pathArr.length - 1) {// 最后一个层级
|
||||
for (PALRepositoryModel model : list) {
|
||||
if (model.isUse() && model.getName().equals(repositoryName)) {
|
||||
if ("default".equals(model.getMethodId())) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]末级流程不允许是文件夹";
|
||||
flag = false;
|
||||
break;
|
||||
} else if (!model.getMethodId().contains(method)) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]末级流程不符合属性范围要求";
|
||||
} else {
|
||||
// 获取节点数据
|
||||
String definition = PALRepositoryQueryAPIManager.getInstance().getProcessDefinition(null, model.getId());
|
||||
List<JSONObject> shapes = ShapeUtil.getShapeJsonToJsonObject(definition);
|
||||
for (JSONObject shape : shapes) {
|
||||
if (shapeName.equals(shape.getString("text"))) {
|
||||
// 获取匹配的节点数据
|
||||
tmpList2.add(model.getId() + ":" + shape.getString("id") + ":" + shape.getString("text"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (PALRepositoryModel model : list) {
|
||||
if (model.isUse() && model.getName().equals(pathArr[j])) {
|
||||
tmpList2.add(model.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag && tmpList2.size() == 0) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]不存在";
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
tmpList = tmpList2;
|
||||
Iterator<PALRepositoryModel> iterator = PALRepositoryCache.getByWsId(wsId);
|
||||
Map<String, String> map = new HashMap<>();
|
||||
while (iterator.hasNext()) {
|
||||
PALRepositoryModel model = iterator.next();
|
||||
if (model.isUse()) {
|
||||
map.put(model.getId(), model.getName().trim());
|
||||
}
|
||||
}
|
||||
for (String nameArr : valueSet) {
|
||||
// 拆分名称为名称+节点名称
|
||||
String name = null;
|
||||
String shapeName = null;
|
||||
String [] namePath = nameArr.split(":");
|
||||
if (namePath.length == 2 && !UtilString.isEmpty(namePath[0]) && !UtilString.isEmpty(namePath[1])) {
|
||||
name = namePath[0];
|
||||
shapeName = namePath[1];
|
||||
} else {
|
||||
isOk = false;
|
||||
msg = "[" + nameArr + "]末级模型与节点信息错误";
|
||||
break;
|
||||
}
|
||||
List<String> ids = new ArrayList<>();
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
if (name.equals(entry.getValue())) {
|
||||
ids.add(entry.getKey());
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
if (tmpList.size() == 0) {
|
||||
if (ids.size() == 0) {
|
||||
isOk = false;
|
||||
msg = "[" + name + "]不存在";
|
||||
break;
|
||||
} if (ids.size() > 1) {
|
||||
isOk = false;
|
||||
msg = "[" + name + "]出现多个匹配";
|
||||
break;
|
||||
} else {
|
||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(ids.get(0));
|
||||
if ("default".equals(model.getMethodId())) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]不存在";
|
||||
msg = "[" + name + "]不允许是文件夹";
|
||||
break;
|
||||
} else if (tmpList.size() > 1) {
|
||||
} else if (!model.getMethodId().contains(method)) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]存在多个,无法匹配";
|
||||
break;
|
||||
} else if (tmpList.get(0).length() < 36) {
|
||||
isOk = false;
|
||||
msg = "路径[" + path + "]不存在";
|
||||
msg = "[" + name + "]不符合属性范围要求";
|
||||
break;
|
||||
} else {
|
||||
String result = null;
|
||||
// 获取节点数据
|
||||
String definition = PALRepositoryQueryAPIManager.getInstance().getProcessDefinition(null, model.getId());
|
||||
List<JSONObject> shapes = ShapeUtil.getShapeJsonToJsonObject(definition);
|
||||
for (JSONObject shape : shapes) {
|
||||
if (shapeName.equals(shape.getString("text"))) {
|
||||
// 获取匹配的节点数据
|
||||
result = model.getId() + ":" + shape.getString("id") + ":" + shape.getString("text");
|
||||
}
|
||||
}
|
||||
if (result == null) {
|
||||
isOk = false;
|
||||
msg = "[" + shapeName + "]不存在";
|
||||
break;
|
||||
}
|
||||
isOk = true;
|
||||
fileShapeIds.add(tmpList.get(0));
|
||||
fileShapeIds.add(result);
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
JSONArray shapes = new JSONArray();
|
||||
for (String fileShape : fileShapeIds) {
|
||||
String [] fileArr = fileShape.split(":");
|
||||
@ -296,6 +221,8 @@ public class ValidShapeRelation implements ValidShapeCell {
|
||||
shapes.add(object);
|
||||
}
|
||||
attr.put("relations", shapes);
|
||||
} else {
|
||||
msg = "不支持形状和模型同时选择的类型";
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("name", title);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user