提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.module.bpm.framework.flowable.core.listener; |
H |
2 |
|
|
3 |
import com.iailab.module.bpm.service.task.BpmProcessInstanceService; |
|
4 |
import com.google.common.collect.ImmutableSet; |
|
5 |
import org.flowable.common.engine.api.delegate.event.FlowableEngineEntityEvent; |
|
6 |
import org.flowable.common.engine.api.delegate.event.FlowableEngineEventType; |
|
7 |
import org.flowable.engine.delegate.event.AbstractFlowableEngineEventListener; |
|
8 |
import org.flowable.engine.delegate.event.FlowableCancelledEvent; |
|
9 |
import org.flowable.engine.runtime.ProcessInstance; |
|
10 |
import org.springframework.context.annotation.Lazy; |
|
11 |
import org.springframework.stereotype.Component; |
|
12 |
|
|
13 |
import javax.annotation.Resource; |
|
14 |
import java.util.Set; |
|
15 |
|
|
16 |
/** |
|
17 |
* 监听 {@link ProcessInstance} 的状态变更,更新其对应的 status 状态 |
|
18 |
* |
|
19 |
* @author jason |
|
20 |
*/ |
|
21 |
@Component |
|
22 |
public class BpmProcessInstanceEventListener extends AbstractFlowableEngineEventListener { |
|
23 |
|
|
24 |
public static final Set<FlowableEngineEventType> PROCESS_INSTANCE_EVENTS = ImmutableSet.<FlowableEngineEventType>builder() |
bb2880
|
25 |
.add(FlowableEngineEventType.PROCESS_COMPLETED) |
H |
26 |
.build(); |
|
27 |
|
|
28 |
@Resource |
|
29 |
@Lazy // 延迟加载,避免循环依赖 |
|
30 |
private BpmProcessInstanceService processInstanceService; |
e7c126
|
31 |
|
H |
32 |
public BpmProcessInstanceEventListener(){ |
|
33 |
super(PROCESS_INSTANCE_EVENTS); |
|
34 |
} |
|
35 |
|
|
36 |
@Override |
|
37 |
protected void processCompleted(FlowableEngineEntityEvent event) { |
bb2880
|
38 |
processInstanceService.processProcessInstanceCompleted((ProcessInstance)event.getEntity()); |
e7c126
|
39 |
} |
H |
40 |
} |