Class ActivitiEventDispatcherImpl
- java.lang.Object
-
- org.activiti.engine.delegate.event.impl.ActivitiEventDispatcherImpl
-
- All Implemented Interfaces:
ActivitiEventDispatcher
public class ActivitiEventDispatcherImpl extends java.lang.Object implements ActivitiEventDispatcher
Class capable of dispatching events.
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanenabledprotected ActivitiEventSupporteventSupport
-
Constructor Summary
Constructors Constructor Description ActivitiEventDispatcherImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEventListener(ActivitiEventListener listenerToAdd)Adds an event-listener which will be notified of ALL events by the dispatcher.voidaddEventListener(ActivitiEventListener listenerToAdd, ActivitiEventType... types)Adds an event-listener which will only be notified when an event of the given types occurs.voiddispatchEvent(ActivitiEvent event)Dispatches the given event to any listeners that are registered.protected org.activiti.bpmn.model.BpmnModelextractBpmnModelFromEvent(ActivitiEvent event)In case no process-context is active, this method attempts to extract a process-definition based on the event.booleanisEnabled()voidremoveEventListener(ActivitiEventListener listenerToRemove)Removes the given listener from this dispatcher.voidsetEnabled(boolean enabled)
-
-
-
Field Detail
-
eventSupport
protected ActivitiEventSupport eventSupport
-
enabled
protected boolean enabled
-
-
Method Detail
-
setEnabled
public void setEnabled(boolean enabled)
- Specified by:
setEnabledin interfaceActivitiEventDispatcher- Parameters:
enabled- true, if event dispatching should be enabled.
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabledin interfaceActivitiEventDispatcher- Returns:
- true, if event dispatcher is enabled.
-
addEventListener
public void addEventListener(ActivitiEventListener listenerToAdd)
Description copied from interface:ActivitiEventDispatcherAdds an event-listener which will be notified of ALL events by the dispatcher.- Specified by:
addEventListenerin interfaceActivitiEventDispatcher- Parameters:
listenerToAdd- the listener to add
-
addEventListener
public void addEventListener(ActivitiEventListener listenerToAdd, ActivitiEventType... types)
Description copied from interface:ActivitiEventDispatcherAdds an event-listener which will only be notified when an event of the given types occurs.- Specified by:
addEventListenerin interfaceActivitiEventDispatcher- Parameters:
listenerToAdd- the listener to addtypes- types of events the listener should be notified for
-
removeEventListener
public void removeEventListener(ActivitiEventListener listenerToRemove)
Description copied from interface:ActivitiEventDispatcherRemoves the given listener from this dispatcher. The listener will no longer be notified, regardless of the type(s) it was registered for in the first place.- Specified by:
removeEventListenerin interfaceActivitiEventDispatcher- Parameters:
listenerToRemove- listener to remove
-
dispatchEvent
public void dispatchEvent(ActivitiEvent event)
Description copied from interface:ActivitiEventDispatcherDispatches the given event to any listeners that are registered.- Specified by:
dispatchEventin interfaceActivitiEventDispatcher- Parameters:
event- event to dispatch.
-
extractBpmnModelFromEvent
protected org.activiti.bpmn.model.BpmnModel extractBpmnModelFromEvent(ActivitiEvent event)
In case no process-context is active, this method attempts to extract a process-definition based on the event. In case it's an event related to an entity, this can be deducted by inspecting the entity, without additional queries to the database. If not an entity-related event, the process-definition will be retrieved based on the processDefinitionId (if filled in). This requires an additional query to the database in case not already cached. However, queries will only occur when the definition is not yet in the cache, which is very unlikely to happen, unless evicted.- Parameters:
event-- Returns:
-
-