Collection<PortletWindowConfig> portlets = getAllPortlets(driverConfig);
for (PortletWindowConfig portlet : portlets) {
String contextPath = portlet.getContextPath();
String applicationName = contextPath;
PortletApplicationDefinition portletAppDD = null;
try {
portletAppDD = portletRegistry.getPortletApplication(applicationName);
List<? extends PortletDefinition> portletDDs = portletAppDD.getPortlets();
List<QName> aliases = getAllAliases(eventName, portletAppDD);
for (PortletDefinition portletDD : portletDDs) {
List<? extends EventDefinitionReference> processingEvents = portletDD.getSupportedProcessingEvents();
if (isEventSupported(processingEvents, eventName, portletAppDD.getDefaultNamespace())) {
if (portletDD.getPortletName().equals(portlet.getPortletName())) {
resultSet.add(portlet.getId());
}
} else {
if (processingEvents != null) {
for (EventDefinitionReference ref : processingEvents) {
QName name = ref.getQualifiedName(portletAppDD.getDefaultNamespace());
if (name == null)
{
continue;
}
// add also grouped portlets, that ends with "."
if (name.toString().endsWith(".")
&& eventName.toString().startsWith(name.toString())
&& portletDD.getPortletName().equals(portlet.getPortletName())) {
resultSet.add(portlet.getId());
}
// also look for alias names:
if (aliases != null) {
for (QName alias : aliases) {
if (alias.toString().equals(name.toString())
&& portletDD.getPortletName().equals(portlet.getPortletName())) {
resultSet.add(portlet.getId());
}
}
}
// also look for default namespaced events
if (name.getNamespaceURI() == null || name.getNamespaceURI().equals("")) {
String defaultNamespace = portletAppDD.getDefaultNamespace();
QName qname = new QName(defaultNamespace, name.getLocalPart());
if (eventName.toString().equals(qname.toString())
&& portletDD.getPortletName().equals(portlet.getPortletName())) {
resultSet.add(portlet.getId());
}