Author: chris.laprun(a)jboss.com
Date: 2008-07-08 11:06:11 -0400 (Tue, 08 Jul 2008)
New Revision: 11352
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/UserContextConverter.java
Log:
- More generification.
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/UserContextConverter.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/UserContextConverter.java 2008-07-08
15:05:51 UTC (rev 11351)
+++
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/UserContextConverter.java 2008-07-08
15:06:11 UTC (rev 11352)
@@ -23,9 +23,8 @@
package org.jboss.portal.wsrp;
-import static org.jboss.portal.common.p3p.P3PConstants.*;
-
import org.jboss.portal.common.NotYetImplemented;
+import static org.jboss.portal.common.p3p.P3PConstants.*;
import org.jboss.portal.portlet.spi.UserContext;
import org.jboss.portal.wsrp.core.Contact;
import org.jboss.portal.wsrp.core.EmployerInfo;
@@ -91,42 +90,42 @@
}
EmployerInfo employerInfo = new
EmployerInfo((String)userInfos.get(INFO_USER_EMPLOYER),
- (String)userInfos.get(INFO_USER_DEPARTMENT),
- (String)userInfos.get(INFO_USER_JOB_TITLE), null);
+ (String)userInfos.get(INFO_USER_DEPARTMENT),
+ (String)userInfos.get(INFO_USER_JOB_TITLE), null);
return new UserProfile(name, bdate, (String)userInfos.get(INFO_USER_GENDER),
employerInfo,
- createContactFrom(userInfos, false), createContactFrom(userInfos, true), null);
+ createContactFrom(userInfos, false), createContactFrom(userInfos, true),
null);
}
private static PersonName createNameFrom(Map userInfos)
{
return new PersonName(
- (String)userInfos.get(INFO_USER_NAME_PREFIX),
- (String)userInfos.get(INFO_USER_NAME_GIVEN),
- (String)userInfos.get(INFO_USER_NAME_FAMILY),
- (String)userInfos.get(INFO_USER_NAME_MIDDLE),
- (String)userInfos.get(INFO_USER_NAME_SUFFIX),
- (String)userInfos.get(INFO_USER_NAME_NICKNAME), null);
+ (String)userInfos.get(INFO_USER_NAME_PREFIX),
+ (String)userInfos.get(INFO_USER_NAME_GIVEN),
+ (String)userInfos.get(INFO_USER_NAME_FAMILY),
+ (String)userInfos.get(INFO_USER_NAME_MIDDLE),
+ (String)userInfos.get(INFO_USER_NAME_SUFFIX),
+ (String)userInfos.get(INFO_USER_NAME_NICKNAME), null);
}
private static Contact createContactFrom(Map infos, boolean isBusiness)
{
Online online = new Online((String)infos.get(getOnlineUserInfoKey(OnlineInfo.EMAIL,
isBusiness)),
- (String)infos.get(getOnlineUserInfoKey(OnlineInfo.URI, isBusiness)), null);
+ (String)infos.get(getOnlineUserInfoKey(OnlineInfo.URI, isBusiness)),
null);
Postal postal = new Postal(
- (String)infos.get(getPostalUserInfoKey(PostalInfo.NAME, isBusiness)),
- (String)infos.get(getPostalUserInfoKey(PostalInfo.STREET, isBusiness)),
- (String)infos.get(getPostalUserInfoKey(PostalInfo.CITY, isBusiness)),
- (String)infos.get(getPostalUserInfoKey(PostalInfo.STATEPROV, isBusiness)),
- (String)infos.get(getPostalUserInfoKey(PostalInfo.POSTALCODE, isBusiness)),
- (String)infos.get(getPostalUserInfoKey(PostalInfo.COUNTRY, isBusiness)),
- (String)infos.get(getPostalUserInfoKey(PostalInfo.ORGANIZATION, isBusiness)),
null);
+ (String)infos.get(getPostalUserInfoKey(PostalInfo.NAME, isBusiness)),
+ (String)infos.get(getPostalUserInfoKey(PostalInfo.STREET, isBusiness)),
+ (String)infos.get(getPostalUserInfoKey(PostalInfo.CITY, isBusiness)),
+ (String)infos.get(getPostalUserInfoKey(PostalInfo.STATEPROV, isBusiness)),
+ (String)infos.get(getPostalUserInfoKey(PostalInfo.POSTALCODE,
isBusiness)),
+ (String)infos.get(getPostalUserInfoKey(PostalInfo.COUNTRY, isBusiness)),
+ (String)infos.get(getPostalUserInfoKey(PostalInfo.ORGANIZATION,
isBusiness)), null);
Telecom telecom = new Telecom(createTelephoneNumFrom(infos, TelecomType.TELEPHONE,
isBusiness),
- createTelephoneNumFrom(infos, TelecomType.FAX, isBusiness),
- createTelephoneNumFrom(infos, TelecomType.MOBILE, isBusiness),
- createTelephoneNumFrom(infos, TelecomType.PAGER, isBusiness), null);
+ createTelephoneNumFrom(infos, TelecomType.FAX, isBusiness),
+ createTelephoneNumFrom(infos, TelecomType.MOBILE, isBusiness),
+ createTelephoneNumFrom(infos, TelecomType.PAGER, isBusiness), null);
return new Contact(postal, telecom, online, null);
}
@@ -134,11 +133,11 @@
private static TelephoneNum createTelephoneNumFrom(Map infos, TelecomType type,
boolean isBusiness)
{
return new TelephoneNum(
- (String)infos.get(getTelecomInfoKey(type, TelecomInfo.INTCODE, isBusiness)),
- (String)infos.get(getTelecomInfoKey(type, TelecomInfo.LOCCODE, isBusiness)),
- (String)infos.get(getTelecomInfoKey(type, TelecomInfo.NUMBER, isBusiness)),
- (String)infos.get(getTelecomInfoKey(type, TelecomInfo.EXT, isBusiness)),
- (String)infos.get(getTelecomInfoKey(type, TelecomInfo.COMMENT, isBusiness)),
null);
+ (String)infos.get(getTelecomInfoKey(type, TelecomInfo.INTCODE,
isBusiness)),
+ (String)infos.get(getTelecomInfoKey(type, TelecomInfo.LOCCODE,
isBusiness)),
+ (String)infos.get(getTelecomInfoKey(type, TelecomInfo.NUMBER,
isBusiness)),
+ (String)infos.get(getTelecomInfoKey(type, TelecomInfo.EXT, isBusiness)),
+ (String)infos.get(getTelecomInfoKey(type, TelecomInfo.COMMENT,
isBusiness)), null);
}
/**
@@ -150,11 +149,10 @@
*/
static class WSRPMappedUserContext implements UserContext
{
- private Map infos;
+ private Map<String, String> infos;
private String[] desiredLocales;
private Locale locale;
private String id;
- private Map<String, Object> attributes;
public WSRPMappedUserContext(org.jboss.portal.wsrp.core.UserContext userContext,
String[] desiredLocales, String preferredLocale)
{
@@ -165,7 +163,7 @@
UserProfile profile = userContext.getProfile();
if (profile != null)
{
- infos = new HashMap();
+ infos = new HashMap<String, String>();
Calendar bdate = profile.getBdate();
if (bdate != null)
{
@@ -207,7 +205,7 @@
}
else
{
- infos = Collections.EMPTY_MAP;
+ infos = Collections.emptyMap();
}
}
@@ -277,7 +275,7 @@
int length = desiredLocales.length;
if (length > 0)
{
- List locales = new ArrayList(length);
+ List<Locale> locales = new ArrayList<Locale>(length);
for (int i = 0; i < length; i++)
{
Locale locale = WSRPUtils.getLocale(desiredLocales[i]);
@@ -290,7 +288,7 @@
return Collections.EMPTY_LIST;
}
}
-
+
public Object getAttribute(String arg0)
{
throw new NotYetImplemented();