Package com.hybris.cockpitng.events.impl
Class DefaultCockpitEventQueue
- java.lang.Object
-
- com.hybris.cockpitng.events.impl.DefaultCockpitEventQueue
-
- All Implemented Interfaces:
CockpitEventQueue
public class DefaultCockpitEventQueue extends java.lang.Object implements CockpitEventQueue
-
-
Constructor Summary
Constructors Constructor Description DefaultCockpitEventQueue()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddEventToAggregatedEventsForWidgets(CockpitEvent event, java.util.List<ListenerInfo> listenerWidgetsToNotify)protected booleancheckScope(ScopeContext currentContext, ListenerInfo listenerInfo)java.util.List<CockpitEvent>fetchEvents(java.lang.String widgetID)Returns all events available for the specified widget and removes them from the queue.protected java.util.Set<CockpitEvent>findEventsForWidgets(java.lang.String widgetId)protected java.util.Set<ListenerInfo>findListenersByName(java.lang.String eventName)protected java.util.List<ListenerInfo>findWidgetListenersToNotify(CockpitEvent event)protected ScopeContextgetCurrentScopeContext()voidpublishEvent(CockpitEvent event)Adds an event to the event queue.voidregisterListener(java.lang.String widgetID, java.lang.String eventName, java.lang.String scope)Registers the widget as a listener for the specified event.voidremoveListener(java.lang.String widgetID)This implementation is async and therefore the calling side should not rely on it being effective immediately.
Remove the specified widget from the set of listeners.voidsetCockpitUserService(CockpitUserService cockpitUserService)
-
-
-
Method Detail
-
publishEvent
public void publishEvent(CockpitEvent event)
Description copied from interface:CockpitEventQueueAdds an event to the event queue.- Specified by:
publishEventin interfaceCockpitEventQueue- Parameters:
event- The event to publish.
-
addEventToAggregatedEventsForWidgets
protected void addEventToAggregatedEventsForWidgets(CockpitEvent event, java.util.List<ListenerInfo> listenerWidgetsToNotify)
-
findWidgetListenersToNotify
protected java.util.List<ListenerInfo> findWidgetListenersToNotify(CockpitEvent event)
-
checkScope
protected boolean checkScope(ScopeContext currentContext, ListenerInfo listenerInfo)
-
getCurrentScopeContext
protected ScopeContext getCurrentScopeContext()
-
fetchEvents
public java.util.List<CockpitEvent> fetchEvents(java.lang.String widgetID)
Description copied from interface:CockpitEventQueueReturns all events available for the specified widget and removes them from the queue.- Specified by:
fetchEventsin interfaceCockpitEventQueue- Parameters:
widgetID- The widget for which the events should be fetched.- Returns:
- The events being published since the last call of this method or an empty list, if the widget has not been registered.
-
registerListener
public void registerListener(java.lang.String widgetID, java.lang.String eventName, java.lang.String scope)Description copied from interface:CockpitEventQueueRegisters the widget as a listener for the specified event.- Specified by:
registerListenerin interfaceCockpitEventQueue- Parameters:
widgetID- A string that represents the widget.eventName- A string that defines the event.
-
findListenersByName
protected java.util.Set<ListenerInfo> findListenersByName(java.lang.String eventName)
-
findEventsForWidgets
protected java.util.Set<CockpitEvent> findEventsForWidgets(java.lang.String widgetId)
-
removeListener
public void removeListener(java.lang.String widgetID)
This implementation is async and therefore the calling side should not rely on it being effective immediately.
Remove the specified widget from the set of listeners. If the widget is not registered, this method does nothing.- Specified by:
removeListenerin interfaceCockpitEventQueue- Parameters:
widgetID- The widget to remove from the listeners.
-
setCockpitUserService
public void setCockpitUserService(CockpitUserService cockpitUserService)
-
-