/** * Generates a list of portlets that are processing events or publishing the events * * @param portletProcessingPublishingEventsFromDescriptor Map where portlet id is the key and list * of events is the value * @param eventProcessingPublishingPortlets Map where event is the key and list of portlets is the * value */ private void setEventPortlets( Map<PortletID, List<EventHolder>> portletProcessingPublishingEventsFromDescriptor, Map<QName, List<PortletID>> eventProcessingPublishingPortlets, Map<PortletID, List<EventHolder>> portletSupportingProcessingPublishingEvents) { Set<Map.Entry<PortletID, List<EventHolder>>> entries = portletProcessingPublishingEventsFromDescriptor.entrySet(); for (Map.Entry<PortletID, List<EventHolder>> mapEntry : entries) { for (EventHolder eventHolder : mapEntry.getValue()) { List<EventHolder> supportingEventHolders = portletSupportingProcessingPublishingEvents.get(mapEntry.getKey()); if (supportingEventHolders == null) { supportingEventHolders = new ArrayList<EventHolder>(); } if (!supportingEventHolders.contains(eventHolder)) { supportingEventHolders.add(eventHolder); } portletSupportingProcessingPublishingEvents.put(mapEntry.getKey(), supportingEventHolders); List<PortletID> portletIDs = eventProcessingPublishingPortlets.get(eventHolder.getQName()); if (portletIDs == null) { portletIDs = new ArrayList<PortletID>(); } if (!portletIDs.contains(mapEntry.getKey())) { portletIDs.add(mapEntry.getKey()); } eventProcessingPublishingPortlets.put(eventHolder.getQName(), portletIDs); } } }
// Remove the portlets associated with the qname and // if there are no portlets associated with the qname remove the qname from the Map private void removeEventPublishingPortlets( Map<PortletID, List<EventHolder>> portletPublishingEvents, List<PortletID> portletIDs) { Set<Map.Entry<PortletID, List<EventHolder>>> entries = portletPublishingEvents.entrySet(); for (Map.Entry<PortletID, List<EventHolder>> mapEntry : entries) { for (EventHolder eventHolder : mapEntry.getValue()) { List<PortletID> tempPortletIDs = this.eventPublishingPortlets.get(eventHolder.getQName()); if (tempPortletIDs != null) { for (PortletID portletID : portletIDs) { tempPortletIDs.remove(portletID); } if (tempPortletIDs.isEmpty()) { this.eventPublishingPortlets.remove(eventHolder.getQName()); } } } } }
public EventHolder verifySupportedPublishingEvent( EntityID portletEntityId, EventHolder supportedEventHolder) { // Check whether it supports any ContainerEvent, if yes do not publish it if (getContainerEventService() != null && getContainerEventService() .getSupportedEvents() .contains(supportedEventHolder.getQName())) { return null; } List<PortletID> portlets = getEventPublishingProcessingPortlets( this.eventPublishingPortlets, supportedEventHolder.getQName()); PortletID portletID = portletEntityId.getPortletID(); if (portlets.contains(portletID)) { return supportedEventHolder; } return null; }
public EventHolder verifySupportedProcessingEvent( EntityID portletEntityId, EventHolder supportedEventHolder) { List<PortletID> portlets = getEventPublishingProcessingPortlets( this.eventProcessingPortlets, supportedEventHolder.getQName()); PortletID portletID = portletEntityId.getPortletID(); if (portlets.contains(portletID)) { return supportedEventHolder; } else { // Check whether supportedEventQName is present in the aliases of any event definition // or whether the supportedEventQName is same as the qname of any event definition // or whether aliases of the supportedEvent contains the eventQName // or whether any qname is common in both aliases // if yes use the event qname of that event definition to get the portlet list for (List<EventHolder> allEventHolders : this.appEventHolders.values()) { for (EventHolder eventHolder : allEventHolders) { if (eventHolder.getAliases().contains(supportedEventHolder.getQName()) || eventHolder.getQName().equals(supportedEventHolder.getQName()) || supportedEventHolder.getAliases().contains(eventHolder.getQName()) || checkAliases(eventHolder, supportedEventHolder)) { portlets = getEventPublishingProcessingPortlets( this.eventProcessingPortlets, eventHolder.getQName()); if (portlets != null && portlets.contains(portletID)) { return eventHolder; } } } } } return null; }
public void setSupportedProcessingEvent(EntityID portletEntityId, EventHolder eventHolder) throws PublicDescriptorHolderException { if (this.portletSupportingProcessingEvents != null) { List<EventHolder> eventHolders = this.portletSupportingPublishingEvents.get(portletEntityId.getPortletID()); if (eventHolders != null && eventHolders.contains(eventHolder)) { throw new PublicDescriptorHolderException( "The SupportingProcessingEvent:" + eventHolder.getQName() + " is already present"); } } List<EventHolder> eventHolders = new ArrayList<EventHolder>(); eventHolders.add(eventHolder); Map<PortletID, List<EventHolder>> processingEvents = new HashMap<PortletID, List<EventHolder>>(); processingEvents.put(portletEntityId.getPortletID(), eventHolders); createEventProcessingPortlets(processingEvents); // print information printInformation(); }
public void setEventHolder(String portletAppName, EventHolder eventHolder) throws PublicDescriptorHolderException { if (this.appEventHolders != null) { // load Event Holder objects of the portlet application List<EventHolder> eventHolders = this.appEventHolders.get(portletAppName); if (eventHolders == null) { eventHolders = new CopyOnWriteArrayList<EventHolder>(); } if (!eventHolders.contains(eventHolder)) { eventHolders.add(eventHolder); appEventHolders.put(portletAppName, eventHolders); } else { throw new PublicDescriptorHolderException( "The Event:" + eventHolder.getQName() + " is already present"); } } // print information printInformation(); }