Author: chris.laprun(a)jboss.com
Date: 2008-07-08 11:05:22 -0400 (Tue, 08 Jul 2008)
New Revision: 11350
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/UserContextConverter.java
Log:
- More generification.
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/UserContextConverter.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/UserContextConverter.java 2008-07-08
15:04:56 UTC (rev 11349)
+++
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/UserContextConverter.java 2008-07-08
15:05:22 UTC (rev 11350)
@@ -89,42 +89,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);
}
@@ -132,11 +132,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);
}
/**
@@ -148,7 +148,7 @@
*/
static class WSRPMappedUserContext implements UserContext
{
- private Map infos;
+ private Map<String, String> infos;
private String[] desiredLocales;
private Locale locale;
private String id;
@@ -162,7 +162,7 @@
UserProfile profile = userContext.getProfile();
if (profile != null)
{
- infos = new HashMap();
+ infos = new HashMap<String, String>();
Calendar bdate = profile.getBdate();
if (bdate != null)
{
@@ -204,7 +204,7 @@
}
else
{
- infos = Collections.EMPTY_MAP;
+ infos = Collections.emptyMap();
}
}
@@ -274,7 +274,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]);