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