in core/src/main/java/com/alibaba/smart/framework/engine/smart/ExecutionListener.java [36:82]
public void decorate(ExtensionElements extensionElements, ParseContext context) {
ListenerAggregation eventListenerAggregation = (ListenerAggregation)extensionElements.getDecorationMap().get(
getDecoratorType());
if(null == eventListenerAggregation){
eventListenerAggregation = new ListenerAggregation();
extensionElements.getDecorationMap().put(this.getDecoratorType(),eventListenerAggregation);
}
for (String event : events) {
// 兼容主流
if( EventConstant.start.name().equals(event)){
if(context.getParent().getCurrentElement() instanceof ProcessDefinitionSource){
event = EventConstant.PROCESS_START.name();
}else {
event = EventConstant.ACTIVITY_START.name();
}
}else if (EventConstant.end.name().equals(event)){
if(context.getParent().getCurrentElement() instanceof ProcessDefinitionSource){
event = EventConstant.PROCESS_END.name();
}else {
event = EventConstant.ACTIVITY_END.name();
}
}
Map<String, List<String>> eventListenerMap = eventListenerAggregation.getEventListenerMap();
List<String> listenerList = eventListenerMap.get(event);
if(CollectionUtil.isNotEmpty(listenerList)){
listenerList.add(this.listenerClass );
}else{
listenerList =CollectionUtil.newArrayList();
listenerList.add(this.listenerClass);
eventListenerMap.put(event,listenerList);
}
}
}