AttributesManager am = session.getAttributesManager();
Map<String, Attribute> attrs = am.getAttributes(userName);
User user = new UserImpl(userName);
if (attrs == null)
{
return user;
}
else
{
if (attrs.containsKey(USER_CREATED_DATE))
{
user.setCreatedDate(dateFormat.parse(attrs.get(USER_CREATED_DATE).getValue().toString()));
}
if (attrs.containsKey(USER_EMAIL))
{
user.setEmail(attrs.get(USER_EMAIL).getValue().toString());
}
if (attrs.containsKey(USER_FIRST_NAME))
{
user.setFirstName(attrs.get(USER_FIRST_NAME).getValue().toString());
}
if (attrs.containsKey(USER_LAST_LOGIN_TIME))
{
user.setLastLoginTime(dateFormat.parse(attrs.get(USER_LAST_LOGIN_TIME).getValue().toString()));
}
if (attrs.containsKey(USER_LAST_NAME))
{
user.setLastName(attrs.get(USER_LAST_NAME).getValue().toString());
}
if (attrs.containsKey(USER_ORGANIZATION_ID))
{
user.setOrganizationId(attrs.get(USER_ORGANIZATION_ID).getValue().toString());
}
if (attrs.containsKey(USER_PASSWORD))
{
user.setPassword(attrs.get(USER_PASSWORD).getValue().toString());
}
}
return user;