package com.iailab.module.bpm.event; import cn.hutool.core.util.StrUtil; import org.springframework.context.ApplicationListener; /** * {@link BpmProcessInstanceStatusEvent} 的监听器 * * @author iailab */ public abstract class BpmProcessInstanceStatusEventListener implements ApplicationListener { @Override public final void onApplicationEvent(BpmProcessInstanceStatusEvent event) { if (!StrUtil.equals(event.getProcessDefinitionKey(), getProcessDefinitionKey())) { return; } onEvent(event); } /** * @return 返回监听的流程定义 Key */ protected abstract String getProcessDefinitionKey(); /** * 处理事件 * * @param event 事件 */ protected abstract void onEvent(BpmProcessInstanceStatusEvent event); }