提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.module.bpm.framework.flowable.core.listener.demo.exection; |
H |
2 |
|
|
3 |
import lombok.extern.slf4j.Slf4j; |
49b4b6
|
4 |
import org.apache.commons.lang3.ObjectUtils; |
H |
5 |
import org.flowable.bpmn.model.FieldExtension; |
e7c126
|
6 |
import org.flowable.engine.delegate.DelegateExecution; |
H |
7 |
import org.springframework.stereotype.Component; |
49b4b6
|
8 |
|
H |
9 |
import java.util.List; |
e7c126
|
10 |
|
H |
11 |
/** |
|
12 |
* 类型为 expression 的 ExecutionListener 监听器示例 |
|
13 |
* |
|
14 |
* 和 {@link DemoDelegateClassExecutionListener} 的差异是,需要注册到 Spring 中,但不用实现 {@link org.flowable.engine.delegate.JavaDelegate} 接口 |
|
15 |
*/ |
|
16 |
@Component |
|
17 |
@Slf4j |
|
18 |
public class DemoSpringExpressionExecutionListener { |
|
19 |
|
|
20 |
public void execute(DelegateExecution execution) { |
49b4b6
|
21 |
log.info("[execute][execution({}) 执行监听器(spring表达式)被调用!变量有:{}]", execution.getId(), |
e7c126
|
22 |
execution.getCurrentFlowableListener().getFieldExtensions()); |
49b4b6
|
23 |
List<FieldExtension> fieldExtensions = execution.getCurrentFlowableListener().getFieldExtensions(); |
H |
24 |
if(ObjectUtils.isNotEmpty(fieldExtensions)) { |
|
25 |
fieldExtensions.stream().forEach(fieldExtension -> { |
|
26 |
System.out.println(fieldExtension.getFieldName()); |
|
27 |
System.out.println(fieldExtension.getExpression()); |
|
28 |
}); |
|
29 |
} |
e7c126
|
30 |
} |
H |
31 |
|
|
32 |
} |