Author: chris.laprun(a)jboss.com
Date: 2009-10-09 09:31:27 -0400 (Fri, 09 Oct 2009)
New Revision: 320
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/portlet/info/WSRPPortletInfo.java
Log:
- Separate application name from group id. If a group id is present in the service
description, use it. Otherwise, use consumer id.
This way, we always have something that makes some sense to use as an application name.
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/portlet/info/WSRPPortletInfo.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/portlet/info/WSRPPortletInfo.java 2009-10-09
13:23:16 UTC (rev 319)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/portlet/info/WSRPPortletInfo.java 2009-10-09
13:31:27 UTC (rev 320)
@@ -23,11 +23,11 @@
package org.gatein.wsrp.consumer.portlet.info;
-import org.gatein.pc.api.Mode;
-import org.gatein.pc.api.WindowState;
import org.gatein.common.net.media.MediaType;
import org.gatein.common.util.ParameterValidation;
+import org.gatein.pc.api.Mode;
import org.gatein.pc.api.TransportGuarantee;
+import org.gatein.pc.api.WindowState;
import org.gatein.pc.api.info.CacheInfo;
import org.gatein.pc.api.info.CapabilitiesInfo;
import org.gatein.pc.api.info.EventInfo;
@@ -77,6 +77,7 @@
private boolean userContextStoredInSession;
private boolean templatesStoredInSession;
private boolean doesUrlTemplateProcessing;
+ private String applicationName;
private String groupId;
private PreferencesInfo prefInfo;
private ProducerInfo originatingProducer;
@@ -91,7 +92,7 @@
createMetaInfo(portletDescription);
- createWSRPInfo(portletDescription);
+ createWSRPInfo(portletDescription, originatingProducerInfo.getId());
this.originatingProducer = originatingProducerInfo;
this.portletHandle = portletDescription.getPortletHandle();
@@ -110,7 +111,8 @@
userContextStoredInSession = other.userContextStoredInSession;
templatesStoredInSession = other.templatesStoredInSession;
doesUrlTemplateProcessing = other.doesUrlTemplateProcessing;
- groupId = other.groupId; // should be duplicate group id?
+ groupId = other.groupId;
+ applicationName = other.applicationName;
WSRPCapabilitiesInfo otherCapabilities =
(WSRPCapabilitiesInfo)other.getCapabilities();
capabilities = new WSRPCapabilitiesInfo(new HashMap<MediaType,
MediaTypeInfo>(otherCapabilities.mediaTypes),
@@ -133,7 +135,7 @@
public String getApplicationName()
{
- return groupId;
+ return applicationName;
}
public CapabilitiesInfo getCapabilities()
@@ -312,7 +314,7 @@
return groupId;
}
- private void createWSRPInfo(PortletDescription portletDescription)
+ private void createWSRPInfo(PortletDescription portletDescription, String consumerId)
{
// String[] userCategories = portletDescription.getUserCategories();
// String[] userProfileItems = portletDescription.getUserProfileItems();
@@ -327,6 +329,17 @@
doesUrlTemplateProcessing =
Boolean.TRUE.equals(portletDescription.isDoesUrlTemplateProcessing());
groupId = portletDescription.getGroupID();
+
+ // if we don't have a group id, use the consumer id as the application name
+ if (ParameterValidation.isNullOrEmpty(groupId))
+ {
+ applicationName = consumerId;
+ }
+ else
+ {
+ applicationName = groupId;
+ }
+
}
private void createCapabilitiesInfo(PortletDescription portletDescription)
Show replies by date