/** * Returns the windows that can consume the wanted event name. * * @param wanted the wanted event name * @return the collection of windows that can consume the wanted event */ Collection<Window> getConsumers(QName wanted) { List<Window> consumers = null; for (Window window : windows.values()) { if (window.portlet != null) { for (QName name : window.portlet.getInfo().getEventing().getConsumedEvents().keySet()) { if (wanted.equals(name)) { if (consumers == null) { consumers = new ArrayList<Window>(); } consumers.add(window); } } } } return consumers == null ? Collections.<Window>emptyList() : consumers; } }
public Iterable<WindowEvent> eventProduced(EventPhaseContext context, WindowEvent producedEvent, WindowEvent sourceEvent) { try { LinkedList<WindowEvent> toConsume = new LinkedList<WindowEvent>(); for (Portlet portlet : invoker.getPortlets()) { PortletInfo portletInfo = portlet.getInfo(); if (portletInfo.getEventing().getConsumedEvents().containsKey(producedEvent.getName())) { WindowEvent distributedEvent = new WindowEvent(producedEvent.getName(), producedEvent.getPayload(), portlet.getContext().getId()); toConsume.addLast(distributedEvent); } } return toConsume; } catch (PortletInvokerException e) { System.out.println("e = " + e); return null; } }
if (!consumerPortletInfo.getEventing().getConsumedEvents().containsKey(toConsumeEvent.getName()))
EventingInfo eventingInfo = info.getEventing(); Map<QName, ? extends EventInfo> consumedEventInfos = eventingInfo.getConsumedEvents(); EventInfo eventInfo = consumedEventInfos.get(eventName);
if (portletInfo.getEventing().getConsumedEvents().containsKey(producedEvent.getName()))
EventingInfo eventingInfo = info.getEventing(); Map<QName, ? extends EventInfo> consumedEventInfos = eventingInfo.getConsumedEvents(); EventInfo eventInfo = consumedEventInfos.get(eventName);
if (!producerPortletInfo.getEventing().getProducedEvents().containsKey(producedEvent.getName()))