Commit a5780b11 authored by gavin2lee's avatar gavin2lee
Browse files

#2109 merge from 2169

parents a25c66f2 b2bb81b6
Showing with 939 additions and 325 deletions
+939 -325
......@@ -11,7 +11,7 @@
<artifactId>platform-core</artifactId>
<properties>
<app.version>2.9.1</app.version>
<app.version>2.9.2</app.version>
</properties>
<dependencyManagement>
......
......@@ -11,11 +11,14 @@ public class GraphNodeDto {
private String entityName;
private String dataId;
private String displayName;
// #2169
private String fullDataId;
//for taskman
private Object entityData;
private String id;
private List<String> previousIds = new ArrayList<>();
private List<String> succeedingIds = new ArrayList<>();
......@@ -119,5 +122,13 @@ public class GraphNodeDto {
public void setEntityData(Object entityData) {
this.entityData = entityData;
}
public String getFullDataId() {
return fullDataId;
}
public void setFullDataId(String fullDataId) {
this.fullDataId = fullDataId;
}
}
package com.webank.wecube.platform.core.dto.workflow;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class RequestObjectDto {
private Map<String, String> inputs = new HashMap<>();
private Map<String, String> outputs = new HashMap<>();
private String callbackParameter;
private List<Map<String, String>> inputs = new ArrayList<>();
private List<Map<String, String>> outputs = new ArrayList<>();
public Map<String, String> getInputs() {
public String getCallbackParameter() {
return callbackParameter;
}
public void setCallbackParameter(String callbackParameter) {
this.callbackParameter = callbackParameter;
}
public List<Map<String, String>> getInputs() {
return inputs;
}
public void setInputs(Map<String, String> inputs) {
public void setInputs(List<Map<String, String>> inputs) {
this.inputs = inputs;
}
public Map<String, String> getOutputs() {
public List<Map<String, String>> getOutputs() {
return outputs;
}
public void setOutputs(Map<String, String> outputs) {
public void setOutputs(List<Map<String, String>> outputs) {
this.outputs = outputs;
}
public void addInput(String paramName, String paramValAsStr){
this.inputs.put(paramName, paramValAsStr);
public void addInput(Map<String, String> dtoMap) {
this.inputs.add(dtoMap);
}
public void addOutput(String paramName, String paramValAsStr){
this.outputs.put(paramName, paramValAsStr);
public void addOutput(Map<String, String> dtoMap) {
this.outputs.add(dtoMap);
}
public static class RequestParamObjectDto {
private String objectId;
private String callbackParameter;
private Map<String, String> paramAttrs = new HashMap<>();
public String getObjectId() {
return objectId;
}
public void setObjectId(String objectId) {
this.objectId = objectId;
}
public String getCallbackParameter() {
return callbackParameter;
}
public void setCallbackParameter(String callbackParameter) {
this.callbackParameter = callbackParameter;
}
public Map<String, String> getParamAttrs() {
return paramAttrs;
}
public void setParamAttrs(Map<String, String> paramAttrs) {
this.paramAttrs = paramAttrs;
}
public void addParamAttr(String paramName, String paramValAsStr) {
this.paramAttrs.put(paramName, paramValAsStr);
}
}
// public static class RequestParamAttrDto {
// private String paramName;
// private String paramValue;
//
// public RequestParamAttrDto() {
//
// }
//
// public RequestParamAttrDto(String paramName, String paramValue) {
// this.paramName = paramName;
// this.paramValue = paramValue;
// }
//
// public String getParamName() {
// return paramName;
// }
//
// public void setParamName(String paramName) {
// this.paramName = paramName;
// }
//
// public String getParamValue() {
// return paramValue;
// }
//
// public void setParamValue(String paramValue) {
// this.paramValue = paramValue;
// }
//
// }
}
......@@ -9,6 +9,7 @@ public class TaskNodeDefObjectBindInfoDto {
private String orderedNo;
private String entityTypeId;
private String entityDataId;
private String fullEntityDataId;
private String entityDisplayName;
private String bound;// "Y"-bound,default;"N"-unbound;
......@@ -58,6 +59,16 @@ public class TaskNodeDefObjectBindInfoDto {
}
public void setEntityDisplayName(String entityDisplayName) {
this.entityDisplayName = entityDisplayName;
}
this.entityDisplayName = entityDisplayName;
}
public String getFullEntityDataId() {
return fullEntityDataId;
}
public void setFullEntityDataId(String fullEntityDataId) {
this.fullEntityDataId = fullEntityDataId;
}
}
......@@ -35,6 +35,8 @@ public class GraphNodeEntity {
private String prevIds;
private String succIds;
private String fullDataId;
public static String convertIdsListToString(List<String> ids) {
if (ids == null) {
......@@ -179,4 +181,12 @@ public class GraphNodeEntity {
this.succIds = succIds;
}
public String getFullDataId() {
return fullDataId;
}
public void setFullDataId(String fullDataId) {
this.fullDataId = fullDataId;
}
}
......@@ -39,6 +39,10 @@ public class ProcExecBindingEntity {
private String entityDataName;
private String bindFlag;
//#2169
private String fullEntityDataId;
public Integer getId() {
return id;
......@@ -160,4 +164,11 @@ public class ProcExecBindingEntity {
this.bindFlag = bindFlag;
}
public String getFullEntityDataId() {
return fullEntityDataId;
}
public void setFullEntityDataId(String fullEntityDataId) {
this.fullEntityDataId = fullEntityDataId;
}
}
......@@ -37,6 +37,9 @@ public class ProcExecBindingTmpEntity {
private String procSessionId;
private String entityDataName;
//#2169
private String fullEntityDataId;
public Integer getId() {
return id;
......@@ -150,4 +153,11 @@ public class ProcExecBindingTmpEntity {
this.entityDataName = entityDataName;
}
public String getFullEntityDataId() {
return fullEntityDataId;
}
public void setFullEntityDataId(String fullEntityDataId) {
this.fullEntityDataId = fullEntityDataId;
}
}
......@@ -41,6 +41,8 @@ public class TaskNodeExecParamEntity{
private String entityTypeId;
private Boolean isSensitive;
private String fullEntityDataId;
public Integer getId() {
return id;
......@@ -162,4 +164,11 @@ public class TaskNodeExecParamEntity{
this.isSensitive = isSensitive;
}
public String getFullEntityDataId() {
return fullEntityDataId;
}
public void setFullEntityDataId(String fullEntityDataId) {
this.fullEntityDataId = fullEntityDataId;
}
}
package com.webank.wecube.platform.core.model.workflow;
import java.util.List;
import com.webank.wecube.platform.core.entity.plugin.PluginConfigInterfaceParameters;
import com.webank.wecube.platform.core.entity.plugin.PluginConfigInterfaces;
import com.webank.wecube.platform.core.service.dme.EntityQueryExprNodeInfo;
public class DmeOutputParamAttr {
private PluginConfigInterfaces interf;
private PluginConfigInterfaceParameters interfParam;
private String paramName;
private String paramExpr;
private Object retVal;
private boolean processed;
private List<EntityQueryExprNodeInfo> exprNodeInfos;
public PluginConfigInterfaces getInterf() {
return interf;
}
public void setInterf(PluginConfigInterfaces interf) {
this.interf = interf;
}
public PluginConfigInterfaceParameters getInterfParam() {
return interfParam;
}
public void setInterfParam(PluginConfigInterfaceParameters interfParam) {
this.interfParam = interfParam;
}
public String getParamName() {
return paramName;
}
public void setParamName(String paramName) {
this.paramName = paramName;
}
public String getParamExpr() {
return paramExpr;
}
public void setParamExpr(String paramExpr) {
this.paramExpr = paramExpr;
}
public Object getRetVal() {
return retVal;
}
public void setRetVal(Object retVal) {
this.retVal = retVal;
}
public boolean isProcessed() {
return processed;
}
public void setProcessed(boolean processed) {
this.processed = processed;
}
public List<EntityQueryExprNodeInfo> getExprNodeInfos() {
return exprNodeInfos;
}
public void setExprNodeInfos(List<EntityQueryExprNodeInfo> exprNodeInfos) {
this.exprNodeInfos = exprNodeInfos;
}
public boolean isRootEntityAttr(){
if(exprNodeInfos != null && exprNodeInfos.size() == 1){
return true;
}
return false;
}
}
......@@ -8,13 +8,15 @@ import org.apache.commons.lang3.StringUtils;
public class InputParamObject {
private String entityTypeId;
private String entityDataId;
private String fullEntityDataId;
private List<String> attrNames = new ArrayList<>();
private List<InputParamAttr> attrs = new ArrayList<>();
public String getEntityTypeId() {
return entityTypeId;
}
......@@ -64,4 +66,12 @@ public class InputParamObject {
}
}
public String getFullEntityDataId() {
return fullEntityDataId;
}
public void setFullEntityDataId(String fullEntityDataId) {
this.fullEntityDataId = fullEntityDataId;
}
}
......@@ -161,6 +161,11 @@ public class PluginPackageDataModelService {
return resultDto;
}
/**
*
* @param packageName
* @return
*/
public PluginPackageDataModel tryFetchLatestAvailableDataModelEntity(String packageName) {
PluginPackageDataModel latestDataModelEntity = pluginPackageDataModelMapper
.selectLatestDataModelByPackageName(packageName);
......@@ -178,28 +183,7 @@ public class PluginPackageDataModelService {
}
}
private PluginPackageDataModel tryCalculateDynamicLatestAvailableDataModelEntity(
PluginPackageDataModel dataModelEntity) {
List<PluginPackageDataModel> dataModelEntities = pluginPackageDataModelMapper
.selectDataModelsByPackageName(dataModelEntity.getPackageName());
PluginPackageDataModel targetDataMode = null;
for (PluginPackageDataModel dataModel : dataModelEntities) {
List<PluginPackageEntities> pluginPackageEntities = pluginPackageEntitiesMapper
.selectAllByDataModel(dataModel.getId());
if (pluginPackageEntities != null && !pluginPackageEntities.isEmpty()) {
targetDataMode = dataModel;
break;
}
}
if (targetDataMode == null) {
targetDataMode = dataModelEntity;
}
return targetDataMode;
}
/**
*
......@@ -536,7 +520,6 @@ public class PluginPackageDataModelService {
}
}
// TODO
calOverviewDynamicEntityDtoRelationShips(dataModelEntityDtos, pluginPackageEntities, totalIdAndEntityDtoMap,
totalIdAndEntityMap);
......@@ -996,5 +979,28 @@ public class PluginPackageDataModelService {
return dynamicPluginPackageEntities;
}
private PluginPackageDataModel tryCalculateDynamicLatestAvailableDataModelEntity(
PluginPackageDataModel dataModelEntity) {
List<PluginPackageDataModel> dataModelEntities = pluginPackageDataModelMapper
.selectDataModelsByPackageName(dataModelEntity.getPackageName());
PluginPackageDataModel targetDataMode = null;
for (PluginPackageDataModel dataModel : dataModelEntities) {
List<PluginPackageEntities> pluginPackageEntities = pluginPackageEntitiesMapper
.selectAllByDataModel(dataModel.getId());
if (pluginPackageEntities != null && !pluginPackageEntities.isEmpty()) {
targetDataMode = dataModel;
break;
}
}
if (targetDataMode == null) {
targetDataMode = dataModelEntity;
}
return targetDataMode;
}
}
......@@ -31,6 +31,7 @@ import com.webank.wecube.platform.core.repository.workflow.TaskNodeExecParamMapp
import com.webank.wecube.platform.core.repository.workflow.TaskNodeExecRequestMapper;
import com.webank.wecube.platform.core.repository.workflow.TaskNodeInstInfoMapper;
import com.webank.wecube.platform.core.repository.workflow.TaskNodeParamMapper;
import com.webank.wecube.platform.core.service.dme.EntityQueryExpressionParser;
import com.webank.wecube.platform.core.service.dme.StandardEntityOperationService;
import com.webank.wecube.platform.core.service.plugin.PluginConfigMgmtService;
import com.webank.wecube.platform.core.service.plugin.PluginInstanceMgmtService;
......@@ -119,6 +120,8 @@ public abstract class AbstractPluginInvocationService extends AbstractWorkflowSe
@Autowired
protected ExtraTaskMapper extraTaskMapper;
@Autowired
protected EntityQueryExpressionParser entityQueryExpressionParser;
protected ObjectMapper objectMapper = new ObjectMapper();
......
......@@ -39,6 +39,7 @@ public abstract class AbstractWorkflowService {
public static final String TASK_CATEGORY_SSTN = "SSTN";
public static final String TASK_CATEGORY_SUTN = "SUTN";
public static final String TASK_CATEGORY_SDTN = "SDTN";
public static final String CALLBACK_PARAMETER_SYSTEM_PREFIX = "SYS-ENTITY";
protected static List<String> statelessNodeTypes = Arrays.asList(NODE_START_EVENT, NODE_END_EVENT, NODE_EXCLUSIVE_GATEWAY,
NODE_PARALLEL_GATEWAY);
......
......@@ -262,6 +262,7 @@ public class AsyncPluginInvocationService extends AbstractPluginInvocationServic
return;
}
//TODO #2169 to support entity creation
String nodeEntityId = (String) outputParameterMap.get(CALLBACK_PARAMETER_KEY);
if (StringUtils.isBlank(nodeEntityId)) {
......@@ -274,9 +275,12 @@ public class AsyncPluginInvocationService extends AbstractPluginInvocationServic
&& PLUGIN_RESULT_CODE_PARTIALLY_FAIL.equalsIgnoreCase(errorCodeOfSingleRecord)) {
log.info("such request is partially failed for request:{} and {}:{}", ctx.getRequestId(),
CALLBACK_PARAMETER_KEY, nodeEntityId);
//TODO to store status
return;
}
//TODO #2169 to support entity creation
for (PluginConfigInterfaceParameters pciParam : outputParameters) {
String paramName = pciParam.getName();
String paramExpr = pciParam.getMappingEntityExpression();
......@@ -319,6 +323,7 @@ public class AsyncPluginInvocationService extends AbstractPluginInvocationServic
String entityTypeId = null;
String entityDataId = null;
String fullEntityDataId = null;
String requestId = ctx.getTaskNodeExecRequestEntity().getReqId();
......@@ -337,6 +342,7 @@ public class AsyncPluginInvocationService extends AbstractPluginInvocationServic
objectId = callbackParameterInputEntity.getObjId();
entityTypeId = callbackParameterInputEntity.getEntityTypeId();
entityDataId = callbackParameterInputEntity.getEntityDataId();
fullEntityDataId = callbackParameterInputEntity.getFullEntityDataId();
}
List<PluginConfigInterfaceParameters> outputParameters = ctx.getPluginConfigInterface().getOutputParameters();
......@@ -363,6 +369,7 @@ public class AsyncPluginInvocationService extends AbstractPluginInvocationServic
TaskNodeExecParamEntity paramEntity = new TaskNodeExecParamEntity();
paramEntity.setEntityTypeId(entityTypeId);
paramEntity.setEntityDataId(entityDataId);
paramEntity.setFullEntityDataId(fullEntityDataId);
paramEntity.setObjId(objectId);
paramEntity.setParamType(TaskNodeExecParamEntity.PARAM_TYPE_RESPONSE);
paramEntity.setParamName(entry.getKey());
......
......@@ -28,6 +28,7 @@ import com.webank.wecube.platform.core.dto.workflow.InterfaceParameterDto;
import com.webank.wecube.platform.core.dto.workflow.ProcDefOutlineDto;
import com.webank.wecube.platform.core.dto.workflow.ProcessDataPreviewDto;
import com.webank.wecube.platform.core.dto.workflow.RequestObjectDto;
import com.webank.wecube.platform.core.dto.workflow.RequestObjectDto.RequestParamObjectDto;
import com.webank.wecube.platform.core.dto.workflow.TaskNodeDefObjectBindInfoDto;
import com.webank.wecube.platform.core.dto.workflow.TaskNodeExecContextDto;
import com.webank.wecube.platform.core.dto.workflow.TaskNodeInstObjectBindInfoDto;
......@@ -65,9 +66,13 @@ import com.webank.wecube.platform.core.service.plugin.PluginConfigMgmtService;
*
*/
@Service
public class WorkflowDataService {
public class WorkflowDataService extends AbstractWorkflowService{
private static final Logger log = LoggerFactory.getLogger(WorkflowDataService.class);
public static final String MASKED_VALUE = "***MASK***";
public static final String CALLBACK_PARAMETER_KEY = "callbackParameter";
@Autowired
private WorkflowProcDefService workflowProcDefService;
......@@ -137,11 +142,11 @@ public class WorkflowDataService {
d.setNodeInstId(e.getTaskNodeInstId());
d.setProcInstId(e.getProcInstId());
d.setEntityDisplayName(e.getEntityDataName());
if(StringUtils.isNoneBlank(d.getEntityTypeId())){
String [] parts = d.getEntityTypeId().trim().split(":");
if(parts.length == 1){
if (StringUtils.isNoneBlank(d.getEntityTypeId())) {
String[] parts = d.getEntityTypeId().trim().split(":");
if (parts.length == 1) {
d.setEntityName(parts[0]);
}else if(parts.length == 2){
} else if (parts.length == 2) {
d.setPackageName(parts[0]);
d.setEntityName(parts[1]);
}
......@@ -192,25 +197,25 @@ public class WorkflowDataService {
List<ProcRoleBindingEntity> procRoleBinds = procRoleBindingMapper
.selectAllByProcIdAndPermission(procInstInfo.getProcDefId(), ProcRoleBindingEntity.USE);
if(procRoleBinds == null || procRoleBinds.isEmpty()){
if (procRoleBinds == null || procRoleBinds.isEmpty()) {
throw new WecubeCoreException("Lack of permission to update task node bindings.");
}
Set<String> currUserRoles = AuthenticationContextHolder.getCurrentUserRoles();
if(currUserRoles == null){
if (currUserRoles == null) {
currUserRoles = new HashSet<String>();
}
boolean lackOfPermission = true;
for(ProcRoleBindingEntity procRoleBind : procRoleBinds){
if(currUserRoles.contains(procRoleBind.getRoleName())){
for (ProcRoleBindingEntity procRoleBind : procRoleBinds) {
if (currUserRoles.contains(procRoleBind.getRoleName())) {
lackOfPermission = false;
break;
}
}
if(lackOfPermission){
if (lackOfPermission) {
throw new WecubeCoreException("Lack of permission to update task node bindings.");
}
......@@ -666,6 +671,9 @@ public class WorkflowDataService {
entity.setProcSessId(previewDto.getProcessSessionId());
entity.setCreatedBy(AuthenticationContextHolder.getCurrentUsername());
entity.setCreatedTime(new Date());
//#2169
entity.setFullDataId(gNode.getFullDataId());
graphNodeRepository.insert(entity);
}
......@@ -683,6 +691,7 @@ public class WorkflowDataService {
procInstBindingTmpEntity.setEntityDataName(dataName);
procInstBindingTmpEntity.setCreatedBy(AuthenticationContextHolder.getCurrentUsername());
procInstBindingTmpEntity.setCreatedTime(new Date());
procInstBindingTmpEntity.setFullEntityDataId(dataId);
procExecBindingTmpRepository.insert(procInstBindingTmpEntity);
}
......@@ -699,16 +708,17 @@ public class WorkflowDataService {
for (FlowNodeDefDto f : outline.getFlowNodes()) {
String nodeType = f.getNodeType();
if (!"subProcess".equals(nodeType)) {
if (!NODE_SUB_PROCESS.equals(nodeType)) {
continue;
}
if(TaskNodeDefInfoEntity.DYNAMIC_BIND_YES.equalsIgnoreCase(f.getDynamicBind())){
log.info("task node {}-{} is dynamic binding node and no need to pre-bind.", f.getNodeDefId(), f.getNodeName());
if (TaskNodeDefInfoEntity.DYNAMIC_BIND_YES.equalsIgnoreCase(f.getDynamicBind())) {
log.info("task node {}-{} is dynamic binding node and no need to pre-bind.", f.getNodeDefId(),
f.getNodeName());
continue;
}
processSingleFlowNodeDefDto(f, hierarchicalEntityNodes, dataId, processSessionId, needSaveTmp,
tryProcessSingleFlowNodeDef(f, hierarchicalEntityNodes, dataId, processSessionId, needSaveTmp,
externalCacheMap);
}
......@@ -716,7 +726,7 @@ public class WorkflowDataService {
result.setProcessSessionId(processSessionId);
if (needSaveTmp) {
GraphNodeDto rootEntity = tryCalRootGraphNode(hierarchicalEntityNodes, dataId);
GraphNodeDto rootEntity = tryCalculateRootGraphNode(hierarchicalEntityNodes, dataId);
String dataName = null;
if (rootEntity != null) {
dataName = rootEntity.getDisplayName();
......@@ -728,7 +738,7 @@ public class WorkflowDataService {
}
private GraphNodeDto tryCalRootGraphNode(List<GraphNodeDto> hierarchicalEntityNodes, String dataId) {
private GraphNodeDto tryCalculateRootGraphNode(List<GraphNodeDto> hierarchicalEntityNodes, String dataId) {
if (hierarchicalEntityNodes == null || hierarchicalEntityNodes.isEmpty()) {
return null;
}
......@@ -742,17 +752,17 @@ public class WorkflowDataService {
return null;
}
private void processSingleFlowNodeDefDto(FlowNodeDefDto f, List<GraphNodeDto> hierarchicalEntityNodes,
private void tryProcessSingleFlowNodeDef(FlowNodeDefDto flowNode, List<GraphNodeDto> hierarchicalEntityNodes,
String dataId, String processSessionId, boolean needSaveTmp, Map<Object, Object> cacheMap) {
String routineExpr = calculateDataModelExpression(f);
String routineExpr = calculateDataModelExpression(flowNode);
if (StringUtils.isBlank(routineExpr)) {
log.info("the routine expression is blank for {} {}", f.getNodeDefId(), f.getNodeName());
log.info("the routine expression is blank for {} {}", flowNode.getNodeDefId(), flowNode.getNodeName());
return;
}
log.info("About to fetch data for node {} {} with expression {} and data id {}", f.getNodeDefId(),
f.getNodeName(), routineExpr, dataId);
log.info("About to fetch data for node {} {} with expression {} and data id {}", flowNode.getNodeDefId(),
flowNode.getNodeName(), routineExpr, dataId);
EntityOperationRootCondition condition = new EntityOperationRootCondition(routineExpr, dataId);
List<StandardEntityDataNode> nodes = null;
try {
......@@ -761,13 +771,13 @@ public class WorkflowDataService {
nodes = overview.getHierarchicalEntityNodes();
if (needSaveTmp) {
saveLeafNodeEntityNodesTemporary(f, overview.getLeafNodeEntityNodes(), processSessionId);
saveLeafNodeEntityNodesTemporary(flowNode, overview.getLeafNodeEntityNodes(), processSessionId);
}
} catch (Exception e) {
String errMsg = String.format("Errors while fetching data for node %s %s with expr %s and data id %s",
f.getNodeDefId(), f.getNodeName(), routineExpr, dataId);
flowNode.getNodeDefId(), flowNode.getNodeName(), routineExpr, dataId);
log.error(errMsg, e);
throw new WecubeCoreException("3191", errMsg, f.getNodeDefId(), f.getNodeName(), routineExpr, dataId);
throw new WecubeCoreException("3191", errMsg, flowNode.getNodeDefId(), flowNode.getNodeName(), routineExpr, dataId);
}
if (nodes == null || nodes.isEmpty()) {
......@@ -789,7 +799,9 @@ public class WorkflowDataService {
currNode.setDataId(tn.getId());
currNode.setPackageName(tn.getPackageName());
currNode.setEntityName(tn.getEntityName());
currNode.setDisplayName(tn.getDisplayName() == null ? null : tn.getDisplayName().toString());
currNode.setDisplayName(tn.getDisplayName());
//#2169
currNode.setFullDataId(tn.getFullId());
addToResult(hierarchicalEntityNodes, currNode);
}
......@@ -835,11 +847,14 @@ public class WorkflowDataService {
taskNodeBinding.setProcDefId(f.getProcDefId());
taskNodeBinding.setEntityDataId(String.valueOf(tn.getId()));
taskNodeBinding.setEntityTypeId(String.format("%s:%s", tn.getPackageName(), tn.getEntityName()));
taskNodeBinding.setEntityDataName(String.valueOf(tn.getDisplayName()));
taskNodeBinding.setEntityDataName(tn.getDisplayName());
taskNodeBinding.setNodeDefId(f.getNodeDefId());
taskNodeBinding.setOrderedNo(f.getOrderedNo());
taskNodeBinding.setCreatedBy(AuthenticationContextHolder.getCurrentUsername());
taskNodeBinding.setCreatedTime(new Date());
//#2169 full data id
taskNodeBinding.setFullEntityDataId(tn.getFullId());
procExecBindingTmpRepository.insert(taskNodeBinding);
savedTreeNodes.add(tn);
......@@ -859,27 +874,27 @@ public class WorkflowDataService {
return false;
}
private String calculateDataModelExpression(FlowNodeDefDto f) {
if (StringUtils.isBlank(f.getRoutineExpression())) {
private String calculateDataModelExpression(FlowNodeDefDto flowNode) {
if (StringUtils.isBlank(flowNode.getRoutineExpression())) {
return null;
}
String expr = f.getRoutineExpression();
String expr = flowNode.getRoutineExpression();
if (StringUtils.isBlank(f.getServiceId())) {
if (StringUtils.isBlank(flowNode.getServiceId())) {
return expr;
}
PluginConfigInterfaces inter = pluginConfigMgmtService.getPluginConfigInterfaceByServiceName(f.getServiceId());
if (inter == null) {
PluginConfigInterfaces pluginConfigIntf = pluginConfigMgmtService.getPluginConfigInterfaceByServiceName(flowNode.getServiceId());
if (pluginConfigIntf == null) {
return expr;
}
if (StringUtils.isBlank(inter.getFilterRule())) {
if (StringUtils.isBlank(pluginConfigIntf.getFilterRule())) {
return expr;
}
return expr + inter.getFilterRule();
return expr + pluginConfigIntf.getFilterRule();
}
private void addToResult(List<GraphNodeDto> result, GraphNodeDto... nodes) {
......@@ -918,81 +933,105 @@ public class WorkflowDataService {
return false;
}
if (Boolean.TRUE.equals(respParamEntity.getIsSensitive())) {
return true;
return respParamEntity.getIsSensitive();
}
}
return false;
//#2169
private List<RequestObjectDto> calculateRequestObjectDtos(List<TaskNodeExecParamEntity> requestParamEntities,
List<TaskNodeExecParamEntity> responseParamEntities) {
List<RequestObjectDto> requestObjects = new ArrayList<>();
}
Map<String, RequestParamObjectDto> reqParamObjectsByObjectId = new HashMap<>();
Map<String, RequestParamObjectDto> respParamObjectsByObjectId = new HashMap<>();
private Map<String, Map<String, String>> calculateRespParamsByObjectId(
List<TaskNodeExecParamEntity> requestParamEntities, List<TaskNodeExecParamEntity> responseParamEntities) {
Map<String, Map<String, String>> respParamsByObjectId = new HashMap<String, Map<String, String>>();
if (responseParamEntities != null) {
for (TaskNodeExecParamEntity respParamEntity : responseParamEntities) {
Map<String, String> respParamsMap = respParamsByObjectId.get(respParamEntity.getObjId());
if (respParamsMap == null) {
respParamsMap = new HashMap<String, String>();
respParamsByObjectId.put(respParamEntity.getObjId(), respParamsMap);
if (requestParamEntities != null) {
for (TaskNodeExecParamEntity reqParam : requestParamEntities) {
RequestParamObjectDto paramObjectDto = reqParamObjectsByObjectId.get(reqParam.getObjId());
if (paramObjectDto == null) {
paramObjectDto = new RequestParamObjectDto();
paramObjectDto.setObjectId(reqParam.getObjId());
reqParamObjectsByObjectId.put(reqParam.getObjId(), paramObjectDto);
}
if (isSensitiveData(respParamEntity)) {
respParamsMap.put(respParamEntity.getParamName(), "***MASK***");
String attrValue = null;
if (isSensitiveData(reqParam)) {
attrValue = MASKED_VALUE;
} else {
respParamsMap.put(respParamEntity.getParamName(), respParamEntity.getParamDataValue());
attrValue = reqParam.getParamDataValue();
}
if (CALLBACK_PARAMETER_KEY.equalsIgnoreCase(reqParam.getParamName())) {
paramObjectDto.setCallbackParameter(reqParam.getParamDataValue());
} else {
// RequestParamAttrDto attrDto = new RequestParamAttrDto(reqParam.getParamName(), attrValue);
paramObjectDto.addParamAttr(reqParam.getParamName(), attrValue);
}
}
}
if(responseParamEntities != null){
for (TaskNodeExecParamEntity param : responseParamEntities) {
RequestParamObjectDto paramObjectDto = respParamObjectsByObjectId.get(param.getObjId());
if (paramObjectDto == null) {
paramObjectDto = new RequestParamObjectDto();
paramObjectDto.setObjectId(param.getObjId());
respParamObjectsByObjectId.put(param.getObjId(), paramObjectDto);
}
return respParamsByObjectId;
}
private Map<String, RequestObjectDto> calculateRequestObjects(List<TaskNodeExecParamEntity> requestParamEntities,
List<TaskNodeExecParamEntity> responseParamEntities) {
Map<String, RequestObjectDto> objs = new HashMap<>();
for (TaskNodeExecParamEntity rp : requestParamEntities) {
RequestObjectDto ro = objs.get(rp.getObjId());
if (ro == null) {
ro = new RequestObjectDto();
objs.put(rp.getObjId(), ro);
}
String attrValue = null;
if (isSensitiveData(param)) {
attrValue = MASKED_VALUE;
} else {
attrValue = param.getParamDataValue();
}
if (isSensitiveData(rp)) {
ro.addInput(rp.getParamName(), "***MASK***");
} else {
ro.addInput(rp.getParamName(), rp.getParamDataValue());
if (CALLBACK_PARAMETER_KEY.equalsIgnoreCase(param.getParamName())) {
paramObjectDto.setCallbackParameter(param.getParamDataValue());
} else {
// RequestParamAttrDto attrDto = new RequestParamAttrDto(param.getParamName(), attrValue);
paramObjectDto.addParamAttr(param.getParamName(), attrValue);
}
}
}
return objs;
}
private List<RequestObjectDto> calculateRequestObjectDtos(List<TaskNodeExecParamEntity> requestParamEntities,
List<TaskNodeExecParamEntity> responseParamEntities) {
List<RequestObjectDto> requestObjects = new ArrayList<>();
if (requestParamEntities == null) {
return requestObjects;
Map<String, RequestObjectDto> requestObjectsByCallbackParameter = new HashMap<String,RequestObjectDto>();
for(RequestParamObjectDto reqParamObjectDto : reqParamObjectsByObjectId.values()){
String callbackParameter = reqParamObjectDto.getCallbackParameter();
if(StringUtils.isBlank(callbackParameter)){
continue;
}
RequestObjectDto objectDto = requestObjectsByCallbackParameter.get(callbackParameter);
if(objectDto == null){
objectDto = new RequestObjectDto();
objectDto.setCallbackParameter(callbackParameter);
requestObjectsByCallbackParameter.put(callbackParameter, objectDto);
}
objectDto.addInput(reqParamObjectDto.getParamAttrs());
}
Map<String, Map<String, String>> respParamsByObjectId = calculateRespParamsByObjectId(requestParamEntities,
responseParamEntities);
Map<String, RequestObjectDto> objs = calculateRequestObjects(requestParamEntities, responseParamEntities);
for (String objectId : objs.keySet()) {
RequestObjectDto obj = objs.get(objectId);
Map<String, String> respParamsMap = respParamsByObjectId.get(objectId);
if (respParamsMap != null) {
respParamsMap.forEach((k, v) -> {
obj.addOutput(k, v);
});
for(RequestParamObjectDto respParamObjectDto : respParamObjectsByObjectId.values()){
String callbackParameter = respParamObjectDto.getCallbackParameter();
if(StringUtils.isBlank(callbackParameter)){
continue;
}
requestObjects.add(obj);
RequestObjectDto objectDto = requestObjectsByCallbackParameter.get(callbackParameter);
if(objectDto == null){
objectDto = new RequestObjectDto();
objectDto.setCallbackParameter(callbackParameter);
requestObjectsByCallbackParameter.put(callbackParameter, objectDto);
}
objectDto.addOutput(respParamObjectDto.getParamAttrs());
}
requestObjects.addAll(requestObjectsByCallbackParameter.values());
return requestObjects;
}
......
......@@ -722,6 +722,7 @@ public class WorkflowProcInstService extends AbstractWorkflowService {
nodeBindEntity.setTaskNodeInstId(taskNodeInstInfoEntity.getId());
nodeBindEntity.setEntityTypeId(bindInfoDto.getEntityTypeId());
nodeBindEntity.setEntityDataId(bindInfoDto.getEntityDataId());
nodeBindEntity.setFullEntityDataId(bindInfoDto.getFullEntityDataId());
nodeBindEntity.setEntityDataName(bindInfoDto.getEntityDisplayName());
nodeBindEntity.setCreatedBy(AuthenticationContextHolder.getCurrentUsername());
nodeBindEntity.setCreatedTime(new Date());
......@@ -927,6 +928,8 @@ public class WorkflowProcInstService extends AbstractWorkflowService {
dto.setEntityDisplayName(entity.getEntityDataName());
dto.setNodeDefId(entity.getNodeDefId());
dto.setOrderedNo(entity.getOrderedNo());
//#2169
dto.setFullEntityDataId(entity.getFullEntityDataId());
result.add(dto);
}
......
package com.webank.wecube.platform.core.support.plugin.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
public class PluginLoggingInfoRequestParameter {
@JsonProperty(value = "key_word")
private String keyWord;
// @JsonProperty(value="line_number")
// private Integer lineNumber;
public String getKeyWord() {
return keyWord;
}
public void setKeyWord(String keyWord) {
this.keyWord = keyWord;
}
}
package com.webank.wecube.platform.core.support.plugin.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
public class PluginLoggingInfoSearchDetailRequestParameter {
@JsonProperty(value = "file_name")
private String fileName;
@JsonProperty(value = "line_number")
private String lineNumber;
@JsonProperty(value = "relate_line_count")
private Integer relateLineNumber;
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getLineNumber() {
return lineNumber;
}
public void setLineNumber(String lineNumber) {
this.lineNumber = lineNumber;
}
public Integer getRelateLineNumber() {
return relateLineNumber;
}
public void setRelateLineNumber(Integer relateLineNumber) {
this.relateLineNumber = relateLineNumber;
}
}
package com.webank.wecube.platform.core.support.plugin.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
public class PluginReleasedPackageListDirsRequestParameter {
@JsonProperty(value = "endpoint")
private String endpoint;
@JsonProperty(value = "line_number")
private Integer lineNumber;
public String getEndpoint() {
return endpoint;
}
public void setEndpoint(String endpoint) {
this.endpoint = endpoint;
}
public Integer getLineNumber() {
return lineNumber;
}
public void setLineNumber(Integer lineNumber) {
this.lineNumber = lineNumber;
}
}
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