Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
开发团队
Flowable Engine
提交
83c78dc2
F
Flowable Engine
项目概览
开发团队
/
Flowable Engine
通知
9
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Flowable Engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
83c78dc2
编写于
9月 10, 2014
作者:
T
Tijs Rademakers
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
https://github.com/dromie/Activiti
上级
ae5320e2
dcf43d62
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
140 addition
and
10 deletion
+140
-10
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/MultiInstanceActivityBehavior.java
...ine/impl/bpmn/behavior/MultiInstanceActivityBehavior.java
+5
-1
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/ParallelMultiInstanceBehavior.java
...ine/impl/bpmn/behavior/ParallelMultiInstanceBehavior.java
+3
-3
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/SequentialMultiInstanceBehavior.java
...e/impl/bpmn/behavior/SequentialMultiInstanceBehavior.java
+6
-4
modules/activiti-engine/src/test/java/org/activiti/engine/test/bpmn/multiinstance/MultiInstanceTest.java
...iti/engine/test/bpmn/multiinstance/MultiInstanceTest.java
+52
-2
modules/activiti-engine/src/test/resources/org/activiti/engine/test/bpmn/multiinstance/MultiInstanceTest.testParallelEmptyCollection.bpmn20.xml
.../MultiInstanceTest.testParallelEmptyCollection.bpmn20.xml
+37
-0
modules/activiti-engine/src/test/resources/org/activiti/engine/test/bpmn/multiinstance/MultiInstanceTest.testSequentialEmptyCollection.bpmn20.xml
...ultiInstanceTest.testSequentialEmptyCollection.bpmn20.xml
+37
-0
未找到文件。
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/MultiInstanceActivityBehavior.java
浏览文件 @
83c78dc2
...
...
@@ -91,6 +91,10 @@ public abstract class MultiInstanceActivityBehavior extends FlowNodeActivityBeha
}
catch
(
BpmnError
error
)
{
ErrorPropagation
.
propagateError
(
error
,
execution
);
}
if
(
resolveNrOfInstances
(
execution
)
==
0
)
{
leave
(
execution
);
}
}
else
{
innerActivityBehavior
.
execute
(
execution
);
}
...
...
@@ -226,7 +230,7 @@ public abstract class MultiInstanceActivityBehavior extends FlowNodeActivityBeha
value
=
parent
.
getVariableLocal
(
variableName
);
parent
=
parent
.
getParent
();
}
return
(
Integer
)
value
;
return
(
Integer
)
(
value
!=
null
?
value
:
0
)
;
}
protected
Integer
getLocalLoopVariable
(
ActivityExecution
execution
,
String
variableName
)
{
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/ParallelMultiInstanceBehavior.java
浏览文件 @
83c78dc2
...
...
@@ -37,8 +37,8 @@ public class ParallelMultiInstanceBehavior extends MultiInstanceActivityBehavior
*/
protected
void
createInstances
(
ActivityExecution
execution
)
throws
Exception
{
int
nrOfInstances
=
resolveNrOfInstances
(
execution
);
if
(
nrOfInstances
<
=
0
)
{
throw
new
ActivitiIllegalArgumentException
(
"Invalid number of instances: must be
posi
tive integer value"
if
(
nrOfInstances
<
0
)
{
throw
new
ActivitiIllegalArgumentException
(
"Invalid number of instances: must be
non-nega
tive integer value"
+
", but was "
+
nrOfInstances
);
}
...
...
@@ -122,7 +122,7 @@ public class ParallelMultiInstanceBehavior extends MultiInstanceActivityBehavior
executionEntity
.
getParent
().
forceUpdate
();
List
<
ActivityExecution
>
joinedExecutions
=
executionEntity
.
findInactiveConcurrentExecutions
(
execution
.
getActivity
());
if
(
joinedExecutions
.
size
()
=
=
nrOfInstances
||
completionConditionSatisfied
(
execution
))
{
if
(
joinedExecutions
.
size
()
>
=
nrOfInstances
||
completionConditionSatisfied
(
execution
))
{
// Removing all active child executions (ie because completionCondition is true)
List
<
ExecutionEntity
>
executionsToRemove
=
new
ArrayList
<
ExecutionEntity
>();
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/SequentialMultiInstanceBehavior.java
浏览文件 @
83c78dc2
...
...
@@ -36,8 +36,8 @@ public class SequentialMultiInstanceBehavior extends MultiInstanceActivityBehavi
*/
protected
void
createInstances
(
ActivityExecution
execution
)
throws
Exception
{
int
nrOfInstances
=
resolveNrOfInstances
(
execution
);
if
(
nrOfInstances
<
=
0
)
{
throw
new
ActivitiIllegalArgumentException
(
"Invalid number of instances: must be
posi
tive integer value"
if
(
nrOfInstances
<
0
)
{
throw
new
ActivitiIllegalArgumentException
(
"Invalid number of instances: must be
a non-nega
tive integer value"
+
", but was "
+
nrOfInstances
);
}
...
...
@@ -47,7 +47,9 @@ public class SequentialMultiInstanceBehavior extends MultiInstanceActivityBehavi
setLoopVariable
(
execution
,
NUMBER_OF_ACTIVE_INSTANCES
,
1
);
logLoopDetails
(
execution
,
"initialized"
,
0
,
0
,
1
,
nrOfInstances
);
executeOriginalBehavior
(
execution
,
0
);
if
(
nrOfInstances
>
0
)
{
executeOriginalBehavior
(
execution
,
0
);
}
}
/**
...
...
@@ -69,7 +71,7 @@ public class SequentialMultiInstanceBehavior extends MultiInstanceActivityBehavi
setLoopVariable
(
execution
,
NUMBER_OF_COMPLETED_INSTANCES
,
nrOfCompletedInstances
);
logLoopDetails
(
execution
,
"instance completed"
,
loopCounter
,
nrOfCompletedInstances
,
nrOfActiveInstances
,
nrOfInstances
);
if
(
loopCounter
=
=
nrOfInstances
||
completionConditionSatisfied
(
execution
))
{
if
(
loopCounter
>
=
nrOfInstances
||
completionConditionSatisfied
(
execution
))
{
super
.
leave
(
execution
);
}
else
{
try
{
...
...
modules/activiti-engine/src/test/java/org/activiti/engine/test/bpmn/multiinstance/MultiInstanceTest.java
浏览文件 @
83c78dc2
...
...
@@ -16,6 +16,7 @@ package org.activiti.engine.test.bpmn.multiinstance;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -1105,6 +1106,55 @@ public class MultiInstanceTest extends PluggableActivitiTestCase {
assertEquals
(
0
,
processInstances
.
size
());
assertProcessEnded
(
processInstance
.
getId
());
}
@Deployment
(
resources
=
{
"org/activiti/engine/test/bpmn/multiinstance/MultiInstanceTest.testSequentialEmptyCollection.bpmn20.xml"
})
public
void
testSequentialEmptyCollection
()
{
Collection
<
String
>
collection
=
Collections
.
emptyList
();
Map
<
String
,
Object
>
variableMap
=
new
HashMap
<
String
,
Object
>();
variableMap
.
put
(
"collection"
,
collection
);
ProcessInstance
processInstance
=
runtimeService
.
startProcessInstanceByKey
(
"testSequentialEmptyCollection"
,
variableMap
);
assertNotNull
(
processInstance
);
Task
task
=
taskService
.
createTaskQuery
().
singleResult
();
assertNull
(
task
);
assertProcessEnded
(
processInstance
.
getId
());
}
@Deployment
(
resources
=
{
"org/activiti/engine/test/bpmn/multiinstance/MultiInstanceTest.testSequentialEmptyCollection.bpmn20.xml"
})
public
void
testSequentialEmptyCollectionWithNonEmptyCollection
()
{
Collection
<
String
>
collection
=
Collections
.
singleton
(
"Test"
);
Map
<
String
,
Object
>
variableMap
=
new
HashMap
<
String
,
Object
>();
variableMap
.
put
(
"collection"
,
collection
);
ProcessInstance
processInstance
=
runtimeService
.
startProcessInstanceByKey
(
"testSequentialEmptyCollection"
,
variableMap
);
assertNotNull
(
processInstance
);
Task
task
=
taskService
.
createTaskQuery
().
singleResult
();
assertNotNull
(
task
);
taskService
.
complete
(
task
.
getId
());
assertProcessEnded
(
processInstance
.
getId
());
}
@Deployment
(
resources
=
{
"org/activiti/engine/test/bpmn/multiinstance/MultiInstanceTest.testParallelEmptyCollection.bpmn20.xml"
})
public
void
testParalellEmptyCollection
()
throws
Exception
{
Collection
<
String
>
collection
=
Collections
.
emptyList
();
Map
<
String
,
Object
>
variableMap
=
new
HashMap
<
String
,
Object
>();
variableMap
.
put
(
"collection"
,
collection
);
ProcessInstance
processInstance
=
runtimeService
.
startProcessInstanceByKey
(
"testParalellEmptyCollection"
,
variableMap
);
assertNotNull
(
processInstance
);
Task
task
=
taskService
.
createTaskQuery
().
singleResult
();
assertNull
(
task
);
assertProcessEnded
(
processInstance
.
getId
());
}
@Deployment
(
resources
=
{
"org/activiti/engine/test/bpmn/multiinstance/MultiInstanceTest.testParallelEmptyCollection.bpmn20.xml"
})
public
void
testParalellEmptyCollectionWithNonEmptyCollection
()
{
Collection
<
String
>
collection
=
Collections
.
singleton
(
"Test"
);
Map
<
String
,
Object
>
variableMap
=
new
HashMap
<
String
,
Object
>();
variableMap
.
put
(
"collection"
,
collection
);
ProcessInstance
processInstance
=
runtimeService
.
startProcessInstanceByKey
(
"testParalellEmptyCollection"
,
variableMap
);
assertNotNull
(
processInstance
);
Task
task
=
taskService
.
createTaskQuery
().
singleResult
();
assertNotNull
(
task
);
taskService
.
complete
(
task
.
getId
());
assertProcessEnded
(
processInstance
.
getId
());
}
}
modules/activiti-engine/src/test/resources/org/activiti/engine/test/bpmn/multiinstance/MultiInstanceTest.testParallelEmptyCollection.bpmn20.xml
0 → 100644
浏览文件 @
83c78dc2
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns=
"http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
xmlns:activiti=
"http://activiti.org/bpmn"
xmlns:bpmndi=
"http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:omgdc=
"http://www.omg.org/spec/DD/20100524/DC"
xmlns:omgdi=
"http://www.omg.org/spec/DD/20100524/DI"
typeLanguage=
"http://www.w3.org/2001/XMLSchema"
expressionLanguage=
"http://www.w3.org/1999/XPath"
targetNamespace=
"http://www.activiti.org/test"
>
<process
id=
"testParalellEmptyCollection"
isExecutable=
"true"
>
<startEvent
id=
"start"
></startEvent>
<sequenceFlow
id=
"flow1"
sourceRef=
"start"
targetRef=
"usertask1"
></sequenceFlow>
<sequenceFlow
id=
"flow2"
sourceRef=
"usertask1"
targetRef=
"end"
></sequenceFlow>
<endEvent
id=
"end"
></endEvent>
<userTask
id=
"usertask1"
name=
"Multi"
>
<multiInstanceLoopCharacteristics
isSequential=
"true"
activiti:collection=
"collection"
></multiInstanceLoopCharacteristics>
</userTask>
</process>
<bpmndi:BPMNDiagram
id=
"BPMNDiagram_testParalellEmptyCollection"
>
<bpmndi:BPMNPlane
bpmnElement=
"testParalellEmptyCollection"
id=
"BPMNPlane_testParalellEmptyCollection"
>
<bpmndi:BPMNShape
bpmnElement=
"start"
id=
"BPMNShape_start"
>
<omgdc:Bounds
height=
"35.0"
width=
"35.0"
x=
"0.0"
y=
"15.0"
></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape
bpmnElement=
"end"
id=
"BPMNShape_end"
>
<omgdc:Bounds
height=
"35.0"
width=
"35.0"
x=
"230.0"
y=
"15.0"
></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape
bpmnElement=
"usertask1"
id=
"BPMNShape_usertask1"
>
<omgdc:Bounds
height=
"60.0"
width=
"100.0"
x=
"80.0"
y=
"0.0"
></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge
bpmnElement=
"flow1"
id=
"BPMNEdge_flow1"
>
<omgdi:waypoint
x=
"35.0"
y=
"32.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"42.0"
y=
"30.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"42.0"
y=
"30.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"80.0"
y=
"30.0"
></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge
bpmnElement=
"flow2"
id=
"BPMNEdge_flow2"
>
<omgdi:waypoint
x=
"180.0"
y=
"30.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"192.0"
y=
"30.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"192.0"
y=
"30.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"230.0"
y=
"32.0"
></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
\ No newline at end of file
modules/activiti-engine/src/test/resources/org/activiti/engine/test/bpmn/multiinstance/MultiInstanceTest.testSequentialEmptyCollection.bpmn20.xml
0 → 100644
浏览文件 @
83c78dc2
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns=
"http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
xmlns:activiti=
"http://activiti.org/bpmn"
xmlns:bpmndi=
"http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:omgdc=
"http://www.omg.org/spec/DD/20100524/DC"
xmlns:omgdi=
"http://www.omg.org/spec/DD/20100524/DI"
typeLanguage=
"http://www.w3.org/2001/XMLSchema"
expressionLanguage=
"http://www.w3.org/1999/XPath"
targetNamespace=
"http://www.activiti.org/test"
>
<process
id=
"testSequentialEmptyCollection"
isExecutable=
"true"
>
<startEvent
id=
"start"
></startEvent>
<sequenceFlow
id=
"flow1"
sourceRef=
"start"
targetRef=
"usertask1"
></sequenceFlow>
<sequenceFlow
id=
"flow2"
sourceRef=
"usertask1"
targetRef=
"end"
></sequenceFlow>
<endEvent
id=
"end"
></endEvent>
<userTask
id=
"usertask1"
name=
"Multi"
>
<multiInstanceLoopCharacteristics
isSequential=
"true"
activiti:collection=
"collection"
></multiInstanceLoopCharacteristics>
</userTask>
</process>
<bpmndi:BPMNDiagram
id=
"BPMNDiagram_testSequentialEmptyCollection"
>
<bpmndi:BPMNPlane
bpmnElement=
"testSequentialEmptyCollection"
id=
"BPMNPlane_testSequentialEmptyCollection"
>
<bpmndi:BPMNShape
bpmnElement=
"start"
id=
"BPMNShape_start"
>
<omgdc:Bounds
height=
"35.0"
width=
"35.0"
x=
"0.0"
y=
"15.0"
></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape
bpmnElement=
"end"
id=
"BPMNShape_end"
>
<omgdc:Bounds
height=
"35.0"
width=
"35.0"
x=
"230.0"
y=
"15.0"
></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape
bpmnElement=
"usertask1"
id=
"BPMNShape_usertask1"
>
<omgdc:Bounds
height=
"60.0"
width=
"100.0"
x=
"80.0"
y=
"0.0"
></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge
bpmnElement=
"flow1"
id=
"BPMNEdge_flow1"
>
<omgdi:waypoint
x=
"35.0"
y=
"32.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"42.0"
y=
"30.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"42.0"
y=
"30.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"80.0"
y=
"30.0"
></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge
bpmnElement=
"flow2"
id=
"BPMNEdge_flow2"
>
<omgdi:waypoint
x=
"180.0"
y=
"30.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"192.0"
y=
"30.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"192.0"
y=
"30.0"
></omgdi:waypoint>
<omgdi:waypoint
x=
"230.0"
y=
"32.0"
></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录