// send message across portlet application
boolean across = false;
if (message instanceof DefaultPortletMessage) across = true;
ObjectID sourcePiid = sourceRequest.getPortletInstanceEntry().getPiid();
ObjectID sourceAid = sourceConfig.getPortletEntry().getApplication().getAid();
// send to all portlets of the same portlet application on this page
if (destinationPortletName==null) {
// iterate all portlets on the page
Iterator iterator = allPortletsOnPage.iterator();
while (iterator.hasNext()) {
PortletInstanceEntry entry = (PortletInstanceEntry)iterator.next();
PortletConfigImpl portletConfig =
(PortletConfigImpl)evtEnv.getPortletConfig(entry.getConcretePortlet());
// check if the portlet is not the same portlet as the sender
if (!sourcePiid.equals(entry.getPiid())) {
// check if the portlet is in the same portlet application or
// the message should be distributed across applications
if ((sourceAid.equals(portletConfig.getPortletEntry().getApplication().getAid())) ||
(across)) {
PortletRequestImpl portletRequest = new PortletRequestImpl( entry,
servletRequest,
portletConfig,
provider,
true );
MessageEventImpl messageEvent = new MessageEventImpl(entry,
portletRequest,
message);
messageEvent.prepare(evtEnv);
}
}
}
}
else { // send to the portlet with the same name of the same portlet application on this page
// iterate all portlets on the page
Iterator iterator = allPortletsOnPage.iterator();
while (iterator.hasNext()) {
PortletInstanceEntry entry = (PortletInstanceEntry)iterator.next();
PortletConfigImpl portletConfig =
(PortletConfigImpl)evtEnv.getPortletConfig(entry.getConcretePortlet());
// check if the portlet is the destination portlet, but not the same
// virtual instance
if ((portletConfig.getName().equals(destinationPortletName)) &&
(!sourcePiid.equals(entry.getPiid()))) {
// check if the portlet is in the same portlet application or
// the message should be distributed across applications
if ((sourceAid.equals(portletConfig.getPortletEntry().getApplication().getAid())) ||
(across)) {
PortletRequestImpl portletRequest = new PortletRequestImpl( entry,
servletRequest,
portletConfig,