Author: chris.laprun(a)jboss.com
Date: 2008-04-18 17:20:50 -0400 (Fri, 18 Apr 2008)
New Revision: 10648
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java
Log:
- getAttachment returns null instead of throwing an exception (was breaking viewing of
remote portlets).
- More generification.
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java 2008-04-18
15:04:47 UTC (rev 10647)
+++
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java 2008-04-18
21:20:50 UTC (rev 10648)
@@ -106,14 +106,14 @@
groupId = other.groupId; // should be duplicate group id?
WSRPCapabilitiesInfo otherCapabilities =
(WSRPCapabilitiesInfo)other.getCapabilities();
- capabilities = new WSRPCapabilitiesInfo(new HashMap(otherCapabilities.mediaTypes),
- new HashSet(otherCapabilities.modes), new
HashSet(otherCapabilities.windowStates),
- new HashSet(otherCapabilities.locales));
+ capabilities = new WSRPCapabilitiesInfo(new HashMap<MediaType,
MediaTypeInfo>(otherCapabilities.mediaTypes),
+ new HashSet<ModeInfo>(otherCapabilities.modes), new
HashSet<WindowStateInfo>(otherCapabilities.windowStates),
+ new HashSet<Locale>(otherCapabilities.locales));
WSRPMetaInfo otherMeta = (WSRPMetaInfo)other.getMeta();
- metaInfo = new WSRPMetaInfo(new HashMap(otherMeta.metaInfos));
+ metaInfo = new WSRPMetaInfo(new HashMap<String,
org.jboss.portal.common.i18n.LocalizedString>(otherMeta.metaInfos));
WSRPPreferencesInfo otherPref = (WSRPPreferencesInfo)other.getPreferences();
- prefInfo = new WSRPPreferencesInfo(new HashMap(otherPref.preferences));
+ prefInfo = new WSRPPreferencesInfo(new HashMap<String,
PreferenceInfo>(otherPref.preferences));
originatingProducer = other.originatingProducer;
portletHandle = newHandle;
@@ -141,7 +141,7 @@
if (prefInfo == null)
{
PortletPropertyDescriptionResponse propertyDescs =
originatingProducer.getPropertyDescriptionsFor(portletHandle);
- Map prefInfos = null;
+ Map<String, PreferenceInfo> prefInfos = null;
if (propertyDescs != null)
{
@@ -151,10 +151,9 @@
PropertyDescription[] descs = modelDesc.getPropertyDescriptions();
if (descs != null)
{
- prefInfos = new HashMap(descs.length);
- for (int i = 0; i < descs.length; i++)
+ prefInfos = new HashMap<String, PreferenceInfo>(descs.length);
+ for (PropertyDescription desc : descs)
{
- PropertyDescription desc = descs[i];
String key = desc.getName();
prefInfos.put(key, new WSRPPreferenceInfo(key,
getPortalLocalizedStringOrNullFrom(desc.getLabel()),
getPortalLocalizedStringOrNullFrom(desc.getHint())));
@@ -162,14 +161,14 @@
}
else
{
- prefInfos = Collections.EMPTY_MAP;
+ prefInfos = Collections.emptyMap();
}
}
}
if (prefInfos == null)
{
- prefInfos = Collections.EMPTY_MAP;
+ prefInfos = Collections.emptyMap();
}
prefInfo = new WSRPPreferencesInfo(prefInfos);
@@ -210,7 +209,7 @@
public <T> T getAttachment(Class<T> tClass) throws
IllegalArgumentException
{
- throw new UnsupportedOperationException("Implement if needed!");
+ return null;
}
public boolean isUsesMethodGet()
@@ -447,7 +446,7 @@
this.mediaTypes = mediaTypes;
}
- public WSRPCapabilitiesInfo(Map<MediaType, MediaTypeInfo> mediaTypes,
Set<ModeInfo> modes, Set windowStates, Set locales)
+ public WSRPCapabilitiesInfo(Map<MediaType, MediaTypeInfo> mediaTypes,
Set<ModeInfo> modes, Set<WindowStateInfo> windowStates, Set<Locale>
locales)
{
this.mediaTypes = mediaTypes;
this.modes = modes;
@@ -562,16 +561,16 @@
private static class WSRPMetaInfo implements MetaInfo
{
- private final Map metaInfos;
+ private final Map<String, org.jboss.portal.common.i18n.LocalizedString>
metaInfos;
- public WSRPMetaInfo(Map metaInfos)
+ public WSRPMetaInfo(Map<String, org.jboss.portal.common.i18n.LocalizedString>
metaInfos)
{
this.metaInfos = metaInfos;
}
public org.jboss.portal.common.i18n.LocalizedString getMetaValue(String key)
{
- return (org.jboss.portal.common.i18n.LocalizedString)metaInfos.get(key);
+ return metaInfos.get(key);
}
}