Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
开发团队
Flowable Engine
提交
46876282
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,发现更多精彩内容 >>
提交
46876282
编写于
11月 26, 2014
作者:
T
Tijs Rademakers
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
https://github.com/roberthafner/Activiti
上级
62edf6fc
9a8fd41c
变更
34
显示空白变更内容
内联
并排
Showing
34 changed file
with
557 addition
and
73 deletion
+557
-73
modules/activiti-bpmn-converter/src/main/java/org/activiti/bpmn/constants/BpmnXMLConstants.java
...in/java/org/activiti/bpmn/constants/BpmnXMLConstants.java
+3
-0
modules/activiti-bpmn-converter/src/main/java/org/activiti/bpmn/converter/SequenceFlowXMLConverter.java
...org/activiti/bpmn/converter/SequenceFlowXMLConverter.java
+5
-0
modules/activiti-bpmn-converter/src/main/java/org/activiti/bpmn/converter/ServiceTaskXMLConverter.java
.../org/activiti/bpmn/converter/ServiceTaskXMLConverter.java
+7
-0
modules/activiti-bpmn-converter/src/main/java/org/activiti/bpmn/converter/UserTaskXMLConverter.java
...ava/org/activiti/bpmn/converter/UserTaskXMLConverter.java
+11
-1
modules/activiti-bpmn-converter/src/main/resources/org/activiti/impl/bpmn/parser/Semantic.xsd
...main/resources/org/activiti/impl/bpmn/parser/Semantic.xsd
+3
-0
modules/activiti-bpmn-model/src/main/java/org/activiti/bpmn/model/SequenceFlow.java
...l/src/main/java/org/activiti/bpmn/model/SequenceFlow.java
+7
-0
modules/activiti-bpmn-model/src/main/java/org/activiti/bpmn/model/ServiceTask.java
...el/src/main/java/org/activiti/bpmn/model/ServiceTask.java
+13
-4
modules/activiti-bpmn-model/src/main/java/org/activiti/bpmn/model/UserTask.java
...model/src/main/java/org/activiti/bpmn/model/UserTask.java
+11
-5
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/BpmnActivityBehavior.java
...iviti/engine/impl/bpmn/behavior/BpmnActivityBehavior.java
+13
-4
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/ServiceTaskDelegateExpressionActivityBehavior.java
...havior/ServiceTaskDelegateExpressionActivityBehavior.java
+24
-19
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/ServiceTaskExpressionActivityBehavior.java
.../bpmn/behavior/ServiceTaskExpressionActivityBehavior.java
+19
-11
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/UserTaskActivityBehavior.java
...i/engine/impl/bpmn/behavior/UserTaskActivityBehavior.java
+7
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/helper/ClassDelegate.java
...a/org/activiti/engine/impl/bpmn/helper/ClassDelegate.java
+19
-12
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/helper/SkipExpressionUtil.java
.../activiti/engine/impl/bpmn/helper/SkipExpressionUtil.java
+44
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/factory/DefaultActivityBehaviorFactory.java
...l/bpmn/parser/factory/DefaultActivityBehaviorFactory.java
+32
-6
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/factory/DefaultListenerFactory.java
...gine/impl/bpmn/parser/factory/DefaultListenerFactory.java
+2
-2
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/handler/SequenceFlowParseHandler.java
...ne/impl/bpmn/parser/handler/SequenceFlowParseHandler.java
+14
-1
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/handler/UserTaskParseHandler.java
...engine/impl/bpmn/parser/handler/UserTaskParseHandler.java
+4
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/pvm/ProcessDefinitionBuilder.java
...rg/activiti/engine/impl/pvm/ProcessDefinitionBuilder.java
+1
-1
modules/activiti-engine/src/main/java/org/activiti/engine/impl/pvm/PvmTransition.java
...main/java/org/activiti/engine/impl/pvm/PvmTransition.java
+4
-0
modules/activiti-engine/src/main/java/org/activiti/engine/impl/pvm/process/ActivityImpl.java
...va/org/activiti/engine/impl/pvm/process/ActivityImpl.java
+4
-3
modules/activiti-engine/src/main/java/org/activiti/engine/impl/pvm/process/TransitionImpl.java
.../org/activiti/engine/impl/pvm/process/TransitionImpl.java
+11
-1
modules/activiti-engine/src/main/java/org/activiti/engine/impl/task/TaskDefinition.java
...in/java/org/activiti/engine/impl/task/TaskDefinition.java
+10
-1
modules/activiti-engine/src/main/java/org/activiti/engine/test/TestActivityBehaviorFactory.java
...org/activiti/engine/test/TestActivityBehaviorFactory.java
+2
-2
modules/activiti-engine/src/test/java/org/activiti/engine/test/bpmn/sequenceflow/ConditionalSequenceFlowTest.java
...e/test/bpmn/sequenceflow/ConditionalSequenceFlowTest.java
+18
-0
modules/activiti-engine/src/test/java/org/activiti/examples/bpmn/servicetask/ExpressionServiceTaskTest.java
.../examples/bpmn/servicetask/ExpressionServiceTaskTest.java
+23
-0
modules/activiti-engine/src/test/java/org/activiti/examples/bpmn/servicetask/JavaServiceTaskTest.java
...tiviti/examples/bpmn/servicetask/JavaServiceTaskTest.java
+34
-0
modules/activiti-engine/src/test/java/org/activiti/examples/bpmn/servicetask/MethodExpressionServiceTaskTest.java
...les/bpmn/servicetask/MethodExpressionServiceTaskTest.java
+20
-0
modules/activiti-engine/src/test/java/org/activiti/examples/bpmn/usertask/SkipExpressionUserTaskTest.java
...ti/examples/bpmn/usertask/SkipExpressionUserTaskTest.java
+38
-0
modules/activiti-engine/src/test/resources/org/activiti/engine/test/bpmn/sequenceflow/ConditionalSequenceFlowTest.testSkipExpression.bpmn20.xml
...ConditionalSequenceFlowTest.testSkipExpression.bpmn20.xml
+30
-0
modules/activiti-engine/src/test/resources/org/activiti/examples/bpmn/servicetask/ExpressionServiceTaskTest.testSetServiceResultToProcessVariablesWithSkipExpression.bpmn20.xml
...viceResultToProcessVariablesWithSkipExpression.bpmn20.xml
+37
-0
modules/activiti-engine/src/test/resources/org/activiti/examples/bpmn/servicetask/JavaServiceTaskTest.testExpressionFieldInjectionWithSkipExpression.bpmn20.xml
...testExpressionFieldInjectionWithSkipExpression.bpmn20.xml
+37
-0
modules/activiti-engine/src/test/resources/org/activiti/examples/bpmn/servicetask/MethodExpressionServiceTaskTest.testSetServiceResultToProcessVariablesWithSkipExpression.bpmn20.xml
...viceResultToProcessVariablesWithSkipExpression.bpmn20.xml
+37
-0
modules/activiti-engine/src/test/resources/org/activiti/examples/bpmn/usertask/SkipExpressionUserTaskTest.test.bpmn20.xml
.../bpmn/usertask/SkipExpressionUserTaskTest.test.bpmn20.xml
+13
-0
未找到文件。
modules/activiti-bpmn-converter/src/main/java/org/activiti/bpmn/constants/BpmnXMLConstants.java
浏览文件 @
46876282
...
...
@@ -168,6 +168,7 @@ public interface BpmnXMLConstants {
public
static
final
String
ATTRIBUTE_TASK_SERVICE_DELEGATEEXPRESSION
=
"delegateExpression"
;
public
static
final
String
ATTRIBUTE_TASK_SERVICE_RESULTVARIABLE
=
"resultVariableName"
;
public
static
final
String
ATTRIBUTE_TASK_SERVICE_EXTENSIONID
=
"extensionId"
;
public
static
final
String
ATTRIBUTE_TASK_SERVICE_SKIP_EXPRESSION
=
"skipExpression"
;
public
static
final
String
ATTRIBUTE_TASK_USER_ASSIGNEE
=
"assignee"
;
public
static
final
String
ATTRIBUTE_TASK_USER_OWNER
=
"owner"
;
...
...
@@ -176,6 +177,7 @@ public interface BpmnXMLConstants {
public
static
final
String
ATTRIBUTE_TASK_USER_DUEDATE
=
"dueDate"
;
public
static
final
String
ATTRIBUTE_TASK_USER_CATEGORY
=
"category"
;
public
static
final
String
ATTRIBUTE_TASK_USER_PRIORITY
=
"priority"
;
public
static
final
String
ATTRIBUTE_TASK_USER_SKIP_EXPRESSION
=
"skipExpression"
;
public
static
final
String
ATTRIBUTE_TASK_RULE_VARIABLES_INPUT
=
"ruleVariablesInput"
;
public
static
final
String
ATTRIBUTE_TASK_RULE_RESULT_VARIABLE
=
"resultVariable"
;
...
...
@@ -194,6 +196,7 @@ public interface BpmnXMLConstants {
public
static
final
String
ELEMENT_FLOW_CONDITION
=
"conditionExpression"
;
public
static
final
String
ATTRIBUTE_FLOW_SOURCE_REF
=
"sourceRef"
;
public
static
final
String
ATTRIBUTE_FLOW_TARGET_REF
=
"targetRef"
;
public
static
final
String
ATTRIBUTE_FLOW_SKIP_EXPRESSION
=
"skipExpression"
;
public
static
final
String
ELEMENT_TEXT_ANNOTATION
=
"textAnnotation"
;
public
static
final
String
ATTRIBUTE_TEXTFORMAT
=
"textFormat"
;
...
...
modules/activiti-bpmn-converter/src/main/java/org/activiti/bpmn/converter/SequenceFlowXMLConverter.java
浏览文件 @
46876282
...
...
@@ -42,6 +42,7 @@ public class SequenceFlowXMLConverter extends BaseBpmnXMLConverter {
sequenceFlow
.
setSourceRef
(
xtr
.
getAttributeValue
(
null
,
ATTRIBUTE_FLOW_SOURCE_REF
));
sequenceFlow
.
setTargetRef
(
xtr
.
getAttributeValue
(
null
,
ATTRIBUTE_FLOW_TARGET_REF
));
sequenceFlow
.
setName
(
xtr
.
getAttributeValue
(
null
,
ATTRIBUTE_NAME
));
sequenceFlow
.
setSkipExpression
(
xtr
.
getAttributeValue
(
null
,
ATTRIBUTE_FLOW_SKIP_EXPRESSION
));
parseChildElements
(
getXMLElementName
(),
sequenceFlow
,
model
,
xtr
);
...
...
@@ -53,6 +54,10 @@ public class SequenceFlowXMLConverter extends BaseBpmnXMLConverter {
SequenceFlow
sequenceFlow
=
(
SequenceFlow
)
element
;
writeDefaultAttribute
(
ATTRIBUTE_FLOW_SOURCE_REF
,
sequenceFlow
.
getSourceRef
(),
xtw
);
writeDefaultAttribute
(
ATTRIBUTE_FLOW_TARGET_REF
,
sequenceFlow
.
getTargetRef
(),
xtw
);
if
(
StringUtils
.
isNotEmpty
(
sequenceFlow
.
getSkipExpression
()))
{
writeDefaultAttribute
(
ATTRIBUTE_FLOW_SKIP_EXPRESSION
,
sequenceFlow
.
getSkipExpression
(),
xtw
);
}
}
@Override
...
...
modules/activiti-bpmn-converter/src/main/java/org/activiti/bpmn/converter/ServiceTaskXMLConverter.java
浏览文件 @
46876282
...
...
@@ -67,6 +67,9 @@ public class ServiceTaskXMLConverter extends BaseBpmnXMLConverter {
serviceTask
.
setType
(
xtr
.
getAttributeValue
(
ACTIVITI_EXTENSIONS_NAMESPACE
,
ATTRIBUTE_TYPE
));
serviceTask
.
setExtensionId
(
xtr
.
getAttributeValue
(
ACTIVITI_EXTENSIONS_NAMESPACE
,
ATTRIBUTE_TASK_SERVICE_EXTENSIONID
));
if
(
StringUtils
.
isNotEmpty
(
xtr
.
getAttributeValue
(
ACTIVITI_EXTENSIONS_NAMESPACE
,
ATTRIBUTE_TASK_SERVICE_SKIP_EXPRESSION
)))
{
serviceTask
.
setSkipExpression
(
xtr
.
getAttributeValue
(
ACTIVITI_EXTENSIONS_NAMESPACE
,
ATTRIBUTE_TASK_SERVICE_SKIP_EXPRESSION
));
}
parseChildElements
(
getXMLElementName
(),
serviceTask
,
model
,
xtr
);
return
serviceTask
;
...
...
@@ -94,6 +97,10 @@ public class ServiceTaskXMLConverter extends BaseBpmnXMLConverter {
if
(
StringUtils
.
isNotEmpty
(
serviceTask
.
getExtensionId
()))
{
writeQualifiedAttribute
(
ATTRIBUTE_TASK_SERVICE_EXTENSIONID
,
serviceTask
.
getExtensionId
(),
xtw
);
}
if
(
StringUtils
.
isNotEmpty
(
serviceTask
.
getSkipExpression
()))
{
writeQualifiedAttribute
(
ATTRIBUTE_TASK_SERVICE_SKIP_EXPRESSION
,
serviceTask
.
getSkipExpression
(),
xtw
);
}
}
@Override
...
...
modules/activiti-bpmn-converter/src/main/java/org/activiti/bpmn/converter/UserTaskXMLConverter.java
浏览文件 @
46876282
...
...
@@ -48,7 +48,8 @@ public class UserTaskXMLConverter extends BaseBpmnXMLConverter {
new
ExtensionAttribute
(
ACTIVITI_EXTENSIONS_NAMESPACE
,
ATTRIBUTE_TASK_USER_PRIORITY
),
new
ExtensionAttribute
(
ACTIVITI_EXTENSIONS_NAMESPACE
,
ATTRIBUTE_TASK_USER_CANDIDATEUSERS
),
new
ExtensionAttribute
(
ACTIVITI_EXTENSIONS_NAMESPACE
,
ATTRIBUTE_TASK_USER_CANDIDATEGROUPS
),
new
ExtensionAttribute
(
ACTIVITI_EXTENSIONS_NAMESPACE
,
ATTRIBUTE_TASK_USER_CATEGORY
)
new
ExtensionAttribute
(
ACTIVITI_EXTENSIONS_NAMESPACE
,
ATTRIBUTE_TASK_USER_CATEGORY
),
new
ExtensionAttribute
(
ACTIVITI_EXTENSIONS_NAMESPACE
,
ATTRIBUTE_TASK_USER_SKIP_EXPRESSION
)
);
public
UserTaskXMLConverter
()
{
...
...
@@ -100,6 +101,11 @@ public class UserTaskXMLConverter extends BaseBpmnXMLConverter {
userTask
.
getCandidateGroups
().
addAll
(
parseDelimitedList
(
expression
));
}
if
(
StringUtils
.
isNotEmpty
(
xtr
.
getAttributeValue
(
ACTIVITI_EXTENSIONS_NAMESPACE
,
ATTRIBUTE_TASK_USER_SKIP_EXPRESSION
)))
{
String
expression
=
xtr
.
getAttributeValue
(
ACTIVITI_EXTENSIONS_NAMESPACE
,
ATTRIBUTE_TASK_USER_SKIP_EXPRESSION
);
userTask
.
setSkipExpression
(
expression
);
}
BpmnXMLUtil
.
addCustomAttributes
(
xtr
,
userTask
,
defaultElementAttributes
,
defaultActivityAttributes
,
defaultUserTaskAttributes
);
...
...
@@ -122,6 +128,10 @@ public class UserTaskXMLConverter extends BaseBpmnXMLConverter {
if
(
userTask
.
getPriority
()
!=
null
)
{
writeQualifiedAttribute
(
ATTRIBUTE_TASK_USER_PRIORITY
,
userTask
.
getPriority
().
toString
(),
xtw
);
}
if
(
null
!=
userTask
.
getSkipExpression
())
{
writeQualifiedAttribute
(
ATTRIBUTE_TASK_USER_SKIP_EXPRESSION
,
userTask
.
getSkipExpression
(),
xtw
);
}
// write custom attributes
BpmnXMLUtil
.
writeCustomAttributes
(
userTask
.
getAttributes
().
values
(),
xtw
,
defaultElementAttributes
,
defaultActivityAttributes
,
defaultUserTaskAttributes
);
...
...
modules/activiti-bpmn-converter/src/main/resources/org/activiti/impl/bpmn/parser/Semantic.xsd
浏览文件 @
46876282
...
...
@@ -1373,6 +1373,7 @@
<xsd:attribute
name=
"sourceRef"
type=
"xsd:IDREF"
use=
"required"
/>
<xsd:attribute
name=
"targetRef"
type=
"xsd:IDREF"
use=
"required"
/>
<xsd:attribute
name=
"isImmediate"
type=
"xsd:boolean"
use=
"optional"
/>
<xsd:attribute
name=
"skipExpression"
type=
"xsd:string"
use=
"optional"
/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
...
...
@@ -1383,6 +1384,7 @@
<xsd:extension
base=
"tTask"
>
<xsd:attribute
name=
"implementation"
type=
"tImplementation"
default=
"##WebService"
/>
<xsd:attribute
name=
"operationRef"
type=
"xsd:QName"
use=
"optional"
/>
<xsd:attribute
name=
"skipExpression"
type=
"xsd:string"
use=
"optional"
/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
...
...
@@ -1555,6 +1557,7 @@
<xsd:element
ref=
"rendering"
minOccurs=
"0"
maxOccurs=
"unbounded"
/>
</xsd:sequence>
<xsd:attribute
name=
"implementation"
type=
"tImplementation"
default=
"##unspecified"
/>
<xsd:attribute
name=
"skipExpression"
type=
"xsd:string"
use=
"optional"
/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
...
...
modules/activiti-bpmn-model/src/main/java/org/activiti/bpmn/model/SequenceFlow.java
浏览文件 @
46876282
...
...
@@ -23,6 +23,7 @@ public class SequenceFlow extends FlowElement {
protected
String
conditionExpression
;
protected
String
sourceRef
;
protected
String
targetRef
;
protected
String
skipExpression
;
public
SequenceFlow
()
{
...
...
@@ -51,6 +52,12 @@ public class SequenceFlow extends FlowElement {
public
void
setTargetRef
(
String
targetRef
)
{
this
.
targetRef
=
targetRef
;
}
public
String
getSkipExpression
()
{
return
skipExpression
;
}
public
void
setSkipExpression
(
String
skipExpression
)
{
this
.
skipExpression
=
skipExpression
;
}
public
String
toString
()
{
return
sourceRef
+
" --> "
+
targetRef
;
}
...
...
modules/activiti-bpmn-model/src/main/java/org/activiti/bpmn/model/ServiceTask.java
浏览文件 @
46876282
...
...
@@ -30,6 +30,7 @@ public class ServiceTask extends Task {
protected
String
extensionId
;
protected
List
<
FieldExtension
>
fieldExtensions
=
new
ArrayList
<
FieldExtension
>();
protected
List
<
CustomProperty
>
customProperties
=
new
ArrayList
<
CustomProperty
>();
protected
String
skipExpression
;
public
String
getImplementation
()
{
return
implementation
;
...
...
@@ -83,6 +84,14 @@ public class ServiceTask extends Task {
return
extensionId
!=
null
&&
!
extensionId
.
isEmpty
();
}
public
String
getSkipExpression
()
{
return
skipExpression
;
}
public
void
setSkipExpression
(
String
skipExpression
)
{
this
.
skipExpression
=
skipExpression
;
}
public
ServiceTask
clone
()
{
ServiceTask
clone
=
new
ServiceTask
();
clone
.
setValues
(
this
);
...
...
modules/activiti-bpmn-model/src/main/java/org/activiti/bpmn/model/UserTask.java
浏览文件 @
46876282
...
...
@@ -19,7 +19,6 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Set
;
/**
* @author Tijs Rademakers
*/
...
...
@@ -35,6 +34,7 @@ public class UserTask extends Task {
protected
List
<
String
>
candidateGroups
=
new
ArrayList
<
String
>();
protected
List
<
FormProperty
>
formProperties
=
new
ArrayList
<
FormProperty
>();
protected
List
<
ActivitiListener
>
taskListeners
=
new
ArrayList
<
ActivitiListener
>();
protected
String
skipExpression
;
protected
Map
<
String
,
Set
<
String
>>
customUserIdentityLinks
=
new
HashMap
<
String
,
Set
<
String
>>();
protected
Map
<
String
,
Set
<
String
>>
customGroupIdentityLinks
=
new
HashMap
<
String
,
Set
<
String
>>();
...
...
@@ -135,11 +135,17 @@ public class UserTask extends Task {
return
customGroupIdentityLinks
;
}
public
void
setCustomGroupIdentityLinks
(
Map
<
String
,
Set
<
String
>>
customGroupIdentityLinks
)
{
public
void
setCustomGroupIdentityLinks
(
Map
<
String
,
Set
<
String
>>
customGroupIdentityLinks
)
{
this
.
customGroupIdentityLinks
=
customGroupIdentityLinks
;
}
public
String
getSkipExpression
()
{
return
skipExpression
;
}
public
void
setSkipExpression
(
String
skipExpression
)
{
this
.
skipExpression
=
skipExpression
;
}
public
UserTask
clone
()
{
UserTask
clone
=
new
UserTask
();
clone
.
setValues
(
this
);
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/BpmnActivityBehavior.java
浏览文件 @
46876282
...
...
@@ -14,9 +14,11 @@
package
org.activiti.engine.impl.bpmn.behavior
;
import
org.activiti.engine.ActivitiException
;
import
org.activiti.engine.delegate.Expression
;
import
org.activiti.engine.delegate.event.ActivitiEventType
;
import
org.activiti.engine.delegate.event.impl.ActivitiEventBuilder
;
import
org.activiti.engine.impl.Condition
;
import
org.activiti.engine.impl.bpmn.helper.SkipExpressionUtil
;
import
org.activiti.engine.impl.bpmn.parser.BpmnParse
;
import
org.activiti.engine.impl.context.Context
;
import
org.activiti.engine.impl.persistence.entity.ExecutionEntity
;
...
...
@@ -118,6 +120,9 @@ public class BpmnActivityBehavior implements Serializable {
List
<
PvmTransition
>
outgoingTransitions
=
execution
.
getActivity
().
getOutgoingTransitions
();
for
(
PvmTransition
outgoingTransition
:
outgoingTransitions
)
{
Expression
skipExpression
=
outgoingTransition
.
getSkipExpression
();
if
(!
SkipExpressionUtil
.
isSkipExpressionEnabled
(
execution
,
skipExpression
))
{
if
(
defaultSequenceFlow
==
null
||
!
outgoingTransition
.
getId
().
equals
(
defaultSequenceFlow
))
{
Condition
condition
=
(
Condition
)
outgoingTransition
.
getProperty
(
BpmnParse
.
PROPERTYNAME_CONDITION
);
if
(
condition
==
null
||
!
checkConditions
||
condition
.
evaluate
(
execution
))
{
...
...
@@ -125,6 +130,10 @@ public class BpmnActivityBehavior implements Serializable {
}
}
}
else
if
(
SkipExpressionUtil
.
skipFlowElement
(
execution
,
skipExpression
)){
transitionsToTake
.
add
(
outgoingTransition
);
}
}
if
(
transitionsToTake
.
size
()
==
1
)
{
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/ServiceTaskDelegateExpressionActivityBehavior.java
浏览文件 @
46876282
...
...
@@ -20,6 +20,7 @@ import org.activiti.engine.delegate.Expression;
import
org.activiti.engine.delegate.JavaDelegate
;
import
org.activiti.engine.impl.bpmn.helper.ClassDelegate
;
import
org.activiti.engine.impl.bpmn.helper.ErrorPropagation
;
import
org.activiti.engine.impl.bpmn.helper.SkipExpressionUtil
;
import
org.activiti.engine.impl.bpmn.parser.FieldDeclaration
;
import
org.activiti.engine.impl.context.Context
;
import
org.activiti.engine.impl.delegate.ActivityBehaviorInvocation
;
...
...
@@ -41,10 +42,12 @@ import org.activiti.engine.impl.pvm.delegate.SignallableActivityBehavior;
public
class
ServiceTaskDelegateExpressionActivityBehavior
extends
TaskActivityBehavior
{
protected
Expression
expression
;
protected
Expression
skipExpression
;
private
final
List
<
FieldDeclaration
>
fieldDeclarations
;
public
ServiceTaskDelegateExpressionActivityBehavior
(
Expression
expression
,
List
<
FieldDeclaration
>
fieldDeclarations
)
{
public
ServiceTaskDelegateExpressionActivityBehavior
(
Expression
expression
,
Expression
skipExpression
,
List
<
FieldDeclaration
>
fieldDeclarations
)
{
this
.
expression
=
expression
;
this
.
skipExpression
=
skipExpression
;
this
.
fieldDeclarations
=
fieldDeclarations
;
}
...
...
@@ -60,27 +63,29 @@ public class ServiceTaskDelegateExpressionActivityBehavior extends TaskActivityB
public
void
execute
(
ActivityExecution
execution
)
throws
Exception
{
try
{
boolean
isSkipExpressionEnabled
=
SkipExpressionUtil
.
isSkipExpressionEnabled
(
execution
,
skipExpression
);
if
(!
isSkipExpressionEnabled
||
(
isSkipExpressionEnabled
&&
!
SkipExpressionUtil
.
skipFlowElement
(
execution
,
skipExpression
)))
{
// Note: we can't cache the result of the expression, because the
// execution can change: eg. delegateExpression='${mySpringBeanFactory.randomSpringBean()}'
// execution can change: eg.
// delegateExpression='${mySpringBeanFactory.randomSpringBean()}'
Object
delegate
=
expression
.
getValue
(
execution
);
ClassDelegate
.
applyFieldDeclaration
(
fieldDeclarations
,
delegate
);
if
(
delegate
instanceof
ActivityBehavior
)
{
Context
.
getProcessEngineConfiguration
()
.
getDelegateInterceptor
()
Context
.
getProcessEngineConfiguration
().
getDelegateInterceptor
()
.
handleInvocation
(
new
ActivityBehaviorInvocation
((
ActivityBehavior
)
delegate
,
execution
));
}
else
if
(
delegate
instanceof
JavaDelegate
)
{
Context
.
getProcessEngineConfiguration
()
.
getDelegateInterceptor
()
.
handleInvocation
(
new
JavaDelegateInvocation
((
JavaDelegate
)
delegate
,
execution
));
Context
.
getProcessEngineConfiguration
().
getDelegateInterceptor
().
handleInvocation
(
new
JavaDelegateInvocation
((
JavaDelegate
)
delegate
,
execution
));
leave
(
execution
);
}
else
{
throw
new
ActivitiIllegalArgumentException
(
"Delegate expression "
+
expression
+
" did neither resolve to an implementation of "
+
ActivityBehavior
.
class
+
" nor "
+
JavaDelegate
.
class
);
throw
new
ActivitiIllegalArgumentException
(
"Delegate expression "
+
expression
+
" did neither resolve to an implementation of "
+
ActivityBehavior
.
class
+
" nor "
+
JavaDelegate
.
class
);
}
}
else
{
leave
(
execution
);
}
}
catch
(
Exception
exc
)
{
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/ServiceTaskExpressionActivityBehavior.java
浏览文件 @
46876282
...
...
@@ -13,15 +13,16 @@
package
org.activiti.engine.impl.bpmn.behavior
;
import
org.activiti.engine.ActivitiIllegalArgumentException
;
import
org.activiti.engine.delegate.BpmnError
;
import
org.activiti.engine.delegate.Expression
;
import
org.activiti.engine.impl.bpmn.helper.ErrorPropagation
;
import
org.activiti.engine.impl.bpmn.helper.SkipExpressionUtil
;
import
org.activiti.engine.impl.pvm.delegate.ActivityExecution
;
/**
* ActivityBehavior that evaluates an expression when executed. Optionally, it
sets the result
* of the expression as a variable on the execution.
* ActivityBehavior that evaluates an expression when executed. Optionally, it
*
sets the result
of the expression as a variable on the execution.
*
* @author Tom Baeyens
* @author Christian Stettler
...
...
@@ -32,20 +33,27 @@ import org.activiti.engine.impl.pvm.delegate.ActivityExecution;
public
class
ServiceTaskExpressionActivityBehavior
extends
TaskActivityBehavior
{
protected
Expression
expression
;
protected
Expression
skipExpression
;
protected
String
resultVariable
;
public
ServiceTaskExpressionActivityBehavior
(
Expression
expression
,
String
resultVariable
)
{
public
ServiceTaskExpressionActivityBehavior
(
Expression
expression
,
Expression
skipExpression
,
String
resultVariable
)
{
this
.
expression
=
expression
;
this
.
skipExpression
=
skipExpression
;
this
.
resultVariable
=
resultVariable
;
}
public
void
execute
(
ActivityExecution
execution
)
throws
Exception
{
Object
value
=
null
;
try
{
boolean
isSkipExpressionEnabled
=
SkipExpressionUtil
.
isSkipExpressionEnabled
(
execution
,
skipExpression
);
if
(!
isSkipExpressionEnabled
||
(
isSkipExpressionEnabled
&&
!
SkipExpressionUtil
.
skipFlowElement
(
execution
,
skipExpression
)))
{
value
=
expression
.
getValue
(
execution
);
if
(
resultVariable
!=
null
)
{
execution
.
setVariable
(
resultVariable
,
value
);
}
}
leave
(
execution
);
}
catch
(
Exception
exc
)
{
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/behavior/UserTaskActivityBehavior.java
浏览文件 @
46876282
...
...
@@ -26,6 +26,7 @@ import org.activiti.engine.delegate.Expression;
import
org.activiti.engine.delegate.TaskListener
;
import
org.activiti.engine.delegate.event.ActivitiEventType
;
import
org.activiti.engine.delegate.event.impl.ActivitiEventBuilder
;
import
org.activiti.engine.impl.bpmn.helper.SkipExpressionUtil
;
import
org.activiti.engine.impl.calendar.BusinessCalendar
;
import
org.activiti.engine.impl.calendar.DueDateBusinessCalendar
;
import
org.activiti.engine.impl.context.Context
;
...
...
@@ -131,6 +132,12 @@ public class UserTaskActivityBehavior extends TaskActivityBehavior {
}
task
.
fireEvent
(
TaskListener
.
EVENTNAME_CREATE
);
Expression
skipExpression
=
taskDefinition
.
getSkipExpression
();
if
(
SkipExpressionUtil
.
isSkipExpressionEnabled
(
execution
,
skipExpression
)
&&
SkipExpressionUtil
.
skipFlowElement
(
execution
,
skipExpression
))
{
leave
(
execution
);
}
}
public
void
signal
(
ActivityExecution
execution
,
String
signalName
,
Object
signalData
)
throws
Exception
{
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/helper/ClassDelegate.java
浏览文件 @
46876282
...
...
@@ -22,6 +22,7 @@ import org.activiti.engine.ActivitiException;
import
org.activiti.engine.ActivitiIllegalArgumentException
;
import
org.activiti.engine.delegate.BpmnError
;
import
org.activiti.engine.delegate.DelegateExecution
;
import
org.activiti.engine.delegate.Expression
;
import
org.activiti.engine.delegate.DelegateTask
;
import
org.activiti.engine.delegate.ExecutionListener
;
import
org.activiti.engine.delegate.JavaDelegate
;
...
...
@@ -54,14 +55,16 @@ public class ClassDelegate extends AbstractBpmnActivityBehavior implements TaskL
protected
ExecutionListener
executionListenerInstance
;
protected
TaskListener
taskListenerInstance
;
protected
ActivityBehavior
activityBehaviorInstance
;
protected
Expression
skipExpression
;
public
ClassDelegate
(
String
className
,
List
<
FieldDeclaration
>
fieldDeclarations
)
{
public
ClassDelegate
(
String
className
,
List
<
FieldDeclaration
>
fieldDeclarations
,
Expression
skipExpression
)
{
this
.
className
=
className
;
this
.
fieldDeclarations
=
fieldDeclarations
;
this
.
skipExpression
=
skipExpression
;
}
public
ClassDelegate
(
Class
<
?>
clazz
,
List
<
FieldDeclaration
>
fieldDeclarations
)
{
this
(
clazz
.
getName
(),
fieldDeclarations
);
public
ClassDelegate
(
Class
<
?
>
clazz
,
List
<
FieldDeclaration
>
fieldDeclarations
,
Expression
skipExpression
)
{
this
(
clazz
.
getName
(),
fieldDeclarations
,
skipExpression
);
}
// Execution listener
...
...
@@ -110,6 +113,9 @@ public class ClassDelegate extends AbstractBpmnActivityBehavior implements TaskL
// Activity Behavior
public
void
execute
(
ActivityExecution
execution
)
throws
Exception
{
boolean
isSkipExpressionEnabled
=
SkipExpressionUtil
.
isSkipExpressionEnabled
(
execution
,
skipExpression
);
if
(!
isSkipExpressionEnabled
||
(
isSkipExpressionEnabled
&&
!
SkipExpressionUtil
.
skipFlowElement
(
execution
,
skipExpression
)))
{
if
(
activityBehaviorInstance
==
null
)
{
activityBehaviorInstance
=
getActivityBehaviorInstance
(
execution
);
}
...
...
@@ -119,6 +125,7 @@ public class ClassDelegate extends AbstractBpmnActivityBehavior implements TaskL
ErrorPropagation
.
propagateError
(
error
,
execution
);
}
}
}
// Signallable activity behavior
public
void
signal
(
ActivityExecution
execution
,
String
signalName
,
Object
signalData
)
throws
Exception
{
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/helper/SkipExpressionUtil.java
0 → 100644
浏览文件 @
46876282
package
org.activiti.engine.impl.bpmn.helper
;
import
org.activiti.engine.ActivitiIllegalArgumentException
;
import
org.activiti.engine.delegate.Expression
;
import
org.activiti.engine.impl.pvm.delegate.ActivityExecution
;
public
class
SkipExpressionUtil
{
public
static
boolean
isSkipExpressionEnabled
(
ActivityExecution
execution
,
Expression
skipExpression
)
{
if
(
null
==
skipExpression
)
{
return
false
;
}
final
String
skipExpressionEnabledVariable
=
"_ACTIVITI_SKIP_EXPRESSION_ENABLED"
;
Object
isSkipExpressionEnabled
=
execution
.
getVariable
(
skipExpressionEnabledVariable
);
if
(
null
==
isSkipExpressionEnabled
)
{
return
false
;
}
else
if
(
isSkipExpressionEnabled
instanceof
Boolean
)
{
return
((
Boolean
)
isSkipExpressionEnabled
).
booleanValue
();
}
else
{
throw
new
ActivitiIllegalArgumentException
(
skipExpressionEnabledVariable
+
" variable does not resolve to a boolean. "
+
isSkipExpressionEnabled
);
}
}
public
static
boolean
skipFlowElement
(
ActivityExecution
execution
,
Expression
skipExpression
)
{
Object
value
=
skipExpression
.
getValue
(
execution
);
if
(
value
instanceof
Boolean
)
{
return
((
Boolean
)
value
).
booleanValue
();
}
else
{
throw
new
ActivitiIllegalArgumentException
(
"Skip expression does not resolve to a boolean: "
+
skipExpression
.
getExpressionText
());
}
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/factory/DefaultActivityBehaviorFactory.java
浏览文件 @
46876282
...
...
@@ -89,9 +89,9 @@ import org.activiti.engine.impl.task.TaskDefinition;
import
org.apache.commons.lang3.StringUtils
;
/**
* Default implementation of the {@link ActivityBehaviorFactory}.
*
Used when no custom {@link ActivityBehaviorFactory} is injected on
*
the
{@link ProcessEngineConfigurationImpl}.
* Default implementation of the {@link ActivityBehaviorFactory}.
Used when no
*
custom {@link ActivityBehaviorFactory} is injected on the
* {@link ProcessEngineConfigurationImpl}.
*
* @author Joram Barrez
*/
...
...
@@ -128,17 +128,43 @@ public class DefaultActivityBehaviorFactory extends AbstractBehaviorFactory impl
// Service task
public
ClassDelegate
createClassDelegateServiceTask
(
ServiceTask
serviceTask
)
{
return
new
ClassDelegate
(
serviceTask
.
getImplementation
(),
createFieldDeclarations
(
serviceTask
.
getFieldExtensions
()));
Expression
skipExpression
;
if
(
StringUtils
.
isNotEmpty
(
serviceTask
.
getSkipExpression
()))
{
skipExpression
=
expressionManager
.
createExpression
(
serviceTask
.
getSkipExpression
());
}
else
{
skipExpression
=
null
;
}
return
new
ClassDelegate
(
serviceTask
.
getImplementation
(),
createFieldDeclarations
(
serviceTask
.
getFieldExtensions
()),
skipExpression
);
}
public
ServiceTaskDelegateExpressionActivityBehavior
createServiceTaskDelegateExpressionActivityBehavior
(
ServiceTask
serviceTask
)
{
Expression
delegateExpression
=
expressionManager
.
createExpression
(
serviceTask
.
getImplementation
());
return
new
ServiceTaskDelegateExpressionActivityBehavior
(
delegateExpression
,
createFieldDeclarations
(
serviceTask
.
getFieldExtensions
()));
Expression
skipExpression
;
if
(
StringUtils
.
isNotEmpty
(
serviceTask
.
getSkipExpression
()))
{
skipExpression
=
expressionManager
.
createExpression
(
serviceTask
.
getSkipExpression
());
}
else
{
skipExpression
=
null
;
}
return
new
ServiceTaskDelegateExpressionActivityBehavior
(
delegateExpression
,
skipExpression
,
createFieldDeclarations
(
serviceTask
.
getFieldExtensions
()));
}
public
ServiceTaskExpressionActivityBehavior
createServiceTaskExpressionActivityBehavior
(
ServiceTask
serviceTask
)
{
Expression
expression
=
expressionManager
.
createExpression
(
serviceTask
.
getImplementation
());
return
new
ServiceTaskExpressionActivityBehavior
(
expression
,
serviceTask
.
getResultVariableName
());
Expression
skipExpression
;
if
(
StringUtils
.
isNotEmpty
(
serviceTask
.
getSkipExpression
()))
{
skipExpression
=
expressionManager
.
createExpression
(
serviceTask
.
getSkipExpression
());
}
else
{
skipExpression
=
null
;
}
return
new
ServiceTaskExpressionActivityBehavior
(
expression
,
skipExpression
,
serviceTask
.
getResultVariableName
());
}
public
WebServiceActivityBehavior
createWebServiceActivityBehavior
(
ServiceTask
serviceTask
)
{
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/factory/DefaultListenerFactory.java
浏览文件 @
46876282
...
...
@@ -65,7 +65,7 @@ public class DefaultListenerFactory extends AbstractBehaviorFactory implements L
}
public
TaskListener
createClassDelegateTaskListener
(
ActivitiListener
activitiListener
)
{
return
new
ClassDelegate
(
activitiListener
.
getImplementation
(),
createFieldDeclarations
(
activitiListener
.
getFieldExtensions
()));
return
new
ClassDelegate
(
activitiListener
.
getImplementation
(),
createFieldDeclarations
(
activitiListener
.
getFieldExtensions
())
,
null
);
}
public
TaskListener
createExpressionTaskListener
(
ActivitiListener
activitiListener
)
{
...
...
@@ -78,7 +78,7 @@ public class DefaultListenerFactory extends AbstractBehaviorFactory implements L
}
public
ExecutionListener
createClassDelegateExecutionListener
(
ActivitiListener
activitiListener
)
{
return
new
ClassDelegate
(
activitiListener
.
getImplementation
(),
createFieldDeclarations
(
activitiListener
.
getFieldExtensions
()));
return
new
ClassDelegate
(
activitiListener
.
getImplementation
(),
createFieldDeclarations
(
activitiListener
.
getFieldExtensions
())
,
null
);
}
public
ExecutionListener
createExpressionExecutionListener
(
ActivitiListener
activitiListener
)
{
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/handler/SequenceFlowParseHandler.java
浏览文件 @
46876282
...
...
@@ -14,8 +14,10 @@ package org.activiti.engine.impl.bpmn.parser.handler;
import
org.activiti.bpmn.model.BaseElement
;
import
org.activiti.bpmn.model.SequenceFlow
;
import
org.activiti.engine.delegate.Expression
;
import
org.activiti.engine.impl.Condition
;
import
org.activiti.engine.impl.bpmn.parser.BpmnParse
;
import
org.activiti.engine.impl.el.ExpressionManager
;
import
org.activiti.engine.impl.el.UelExpressionCondition
;
import
org.activiti.engine.impl.pvm.process.ActivityImpl
;
import
org.activiti.engine.impl.pvm.process.ScopeImpl
;
...
...
@@ -41,7 +43,18 @@ public class SequenceFlowParseHandler extends AbstractBpmnParseHandler<SequenceF
ActivityImpl
sourceActivity
=
scope
.
findActivity
(
sequenceFlow
.
getSourceRef
());
ActivityImpl
destinationActivity
=
scope
.
findActivity
(
sequenceFlow
.
getTargetRef
());
TransitionImpl
transition
=
sourceActivity
.
createOutgoingTransition
(
sequenceFlow
.
getId
());
Expression
skipExpression
;
if
(
StringUtils
.
isNotEmpty
(
sequenceFlow
.
getSkipExpression
()))
{
ExpressionManager
expressionManager
=
bpmnParse
.
getExpressionManager
();
skipExpression
=
expressionManager
.
createExpression
(
sequenceFlow
.
getSkipExpression
());
}
else
{
skipExpression
=
null
;
}
TransitionImpl
transition
=
sourceActivity
.
createOutgoingTransition
(
sequenceFlow
.
getId
(),
skipExpression
);
bpmnParse
.
getSequenceFlows
().
put
(
sequenceFlow
.
getId
(),
transition
);
transition
.
setProperty
(
"name"
,
sequenceFlow
.
getName
());
transition
.
setProperty
(
"documentation"
,
sequenceFlow
.
getDocumentation
());
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/bpmn/parser/handler/UserTaskParseHandler.java
浏览文件 @
46876282
...
...
@@ -129,6 +129,10 @@ public class UserTaskParseHandler extends AbstractActivityBpmnParseHandler<UserT
taskDefinition
.
addCustomGroupIdentityLinkExpression
(
customGroupIdentityLinkType
,
groupIdentityLinkExpression
);
}
if
(
StringUtils
.
isNotEmpty
(
userTask
.
getSkipExpression
()))
{
taskDefinition
.
setSkipExpression
(
expressionManager
.
createExpression
(
userTask
.
getSkipExpression
()));
}
return
taskDefinition
;
}
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/pvm/ProcessDefinitionBuilder.java
浏览文件 @
46876282
...
...
@@ -81,7 +81,7 @@ public class ProcessDefinitionBuilder {
throw
new
PvmException
(
"destinationActivityId is null"
);
}
ActivityImpl
activity
=
getActivity
();
transition
=
activity
.
createOutgoingTransition
(
transitionId
);
transition
=
activity
.
createOutgoingTransition
(
transitionId
,
null
);
unresolvedTransitions
.
add
(
new
Object
[]{
transition
,
destinationActivityId
});
processElement
=
transition
;
return
this
;
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/pvm/PvmTransition.java
浏览文件 @
46876282
...
...
@@ -13,6 +13,8 @@
package
org.activiti.engine.impl.pvm
;
import
org.activiti.engine.delegate.Expression
;
/**
...
...
@@ -23,4 +25,6 @@ public interface PvmTransition extends PvmProcessElement {
PvmActivity
getSource
();
PvmActivity
getDestination
();
Expression
getSkipExpression
();
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/pvm/process/ActivityImpl.java
浏览文件 @
46876282
...
...
@@ -18,6 +18,7 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
org.activiti.engine.delegate.Expression
;
import
org.activiti.engine.impl.pvm.PvmActivity
;
import
org.activiti.engine.impl.pvm.PvmException
;
import
org.activiti.engine.impl.pvm.PvmTransition
;
...
...
@@ -52,7 +53,7 @@ public class ActivityImpl extends ScopeImpl implements PvmActivity, HasDIBounds
}
public
TransitionImpl
createOutgoingTransition
()
{
return
createOutgoingTransition
(
null
);
return
createOutgoingTransition
(
null
,
null
);
}
public
String
getFailedJobRetryTimeCycleValue
()
{
return
failedJobRetryTimeCycleValue
;
...
...
@@ -61,8 +62,8 @@ public class ActivityImpl extends ScopeImpl implements PvmActivity, HasDIBounds
this
.
failedJobRetryTimeCycleValue
=
failedJobRetryTimeCycleValue
;
}
public
TransitionImpl
createOutgoingTransition
(
String
transitionId
)
{
TransitionImpl
transition
=
new
TransitionImpl
(
transitionId
,
processDefinition
);
public
TransitionImpl
createOutgoingTransition
(
String
transitionId
,
Expression
skipExpression
)
{
TransitionImpl
transition
=
new
TransitionImpl
(
transitionId
,
skipExpression
,
processDefinition
);
transition
.
setSource
(
this
);
outgoingTransitions
.
add
(
transition
);
...
...
modules/activiti-engine/src/main/java/org/activiti/engine/impl/pvm/process/TransitionImpl.java
浏览文件 @
46876282
...
...
@@ -18,6 +18,7 @@ import java.util.Collections;
import
java.util.List
;
import
org.activiti.engine.delegate.ExecutionListener
;
import
org.activiti.engine.delegate.Expression
;
import
org.activiti.engine.impl.pvm.PvmTransition
;
...
...
@@ -31,12 +32,14 @@ public class TransitionImpl extends ProcessElementImpl implements PvmTransition
protected
ActivityImpl
source
;
protected
ActivityImpl
destination
;
protected
List
<
ExecutionListener
>
executionListeners
;
protected
Expression
skipExpression
;
/** Graphical information: a list of waypoints: x1, y1, x2, y2, x3, y3, .. */
protected
List
<
Integer
>
waypoints
=
new
ArrayList
<
Integer
>();
public
TransitionImpl
(
String
id
,
ProcessDefinitionImpl
processDefinition
)
{
public
TransitionImpl
(
String
id
,
Expression
skipExpression
,
ProcessDefinitionImpl
processDefinition
)
{
super
(
id
,
processDefinition
);
this
.
skipExpression
=
skipExpression
;
}
public
ActivityImpl
getSource
()
{
...
...
@@ -89,4 +92,11 @@ public class TransitionImpl extends ProcessElementImpl implements PvmTransition
this
.
waypoints
=
waypoints
;
}
public
Expression
getSkipExpression
()
{
return
skipExpression
;
}
public
void
setSkipExpression
(
Expression
skipExpression
)
{
this
.
skipExpression
=
skipExpression
;
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/impl/task/TaskDefinition.java
浏览文件 @
46876282
...
...
@@ -47,6 +47,7 @@ public class TaskDefinition implements Serializable {
protected
Expression
categoryExpression
;
protected
Map
<
String
,
Set
<
Expression
>>
customUserIdentityLinkExpressions
=
new
HashMap
<
String
,
Set
<
Expression
>>();
protected
Map
<
String
,
Set
<
Expression
>>
customGroupIdentityLinkExpressions
=
new
HashMap
<
String
,
Set
<
Expression
>>();
protected
Expression
skipExpression
;
// form fields
protected
TaskFormHandler
taskFormHandler
;
...
...
@@ -204,4 +205,12 @@ public class TaskDefinition implements Serializable {
}
}
public
Expression
getSkipExpression
()
{
return
skipExpression
;
}
public
void
setSkipExpression
(
Expression
skipExpression
)
{
this
.
skipExpression
=
skipExpression
;
}
}
modules/activiti-engine/src/main/java/org/activiti/engine/test/TestActivityBehaviorFactory.java
浏览文件 @
46876282
...
...
@@ -165,7 +165,7 @@ public class TestActivityBehaviorFactory extends AbstractBehaviorFactory impleme
}
else
if
(
serviceTask
.
getImplementation
()
!=
null
&&
mockedClassDelegatesMapping
.
containsKey
(
serviceTask
.
getImplementation
()))
{
return
new
ClassDelegate
(
mockedClassDelegatesMapping
.
get
(
serviceTask
.
getImplementation
()),
createFieldDeclarations
(
serviceTask
.
getFieldExtensions
()));
createFieldDeclarations
(
serviceTask
.
getFieldExtensions
())
,
null
);
}
...
...
@@ -176,7 +176,7 @@ public class TestActivityBehaviorFactory extends AbstractBehaviorFactory impleme
List
<
FieldDeclaration
>
fieldDeclarations
=
new
ArrayList
<
FieldDeclaration
>();
fieldDeclarations
.
add
(
new
FieldDeclaration
(
"name"
,
Expression
.
class
.
getName
(),
new
FixedValue
(
serviceTask
.
getImplementation
())));
return
new
ClassDelegate
(
NoOpServiceTask
.
class
,
fieldDeclarations
);
return
new
ClassDelegate
(
NoOpServiceTask
.
class
,
fieldDeclarations
,
null
);
}
@Override
...
...
modules/activiti-engine/src/test/java/org/activiti/engine/test/bpmn/sequenceflow/ConditionalSequenceFlowTest.java
浏览文件 @
46876282
...
...
@@ -13,6 +13,7 @@
package
org.activiti.engine.test.bpmn.sequenceflow
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.activiti.engine.impl.test.PluggableActivitiTestCase
;
...
...
@@ -39,4 +40,21 @@ public class ConditionalSequenceFlowTest extends PluggableActivitiTestCase {
assertEquals
(
"task right"
,
task
.
getName
());
}
@Deployment
public
void
testSkipExpression
()
{
Map
<
String
,
Object
>
variables
=
new
HashMap
<
String
,
Object
>();
variables
.
put
(
"input"
,
"right"
);
variables
.
put
(
"_ACTIVITI_SKIP_EXPRESSION_ENABLED"
,
true
);
variables
.
put
(
"skipLeft"
,
true
);
variables
.
put
(
"skipRight"
,
false
);
ProcessInstance
pi
=
runtimeService
.
startProcessInstanceByKey
(
"testSkipExpression"
,
variables
);
Task
task
=
taskService
.
createTaskQuery
()
.
processInstanceId
(
pi
.
getId
())
.
singleResult
();
assertEquals
(
"task left"
,
task
.
getName
());
}
}
\ No newline at end of file
modules/activiti-engine/src/test/java/org/activiti/examples/bpmn/servicetask/ExpressionServiceTaskTest.java
浏览文件 @
46876282
...
...
@@ -20,6 +20,29 @@ public class ExpressionServiceTaskTest extends PluggableActivitiTestCase {
assertEquals
(
"ok"
,
runtimeService
.
getVariable
(
pi
.
getId
(),
"result"
));
}
@Deployment
public
void
testSetServiceResultToProcessVariablesWithSkipExpression
()
{
Map
<
String
,
Object
>
variables
=
new
HashMap
<
String
,
Object
>();
variables
.
put
(
"bean"
,
new
ValueBean
(
"ok"
));
variables
.
put
(
"_ACTIVITI_SKIP_EXPRESSION_ENABLED"
,
true
);
variables
.
put
(
"skip"
,
false
);
ProcessInstance
pi
=
runtimeService
.
startProcessInstanceByKey
(
"setServiceResultToProcessVariablesWithSkipExpression"
,
variables
);
assertEquals
(
"ok"
,
runtimeService
.
getVariable
(
pi
.
getId
(),
"result"
));
Map
<
String
,
Object
>
variables2
=
new
HashMap
<
String
,
Object
>();
variables2
.
put
(
"bean"
,
new
ValueBean
(
"ok"
));
variables2
.
put
(
"_ACTIVITI_SKIP_EXPRESSION_ENABLED"
,
true
);
variables2
.
put
(
"skip"
,
true
);
ProcessInstance
pi2
=
runtimeService
.
startProcessInstanceByKey
(
"setServiceResultToProcessVariablesWithSkipExpression"
,
variables2
);
assertEquals
(
null
,
runtimeService
.
getVariable
(
pi2
.
getId
(),
"result"
));
Map
<
String
,
Object
>
variables3
=
new
HashMap
<
String
,
Object
>();
variables3
.
put
(
"bean"
,
new
ValueBean
(
"ok"
));
variables3
.
put
(
"_ACTIVITI_SKIP_EXPRESSION_ENABLED"
,
true
);
ProcessInstance
pi3
=
runtimeService
.
startProcessInstanceByKey
(
"setServiceResultToProcessVariablesWithSkipExpression"
,
variables2
);
assertEquals
(
null
,
runtimeService
.
getVariable
(
pi3
.
getId
(),
"result"
));
}
@Deployment
public
void
testBackwardsCompatibleExpression
()
{
Map
<
String
,
Object
>
variables
=
new
HashMap
<
String
,
Object
>();
...
...
modules/activiti-engine/src/test/java/org/activiti/examples/bpmn/servicetask/JavaServiceTaskTest.java
浏览文件 @
46876282
...
...
@@ -71,6 +71,40 @@ public class JavaServiceTaskTest extends PluggableActivitiTestCase {
assertEquals
(
"elam :si redneg ruoY"
,
runtimeService
.
getVariable
(
execution
.
getId
(),
"var1"
));
}
@Deployment
public
void
testExpressionFieldInjectionWithSkipExpression
()
{
Map
<
String
,
Object
>
vars
=
new
HashMap
<
String
,
Object
>();
vars
.
put
(
"name"
,
"kermit"
);
vars
.
put
(
"gender"
,
"male"
);
vars
.
put
(
"genderBean"
,
new
GenderBean
());
vars
.
put
(
"_ACTIVITI_SKIP_EXPRESSION_ENABLED"
,
true
);
vars
.
put
(
"skip"
,
false
);
ProcessInstance
pi
=
runtimeService
.
startProcessInstanceByKey
(
"expressionFieldInjectionWithSkipExpression"
,
vars
);
Execution
execution
=
runtimeService
.
createExecutionQuery
()
.
processInstanceId
(
pi
.
getId
())
.
activityId
(
"waitState"
)
.
singleResult
();
assertEquals
(
"timrek .rM olleH"
,
runtimeService
.
getVariable
(
execution
.
getId
(),
"var2"
));
assertEquals
(
"elam :si redneg ruoY"
,
runtimeService
.
getVariable
(
execution
.
getId
(),
"var1"
));
Map
<
String
,
Object
>
vars2
=
new
HashMap
<
String
,
Object
>();
vars2
.
put
(
"name"
,
"kermit"
);
vars2
.
put
(
"gender"
,
"male"
);
vars2
.
put
(
"genderBean"
,
new
GenderBean
());
vars2
.
put
(
"_ACTIVITI_SKIP_EXPRESSION_ENABLED"
,
true
);
vars2
.
put
(
"skip"
,
true
);
ProcessInstance
pi2
=
runtimeService
.
startProcessInstanceByKey
(
"expressionFieldInjectionWithSkipExpression"
,
vars2
);
Execution
execution2
=
runtimeService
.
createExecutionQuery
()
.
processInstanceId
(
pi2
.
getId
())
.
activityId
(
"waitState"
)
.
singleResult
();
assertEquals
(
null
,
execution2
);
}
@Deployment
public
void
testUnexistingClassDelegation
()
{
try
{
...
...
modules/activiti-engine/src/test/java/org/activiti/examples/bpmn/servicetask/MethodExpressionServiceTaskTest.java
浏览文件 @
46876282
...
...
@@ -22,4 +22,24 @@ public class MethodExpressionServiceTaskTest extends PluggableActivitiTestCase {
assertEquals
(
"ok"
,
runtimeService
.
getVariable
(
pi
.
getId
(),
"result"
));
}
@Deployment
public
void
testSetServiceResultToProcessVariablesWithSkipExpression
()
{
Map
<
String
,
Object
>
variables
=
new
HashMap
<
String
,
Object
>();
variables
.
put
(
"okReturningService"
,
new
OkReturningService
());
variables
.
put
(
"_ACTIVITI_SKIP_EXPRESSION_ENABLED"
,
false
);
ProcessInstance
pi
=
runtimeService
.
startProcessInstanceByKey
(
"setServiceResultToProcessVariablesWithSkipExpression"
,
variables
);
assertEquals
(
"ok"
,
runtimeService
.
getVariable
(
pi
.
getId
(),
"result"
));
Map
<
String
,
Object
>
variables2
=
new
HashMap
<
String
,
Object
>();
variables2
.
put
(
"okReturningService"
,
new
OkReturningService
());
variables2
.
put
(
"_ACTIVITI_SKIP_EXPRESSION_ENABLED"
,
true
);
variables2
.
put
(
"skip"
,
true
);
ProcessInstance
pi2
=
runtimeService
.
startProcessInstanceByKey
(
"setServiceResultToProcessVariablesWithSkipExpression"
,
variables2
);
assertEquals
(
null
,
runtimeService
.
getVariable
(
pi2
.
getId
(),
"result"
));
}
}
\ No newline at end of file
modules/activiti-engine/src/test/java/org/activiti/examples/bpmn/usertask/SkipExpressionUserTaskTest.java
0 → 100644
浏览文件 @
46876282
package
org.activiti.examples.bpmn.usertask
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.activiti.engine.impl.test.PluggableActivitiTestCase
;
import
org.activiti.engine.runtime.ProcessInstance
;
import
org.activiti.engine.task.Task
;
import
org.activiti.engine.test.Deployment
;
public
class
SkipExpressionUserTaskTest
extends
PluggableActivitiTestCase
{
@Deployment
public
void
test
()
{
ProcessInstance
pi
=
runtimeService
.
startProcessInstanceByKey
(
"skipExpressionUserTask"
);
List
<
Task
>
tasks
=
taskService
.
createTaskQuery
().
list
();
assertEquals
(
1
,
tasks
.
size
());
taskService
.
complete
(
tasks
.
get
(
0
).
getId
());
assertEquals
(
0
,
taskService
.
createTaskQuery
().
list
().
size
());
Map
<
String
,
Object
>
variables2
=
new
HashMap
<
String
,
Object
>();
variables2
.
put
(
"_ACTIVITI_SKIP_EXPRESSION_ENABLED"
,
true
);
variables2
.
put
(
"skip"
,
false
);
ProcessInstance
pi2
=
runtimeService
.
startProcessInstanceByKey
(
"skipExpressionUserTask"
,
variables2
);
List
<
Task
>
tasks2
=
taskService
.
createTaskQuery
().
list
();
assertEquals
(
1
,
tasks2
.
size
());
taskService
.
complete
(
tasks2
.
get
(
0
).
getId
());
assertEquals
(
0
,
taskService
.
createTaskQuery
().
list
().
size
());
Map
<
String
,
Object
>
variables3
=
new
HashMap
<
String
,
Object
>();
variables3
.
put
(
"_ACTIVITI_SKIP_EXPRESSION_ENABLED"
,
true
);
variables3
.
put
(
"skip"
,
true
);
ProcessInstance
pi3
=
runtimeService
.
startProcessInstanceByKey
(
"skipExpressionUserTask"
,
variables3
);
List
<
Task
>
tasks3
=
taskService
.
createTaskQuery
().
list
();
assertEquals
(
0
,
tasks3
.
size
());
}
}
modules/activiti-engine/src/test/resources/org/activiti/engine/test/bpmn/sequenceflow/ConditionalSequenceFlowTest.testSkipExpression.bpmn20.xml
0 → 100644
浏览文件 @
46876282
<?xml version="1.0" encoding="UTF-8"?>
<definitions
id=
"definitions"
xmlns=
"http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:activiti=
"http://activiti.org/bpmn"
targetNamespace=
"Examples"
>
<process
id=
"testSkipExpression"
>
<startEvent
id=
"theStart"
/>
<sequenceFlow
id=
"flow1"
sourceRef=
"theStart"
targetRef=
"task1"
activiti:skipExpression=
"${skipLeft}"
>
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${input == 'left'}]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow
id=
"flow2"
sourceRef=
"theStart"
targetRef=
"task2"
activiti:skipExpression=
"${skipRight}"
>
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${input == 'right'}]]>
</conditionExpression>
</sequenceFlow>
<userTask
id=
"task1"
name=
"task left"
/>
<userTask
id=
"task2"
name=
"task right"
/>
</process>
</definitions>
\ No newline at end of file
modules/activiti-engine/src/test/resources/org/activiti/examples/bpmn/servicetask/ExpressionServiceTaskTest.testSetServiceResultToProcessVariablesWithSkipExpression.bpmn20.xml
0 → 100644
浏览文件 @
46876282
<?xml version="1.0" encoding="UTF-8"?>
<definitions
id=
"definitions"
xmlns=
"http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti=
"http://activiti.org/bpmn"
targetNamespace=
"Examples"
>
<process
id=
"setServiceResultToProcessVariablesWithSkipExpression"
>
<startEvent
id=
"theStart"
/>
<sequenceFlow
sourceRef=
"theStart"
targetRef=
"valueExpressionServiceWithResultVariableNameSet"
/>
<serviceTask
id=
"valueExpressionServiceWithResultVariableNameSet"
activiti:resultVariable=
"result"
activiti:expression=
"#{bean.value}"
activiti:skipExpression=
"${execution.getVariable('skip')}"
/>
<sequenceFlow
sourceRef=
"valueExpressionServiceWithResultVariableNameSet"
targetRef=
"valueExpressionServiceWithoutResultVariableNameSet"
/>
<serviceTask
id=
"valueExpressionServiceWithoutResultVariableNameSet"
activiti:expression=
"#{bean.value}"
/>
<sequenceFlow
sourceRef=
"valueExpressionServiceWithoutResultVariableNameSet"
targetRef=
"waitState"
/>
<userTask
id=
"waitState"
/>
<sequenceFlow
sourceRef=
"waitState"
targetRef=
"theEnd"
/>
<endEvent
id=
"theEnd"
/>
</process>
</definitions>
modules/activiti-engine/src/test/resources/org/activiti/examples/bpmn/servicetask/JavaServiceTaskTest.testExpressionFieldInjectionWithSkipExpression.bpmn20.xml
0 → 100644
浏览文件 @
46876282
<?xml version="1.0" encoding="UTF-8"?>
<definitions
id=
"definitions"
xmlns=
"http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti=
"http://activiti.org/bpmn"
targetNamespace=
"Examples"
>
<process
id=
"expressionFieldInjectionWithSkipExpression"
>
<startEvent
id=
"theStart"
/>
<sequenceFlow
id=
"flow1"
sourceRef=
"theStart"
targetRef=
"javaService"
/>
<serviceTask
id=
"javaService"
name=
"Java service invocation"
activiti:class=
"org.activiti.examples.bpmn.servicetask.ReverseStringsFieldInjected"
activiti:skipExpression=
"${execution.getVariable('skip')}"
>
<extensionElements>
<activiti:field
name=
"text1"
>
<activiti:expression>
${genderBean.getGenderString(gender)}
</activiti:expression>
</activiti:field>
<activiti:field
name=
"text2"
>
<activiti:expression>
Hello ${gender == 'male' ? 'Mr.' : 'Mrs.'} ${name}
</activiti:expression>
</activiti:field>
</extensionElements>
</serviceTask>
<sequenceFlow
id=
"flow2"
sourceRef=
"javaService"
targetRef=
"waitState"
/>
<receiveTask
id=
"waitState"
/>
<sequenceFlow
id=
"flow3"
sourceRef=
"waitState"
targetRef=
"theEnd"
/>
<endEvent
id=
"theEnd"
/>
</process>
</definitions>
\ No newline at end of file
modules/activiti-engine/src/test/resources/org/activiti/examples/bpmn/servicetask/MethodExpressionServiceTaskTest.testSetServiceResultToProcessVariablesWithSkipExpression.bpmn20.xml
0 → 100644
浏览文件 @
46876282
<?xml version="1.0" encoding="UTF-8"?>
<definitions
id=
"definitions"
xmlns=
"http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti=
"http://activiti.org/bpmn"
targetNamespace=
"Examples"
>
<process
id=
"setServiceResultToProcessVariablesWithSkipExpression"
>
<startEvent
id=
"theStart"
/>
<sequenceFlow
sourceRef=
"theStart"
targetRef=
"methodExpressionServiceWithResultVariableNameSet"
/>
<serviceTask
id=
"methodExpressionServiceWithResultVariableNameSet"
activiti:resultVariable=
"result"
activiti:expression=
"#{okReturningService.invoke()}"
activiti:skipExpression=
"${skip}"
/>
<sequenceFlow
sourceRef=
"methodExpressionServiceWithResultVariableNameSet"
targetRef=
"methodExpressionServiceWithoutResultVariableNameSet"
/>
<serviceTask
id=
"methodExpressionServiceWithoutResultVariableNameSet"
activiti:expression=
"#{okReturningService.invoke()}"
/>
<sequenceFlow
sourceRef=
"methodExpressionServiceWithoutResultVariableNameSet"
targetRef=
"waitState"
/>
<userTask
id=
"waitState"
/>
<sequenceFlow
sourceRef=
"waitState"
targetRef=
"theEnd"
/>
<endEvent
id=
"theEnd"
/>
</process>
</definitions>
modules/activiti-engine/src/test/resources/org/activiti/examples/bpmn/usertask/SkipExpressionUserTaskTest.test.bpmn20.xml
0 → 100644
浏览文件 @
46876282
<definitions
xmlns=
"http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:activiti=
"http://activiti.org/bpmn"
targetNamespace=
"Examples"
>
<process
id=
"skipExpressionUserTask"
>
<startEvent
id=
"theStart"
name=
"Start Event"
/>
<sequenceFlow
sourceRef=
"theStart"
targetRef=
"userTask1"
/>
<userTask
id=
"userTask1"
name=
"Task1"
activiti:skipExpression=
"${execution.getVariable('skip')}"
/>
<sequenceFlow
sourceRef=
"userTask1"
targetRef=
"theEnd"
/>
<endEvent
id=
"theEnd"
name=
"End Event"
/>
</process>
</definitions>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录