@ -22,7 +22,6 @@ import java.util.*;
import java.util.stream.Collectors ;
import static cn.axzo.workflow.core.common.BpmConstants.END_EVENT_ID ;
import static cn.axzo.workflow.core.common.BpmConstants.EXPRESSION_CLASS ;
import static cn.axzo.workflow.core.common.enums.BpmErrorCode.BPM_META_DATA_FORMAT_ERROR ;
import static org.flowable.bpmn.model.ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION ;
@ -31,10 +30,10 @@ public class BpmTransformUtil {
public static byte [ ] transformBpmnJsonToXml ( BpmJsonNode bpmnJson , Model model ) {
/ / JSONObject bpmnJson = ( JSONObject ) updateReqVO . getBpmnJson ( ) ;
/ / JSONObject bpmnJson = ( JSONObject ) updateReqVO . getBpmnJson ( ) ;
BpmnModel bpmnModel = new BpmnModel ( ) ;
Process process = new Process ( ) ;
BpmnModel bpmnModel = new BpmnModel ( ) ;
Process process = new Process ( ) ;
bpmnModel . addProcess ( process ) ;
process . setId ( model . getKey ( ) ) ;
@ -48,25 +47,26 @@ public class BpmTransformUtil {
}
List < SequenceFlow > sequenceFlows = Lists . newArrayList ( ) ;
Map < String , BpmJsonNode > childNodeMap = new HashMap < > ( ) ;
/ / JSONObject jsonObject = ( JSONObject ) JSONObject . toJSON ( bpmnJson ) ;
/ / ExtensionAttribute extensionAttribute = new ExtensionAttribute ( ) ;
/ / extensionAttribute . setName ( " TestName " ) ;
/ / extensionAttribute . setNamespace ( " http://flowable.org/bpmn " ) ;
/ / extensionAttribute . setValue ( bpmnJson . toJSONString ( ) ) ;
/ / / / process . addAttribute ( extensionAttribute ) ;
/ / JSONObject processNodes = bpmnJson . getJSONObject ( " nodeConfig " ) ;
Map < String , BpmJsonNode > childNodeMap = new HashMap < > ( ) ;
/ / JSONObject jsonObject = ( JSONObject ) JSONObject . toJSON ( bpmnJson ) ;
/ / ExtensionAttribute extensionAttribute = new ExtensionAttribute ( ) ;
/ / extensionAttribute . setName ( " TestName " ) ;
/ / extensionAttribute . setNamespace ( " http://flowable.org/bpmn " ) ;
/ / extensionAttribute . setValue ( bpmnJson . toJSONString ( ) ) ;
/ / / / process . addAttribute ( extensionAttribute ) ;
/ / JSONObject processNodes = bpmnJson . getJSONObject ( " nodeConfig " ) ;
String lastNode = null ;
try {
lastNode = create ( startEvent . getId ( ) , bpmnJson . getChildren ( ) , process , bpmnModel , sequenceFlows , childNodeMap ) ;
lastNode = create ( startEvent . getId ( ) , bpmnJson . getChildren ( ) , process , bpmnModel , sequenceFlows ,
childNodeMap ) ;
} catch ( Exception e ) {
e . printStackTrace ( ) ;
throw new WorkflowEngineException ( BPM_META_DATA_FORMAT_ERROR ) ;
}
EndEvent endEvent = createEndEvent ( ) ;
process . addFlowElement ( endEvent ) ;
process . addFlowElement ( connect ( lastNode , endEvent . getId ( ) , sequenceFlows , childNodeMap , process ) ) ;
process . addFlowElement ( connect ( lastNode , endEvent . getId ( ) , sequenceFlows , childNodeMap , process ) ) ;
new BpmnAutoLayout ( bpmnModel ) . execute ( ) ;
@ -86,25 +86,26 @@ public class BpmTransformUtil {
return serviceTask ;
}
public static SequenceFlow connect ( String from , String to , List < SequenceFlow > sequenceFlows , Map < String , BpmJsonNode > childNodeMap , Process process ) {
public static SequenceFlow connect ( String from , String to , List < SequenceFlow > sequenceFlows , Map < String ,
BpmJsonNode > childNodeMap , Process process ) {
SequenceFlow flow = new SequenceFlow ( ) ;
String sequenceFlowId = id ( " sequenceFlow " ) ;
if ( process . getFlowElement ( from ) ! = null & & process . getFlowElement ( from ) instanceof ExclusiveGateway ) {
String sequenceFlowId = id ( " sequenceFlow " ) ;
if ( process . getFlowElement ( from ) ! = null & & process . getFlowElement ( from ) instanceof ExclusiveGateway ) {
BpmJsonNode childNode = childNodeMap . get ( to ) ;
if ( childNode ! = null ) {
if ( childNode ! = null ) {
String parentId = childNode . getParentId ( ) ;
if ( StringUtils . isNotBlank ( parentId ) ) {
if ( StringUtils . isNotBlank ( parentId ) ) {
BpmJsonNode parentNode = childNodeMap . get ( parentId ) ;
if ( parentNode ! = null ) {
if ( BpmFlowNodeType . NODE_CONDITION . getType ( ) . equals ( parentNode . getType ( ) ) ) {
sequenceFlowId = parentNode . getId ( ) ;
if ( parentNode ! = null ) {
if ( BpmFlowNodeType . NODE_CONDITION . getType ( ) . equals ( parentNode . getType ( ) ) ) {
sequenceFlowId = parentNode . getId ( ) ;
flow . setName ( parentNode . getName ( ) ) ;
if ( ! ObjectUtils . isEmpty ( parentNode . getProperty ( ) ) & & ! Boolean . TRUE . equals ( parentNode . getProperty ( ) . getDefaultCondition ( ) ) ) {
if ( ! ObjectUtils . isEmpty ( parentNode . getProperty ( ) ) & & ! Boolean . TRUE . equals ( parentNode . getProperty ( ) . getDefaultCondition ( ) ) ) {
/ / 解析条件表达式
StringBuffer conditionExpression = new StringBuffer ( ) ;
conditionExpression . append ( " ${ ( " ) ;
conditionExpression . append ( EXPRESSION_CLASS + " numberEquals( " + parentNode . getProperty ( ) . getConditionBranchKey ( ) + " ," + parentNode . getProperty ( ) . getConditionBranchValue ( ) + " ) " ) ;
conditionExpression . append ( " ) }" ) ;
StringBuffer conditionExpression = new StringBuffer ( ) ;
conditionExpression . append ( " ${ " ) ;
conditionExpression . append ( " var:eq(' " + parentNode . getProperty ( ) . getConditionBranchKey ( ) + " ' , " + parentNode . getProperty ( ) . getConditionBranchValue ( ) + " ) " ) ;
conditionExpression . append ( " }" ) ;
flow . setConditionExpression ( conditionExpression . toString ( ) ) ;
}
@ -127,56 +128,58 @@ public class BpmTransformUtil {
}
public static String create ( String fromId , BpmJsonNode flowNode , Process process , BpmnModel bpmnModel , List < SequenceFlow > sequenceFlows , Map < String , BpmJsonNode > childNodeMap ) throws InvocationTargetException , IllegalAccessException {
public static String create ( String fromId , BpmJsonNode flowNode , Process process , BpmnModel bpmnModel ,
List < SequenceFlow > sequenceFlows , Map < String , BpmJsonNode > childNodeMap ) throws InvocationTargetException , IllegalAccessException {
String nodeType = flowNode . getType ( ) ;
if ( BpmFlowNodeType . NODE_ROUTER . isEqual ( nodeType ) ) {
return createExclusiveGatewayBuilder ( fromId , flowNode , process , bpmnModel , sequenceFlows , childNodeMap ) ;
return createExclusiveGatewayBuilder ( fromId , flowNode , process , bpmnModel , sequenceFlows , childNodeMap ) ;
} else if ( BpmFlowNodeType . NODE_TASK . isEqual ( nodeType ) ) {
childNodeMap . put ( flowNode . getId ( ) , flowNode ) ;
childNodeMap . put ( flowNode . getId ( ) , flowNode ) ;
Map incoming = flowNode . getIncoming ( ) ;
incoming . put ( " incoming " , Collections . singletonList ( fromId ) ) ;
String id = createTask ( process , flowNode , sequenceFlows , childNodeMap ) ;
String id = createTask ( process , flowNode , sequenceFlows , childNodeMap ) ;
/ / 如果当前任务还有后续任务 , 则遍历创建后续任务
BpmJsonNode children = flowNode . getChildren ( ) ;
if ( Objects . nonNull ( children ) & & StringUtils . isNotBlank ( children . getId ( ) ) ) {
return create ( id , children , process , bpmnModel , sequenceFlows , childNodeMap ) ;
if ( Objects . nonNull ( children ) & & StringUtils . isNotBlank ( children . getId ( ) ) ) {
return create ( id , children , process , bpmnModel , sequenceFlows , childNodeMap ) ;
} else {
return id ;
}
}
else if ( BpmFlowNodeType . NODE_STARTER . isEqual ( nodeType ) ) {
childNodeMap . put ( flowNode . getId ( ) , flowNode ) ;
} else if ( BpmFlowNodeType . NODE_STARTER . isEqual ( nodeType ) ) {
childNodeMap . put ( flowNode . getId ( ) , flowNode ) ;
Map incoming = flowNode . getIncoming ( ) ;
incoming . put ( " incoming " , Collections . singletonList ( fromId ) ) ;
String id = createTask ( process , flowNode , sequenceFlows , childNodeMap ) ;
String id = createTask ( process , flowNode , sequenceFlows , childNodeMap ) ;
/ / 如果当前任务还有后续任务 , 则遍历创建后续任务
BpmJsonNode children = flowNode . getChildren ( ) ;
if ( Objects . nonNull ( children ) & & StringUtils . isNotBlank ( children . getId ( ) ) ) {
return create ( id , children , process , bpmnModel , sequenceFlows , childNodeMap ) ;
if ( Objects . nonNull ( children ) & & StringUtils . isNotBlank ( children . getId ( ) ) ) {
return create ( id , children , process , bpmnModel , sequenceFlows , childNodeMap ) ;
} else {
return id ;
}
}
else {
} else {
throw new RuntimeException ( " 未知节点类型: nodeType= " + nodeType ) ;
}
}
public static ExclusiveGateway createExclusiveGateWayEnd ( String id ) {
ExclusiveGateway exclusiveGateway = new ExclusiveGateway ( ) ;
public static ExclusiveGateway createExclusiveGateWayEnd ( String id ) {
ExclusiveGateway exclusiveGateway = new ExclusiveGateway ( ) ;
exclusiveGateway . setId ( id ) ;
return exclusiveGateway ;
}
private static String createExclusiveGatewayBuilder ( String formId , BpmJsonNode flowNode , Process process , BpmnModel bpmnModel , List < SequenceFlow > sequenceFlows , Map < String , BpmJsonNode > childNodeMap ) throws InvocationTargetException , IllegalAccessException {
childNodeMap . put ( flowNode . getId ( ) , flowNode ) ;
String name = flowNode . getName ( ) ;
private static String createExclusiveGatewayBuilder ( String formId , BpmJsonNode flowNode , Process process ,
BpmnModel bpmnModel , List < SequenceFlow > sequenceFlows ,
Map < String , BpmJsonNode > childNodeMap ) throws InvocationTargetException , IllegalAccessException {
childNodeMap . put ( flowNode . getId ( ) , flowNode ) ;
String name = flowNode . getName ( ) ;
String exclusiveGatewayId = flowNode . getId ( ) ;
ExclusiveGateway exclusiveGateway = new ExclusiveGateway ( ) ;
exclusiveGateway . setId ( exclusiveGatewayId ) ;
exclusiveGateway . setName ( name ) ;
process . addFlowElement ( exclusiveGateway ) ;
process . addFlowElement ( connect ( formId , exclusiveGatewayId , sequenceFlows , childNodeMap , process ) ) ;
process . addFlowElement ( connect ( formId , exclusiveGatewayId , sequenceFlows , childNodeMap , process ) ) ;
if ( Objects . isNull ( flowNode . getBranches ( ) ) & & Objects . isNull ( flowNode . getChildren ( ) ) ) {
return exclusiveGatewayId ;
@ -187,25 +190,25 @@ public class BpmTransformUtil {
for ( BpmJsonNode element : flowNodes ) {
if ( ! ObjectUtils . isEmpty ( element . getProperty ( ) ) ) {
Boolean typeElse = element . getProperty ( ) . getDefaultCondition ( ) ;
if ( Boolean . TRUE . equals ( typeElse ) ) {
if ( Boolean . TRUE . equals ( typeElse ) ) {
exclusiveGateway . setDefaultFlow ( element . getId ( ) ) ;
}
}
childNodeMap . put ( element . getId ( ) , element ) ;
childNodeMap . put ( element . getId ( ) , element ) ;
BpmJsonNode childNode = element . getChildren ( ) ;
String nodeName = element . getName ( ) ;
if ( ! ObjectUtils . isEmpty ( element . getProperty ( ) ) & & ( Objects . isNull ( childNode ) | | StringUtils . isBlank ( childNode . getId ( ) ) ) ) {
if ( ! ObjectUtils . isEmpty ( element . getProperty ( ) ) & & ( Objects . isNull ( childNode ) | | StringUtils . isBlank ( childNode . getId ( ) ) ) ) {
incoming . add ( exclusiveGatewayId ) ;
Map condition = new HashMap ( ) ;
/ / 解析条件表达式
StringBuffer conditionExpression = new StringBuffer ( ) ;
conditionExpression . append ( " ${ ( " ) ;
conditionExpression . append ( EXPRESSION_CLASS + " numberEquals( " + element . getProperty ( ) . getConditionBranchKey ( ) + " ," + element . getProperty ( ) . getConditionBranchValue ( ) + " ) " ) ;
conditionExpression . append ( " ) }" ) ;
StringBuffer conditionExpression = new StringBuffer ( ) ;
conditionExpression . append ( " ${ " ) ;
conditionExpression . append ( " var:eq(' " + element . getProperty ( ) . getConditionBranchKey ( ) + " ' , " + element . getProperty ( ) . getConditionBranchValue ( ) + " ) " ) ;
conditionExpression . append ( " }" ) ;
condition . put ( " nodeName " , nodeName ) ;
condition . put ( " expression " , conditionExpression . toString ( ) ) ;
@ -215,8 +218,9 @@ public class BpmTransformUtil {
/ / 只生成一个任务 , 同时设置当前任务的条件
Map incomingObj = childNode . getIncoming ( ) ;
incomingObj . put ( " incoming " , Collections . singletonList ( exclusiveGatewayId ) ) ;
String identifier = create ( exclusiveGatewayId , childNode , process , bpmnModel , sequenceFlows , childNodeMap ) ;
List < SequenceFlow > flows = sequenceFlows . stream ( ) . filter ( flow - > StringUtils . equals ( exclusiveGatewayId , flow . getSourceRef ( ) ) )
String identifier = create ( exclusiveGatewayId , childNode , process , bpmnModel , sequenceFlows , childNodeMap ) ;
List < SequenceFlow > flows = sequenceFlows . stream ( ) . filter ( flow - > StringUtils . equals ( exclusiveGatewayId ,
flow . getSourceRef ( ) ) )
. collect ( Collectors . toList ( ) ) ;
flows . stream ( ) . forEach (
e - > {
@ -225,9 +229,10 @@ public class BpmTransformUtil {
}
/ / 设置条件表达式
/ / TODO 不知道什么意思
/ / if ( Objects . isNull ( e . getConditionExpression ( ) ) & & StringUtils . isNotBlank ( expression ) ) {
/ / e . setConditionExpression ( expression ) ;
/ / }
/ / if ( Objects . isNull ( e . getConditionExpression ( ) ) & & StringUtils
/ / . isNotBlank ( expression ) ) {
/ / e . setConditionExpression ( expression ) ;
/ / }
}
) ;
if ( Objects . nonNull ( identifier ) ) {
@ -238,87 +243,86 @@ public class BpmTransformUtil {
BpmJsonNode childNode = flowNode . getChildren ( ) ;
if ( Objects . nonNull ( childNode ) & & StringUtils . isNotBlank ( childNode . getId ( ) ) ) {
if ( Objects . nonNull ( childNode ) & & StringUtils . isNotBlank ( childNode . getId ( ) ) ) {
String parentId = childNode . getParentId ( ) ;
BpmJsonNode parentChildNode = childNodeMap . get ( parentId ) ;
if ( BpmFlowNodeType . NODE_ROUTER . getType ( ) . equals ( parentChildNode . getType ( ) ) ) {
String endExId = parentChildNode . getId ( ) + " end " ;
process . addFlowElement ( createExclusiveGateWayEnd ( endExId ) ) ;
if ( incoming = = null | | incoming . isEmpty ( ) ) {
return create ( exclusiveGatewayId , childNode , process , bpmnModel , sequenceFlows ,
childNodeMap ) ;
}
else {
Map incomingObj = childNode . getIncoming ( ) ;
/ / 所有 service task 连接 end exclusive gateway
incomingObj . put ( " incoming " , incoming ) ;
FlowElement flowElement = bpmnModel . getFlowElement ( incoming . get ( 0 ) ) ;
/ / 1 . 0 先进行边连接 , 暂存 nextNode
BpmJsonNode nextNode = childNode . getChildren ( ) ;
childNode . setChildren ( null ) ;
String identifier = endExId ;
for ( int i = 0 ; i < incoming . size ( ) ; i + + ) {
process . addFlowElement ( connect ( incoming . get ( i ) , identifier , sequenceFlows , childNodeMap , process ) ) ;
}
/ / 针对 gateway 空任务分支 添加条件表达式
if ( ! conditions . isEmpty ( ) ) {
FlowElement flowElement1 = bpmnModel . getFlowElement ( identifier ) ;
/ / 获取从 gateway 到目标节点 未设置条件表达式的节点
List < SequenceFlow > flows = sequenceFlows . stream ( ) . filter (
flow - > StringUtils . equals ( flowElement1 . getId ( ) , flow . getTargetRef ( ) ) )
. filter (
flow - > StringUtils . equals ( flow . getSourceRef ( ) , exclusiveGatewayId ) )
. collect ( Collectors . toList ( ) ) ;
flows . stream ( ) . forEach ( sequenceFlow - > {
if ( ! conditions . isEmpty ( ) ) {
Map condition = conditions . get ( 0 ) ;
String nodeName = ( String ) condition . get ( " nodeName " ) ;
String expression = ( String ) condition . get ( " expression " ) ;
if ( StringUtils . isBlank ( sequenceFlow . getName ( ) ) & & StringUtils
. isNotBlank ( nodeName ) ) {
sequenceFlow . setName ( nodeName ) ;
}
/ / 设置条件表达式
if ( Objects . isNull ( sequenceFlow . getConditionExpression ( ) )
& & StringUtils . isNotBlank ( expression ) ) {
sequenceFlow . setConditionExpression ( expression ) ;
}
conditions . remove ( 0 ) ;
}
} ) ;
}
/ / 1 . 1 边连接完成后 , 在进行 nextNode 创建
if ( Objects . nonNull ( nextNode ) & & StringUtils . isNotBlank ( nextNode . getId ( ) ) ) {
return create ( identifier , nextNode , process , bpmnModel , sequenceFlows ,
childNodeMap ) ;
} else {
return identifier ;
}
}
if ( BpmFlowNodeType . NODE_ROUTER . getType ( ) . equals ( parentChildNode . getType ( ) ) ) {
String endExId = parentChildNode . getId ( ) + " end " ;
process . addFlowElement ( createExclusiveGateWayEnd ( endExId ) ) ;
if ( incoming = = null | | incoming . isEmpty ( ) ) {
return create ( exclusiveGatewayId , childNode , process , bpmnModel , sequenceFlows ,
childNodeMap ) ;
} else {
Map incomingObj = childNode . getIncoming ( ) ;
/ / 所有 service task 连接 end exclusive gateway
incomingObj . put ( " incoming " , incoming ) ;
FlowElement flowElement = bpmnModel . getFlowElement ( incoming . get ( 0 ) ) ;
/ / 1 . 0 先进行边连接 , 暂存 nextNode
BpmJsonNode nextNode = childNode . getChildren ( ) ;
childNode . setChildren ( null ) ;
String identifier = endExId ;
for ( int i = 0 ; i < incoming . size ( ) ; i + + ) {
process . addFlowElement ( connect ( incoming . get ( i ) , identifier , sequenceFlows , childNodeMap ,
process ) ) ;
}
/ / 针对 gateway 空任务分支 添加条件表达式
if ( ! conditions . isEmpty ( ) ) {
FlowElement flowElement1 = bpmnModel . getFlowElement ( identifier ) ;
/ / 获取从 gateway 到目标节点 未设置条件表达式的节点
List < SequenceFlow > flows = sequenceFlows . stream ( ) . filter (
flow - > StringUtils . equals ( flowElement1 . getId ( ) , flow . getTargetRef ( ) ) )
. filter (
flow - > StringUtils . equals ( flow . getSourceRef ( ) , exclusiveGatewayId ) )
. collect ( Collectors . toList ( ) ) ;
flows . stream ( ) . forEach ( sequenceFlow - > {
if ( ! conditions . isEmpty ( ) ) {
Map condition = conditions . get ( 0 ) ;
String nodeName = ( String ) condition . get ( " nodeName " ) ;
String expression = ( String ) condition . get ( " expression " ) ;
if ( StringUtils . isBlank ( sequenceFlow . getName ( ) ) & & StringUtils
. isNotBlank ( nodeName ) ) {
sequenceFlow . setName ( nodeName ) ;
}
/ / 设置条件表达式
if ( Objects . isNull ( sequenceFlow . getConditionExpression ( ) )
& & StringUtils . isNotBlank ( expression ) ) {
sequenceFlow . setConditionExpression ( expression ) ;
}
conditions . remove ( 0 ) ;
}
} ) ;
}
/ / 1 . 1 边连接完成后 , 在进行 nextNode 创建
if ( Objects . nonNull ( nextNode ) & & StringUtils . isNotBlank ( nextNode . getId ( ) ) ) {
return create ( identifier , nextNode , process , bpmnModel , sequenceFlows ,
childNodeMap ) ;
} else {
return identifier ;
}
}
}
}
return exclusiveGatewayId ;
}
private static String createTask ( Process process , BpmJsonNode flowNode , List < SequenceFlow > sequenceFlows , Map < String , BpmJsonNode > childNodeMap ) {
private static String createTask ( Process process , BpmJsonNode flowNode , List < SequenceFlow > sequenceFlows ,
Map < String , BpmJsonNode > childNodeMap ) {
Map incomingJson = flowNode . getIncoming ( ) ;
List < String > incoming = ( List < String > ) incomingJson . get ( " incoming " ) ;
/ / 自动生成id
/ / String id = id ( " serviceTask " ) ;
String id = flowNode . getId ( ) ;
/ / String id = id ( " serviceTask " ) ;
String id = flowNode . getId ( ) ;
if ( incoming ! = null & & ! incoming . isEmpty ( ) ) {
UserTask userTask = new UserTask ( ) ;
userTask . setName ( flowNode . getName ( ) ) ;
userTask . setId ( id ) ;
process . addFlowElement ( userTask ) ;
process . addFlowElement ( connect ( incoming . get ( 0 ) , id , sequenceFlows , childNodeMap , process ) ) ;
process . addFlowElement ( connect ( incoming . get ( 0 ) , id , sequenceFlows , childNodeMap , process ) ) ;
FlowableListener createTaskListener = new FlowableListener ( ) ;
createTaskListener . setEvent ( TaskListener . EVENTNAME_ALL_EVENTS ) ;
@ -326,9 +330,8 @@ public class BpmTransformUtil {
/ / FIXME 如果监听器想设置多个 , 这里还需要额外处理
createTaskListener . setImplementation ( " ${engineTaskEventListener} " ) ;
userTask . setTaskListeners ( Arrays . asList ( createTaskListener ) ) ;
if ( " root " . equalsIgnoreCase ( id ) ) {
}
else {
if ( " root " . equalsIgnoreCase ( id ) ) {
} else {
ArrayList < FlowableListener > listeners = new ArrayList < > ( ) ;
FlowableListener activitiListener = new FlowableListener ( ) ;
activitiListener . setEvent ( ExecutionListener . EVENTNAME_START ) ;
@ -342,9 +345,10 @@ public class BpmTransformUtil {
BpmJsonNodeProperty property = flowNode . getProperty ( ) ;
BpmFlowMultiMode mode = property . getMultiMode ( ) ;
MultiInstanceLoopCharacteristics multiInstanceLoopCharacteristics = new MultiInstanceLoopCharacteristics ( ) ;
MultiInstanceLoopCharacteristics multiInstanceLoopCharacteristics =
new MultiInstanceLoopCharacteristics ( ) ;
/ / 审批人集合参数
multiInstanceLoopCharacteristics . setInputDataItem ( userTask . getId ( ) + " assigneeList " ) ;
multiInstanceLoopCharacteristics . setInputDataItem ( userTask . getId ( ) + " assigneeList " ) ;
/ / 迭代集合
multiInstanceLoopCharacteristics . setElementVariable ( " assigneeName " ) ;
/ / 并行
@ -352,10 +356,12 @@ public class BpmTransformUtil {
userTask . setAssignee ( " ${assigneeName} " ) ;
/ / 设置多实例属性
userTask . setLoopCharacteristics ( multiInstanceLoopCharacteristics ) ;
if ( BpmFlowMultiMode . OR . getType ( ) . equals ( mode . getType ( ) ) ) {
multiInstanceLoopCharacteristics . setCompletionCondition ( " ${nrOfCompletedInstances/nrOfInstances > 0} " ) ;
} else if ( BpmFlowMultiMode . AND . getType ( ) . equals ( mode . getType ( ) ) ) {
multiInstanceLoopCharacteristics . setCompletionCondition ( " ${nrOfInstances == nrOfCompletedInstances} " ) ;
if ( BpmFlowMultiMode . OR . getType ( ) . equals ( mode . getType ( ) ) ) {
multiInstanceLoopCharacteristics . setCompletionCondition ( " ${nrOfCompletedInstances " +
" /nrOfInstances > 0} " ) ;
} else if ( BpmFlowMultiMode . AND . getType ( ) . equals ( mode . getType ( ) ) ) {
multiInstanceLoopCharacteristics . setCompletionCondition ( " ${nrOfInstances == " +
" nrOfCompletedInstances} " ) ;
}
}
}