public class UserHelper extends AbstractLogEnabled implements Component, Serviceable, Contextualizable
User| Modifier and Type | Field and Description |
|---|---|
private static String |
__USER_BY_EMAIL_CACHE_REQUEST_ATTR |
private static String |
__USER_CACHE_REQUEST_ATTR |
private Context |
_context |
private UserDirectoryFactory |
_userDirectoryFactory
The user directory factory
|
private UserManager |
_userManager |
private UserPopulationDAO |
_userPopulationDAO
The user population DAO
|
static String |
ROLE
The Avalon role
|
| Constructor and Description |
|---|
UserHelper() |
| Modifier and Type | Method and Description |
|---|---|
private Request |
_getRequest() |
private Map<String,Object> |
_user2json(User user,
boolean full) |
void |
contextualize(Context context) |
User |
getUser(UserIdentity userIdentity)
Get the user from its identity
|
User |
getUserByEmail(String populationId,
String email)
Get the user from its email
|
String |
getUserFullName(UserIdentity userIdentity)
Get the user's full name handling request cache
|
String |
getUserSortableName(UserIdentity userIdentity)
Get the user's sortable name handling request cache
|
UserIdentity |
json2userIdentity(Map<String,? extends Object> json)
Get the user identity from a JSON object
|
void |
saxUser(User user,
ContentHandler handler)
SAX an user
|
void |
saxUser(User user,
ContentHandler handler,
String tagName)
SAX an user
|
void |
saxUserIdentity(UserIdentity userIdentity,
ContentHandler handler)
SAX an user identity
|
void |
saxUserIdentity(UserIdentity userIdentity,
ContentHandler handler,
String tagName)
SAX an user identity
|
void |
service(ServiceManager smanager) |
Map<String,Object> |
user2json(User user)
Get the JSON object representing a user
|
Map<String,Object> |
user2json(User user,
boolean full)
Get the JSON object representing a user
|
Map<String,Object> |
user2json(UserIdentity userIdentity)
Get the JSON object representing a user
|
Map<String,Object> |
user2json(UserIdentity userIdentity,
boolean full)
Get the JSON object representing a user
|
List<Map<String,Object>> |
userIdentities2json(Collection<UserIdentity> users)
Populate a list of map, where each map representing an user.
|
List<Map<String,Object>> |
users2json(Collection<User> users)
Populate a list of map, where each map representing an user.
|
List<Map<String,Object>> |
users2json(Collection<User> users,
boolean full)
Populate a list of map, where each map representing an user.
|
getLogger, setLoggerprivate static final String __USER_CACHE_REQUEST_ATTR
private static final String __USER_BY_EMAIL_CACHE_REQUEST_ATTR
private UserPopulationDAO _userPopulationDAO
private UserDirectoryFactory _userDirectoryFactory
private UserManager _userManager
public UserHelper()
public void service(ServiceManager smanager) throws ServiceException
service in interface ServiceableServiceExceptionpublic void contextualize(Context context) throws ContextException
contextualize in interface ContextualizableContextExceptionpublic String getUserFullName(UserIdentity userIdentity)
userIdentity - The user identitypublic String getUserSortableName(UserIdentity userIdentity)
userIdentity - The user identitypublic List<Map<String,Object>> userIdentities2json(Collection<UserIdentity> users)
users - The list of userspublic List<Map<String,Object>> users2json(Collection<User> users)
users - The list of userspublic List<Map<String,Object>> users2json(Collection<User> users, boolean full)
users - The list of usersfull - Set to true to get full information on userpublic Map<String,Object> user2json(UserIdentity userIdentity)
userIdentity - The user identitypublic Map<String,Object> user2json(UserIdentity userIdentity, boolean full)
userIdentity - The user identityfull - Set to true to get full information on userpublic Map<String,Object> user2json(User user)
user - The userpublic Map<String,Object> user2json(User user, boolean full)
user - The userfull - Set to true to get full information on userprivate Map<String,Object> _user2json(User user, boolean full)
public UserIdentity json2userIdentity(Map<String,? extends Object> json)
json - the JSON object representing the userpublic User getUser(UserIdentity userIdentity)
userIdentity - The user identitypublic User getUserByEmail(String populationId, String email)
populationId - The population idemail - The emailprivate Request _getRequest()
public void saxUserIdentity(UserIdentity userIdentity, ContentHandler handler) throws SAXException
userIdentity - The user identity to SAXhandler - The content handlerSAXException - If a SAX error occurspublic void saxUserIdentity(UserIdentity userIdentity, ContentHandler handler, String tagName) throws SAXException
userIdentity - The user identity to SAXhandler - The content handlertagName - The XML tag for saxed userSAXException - If a SAX error occurspublic void saxUser(User user, ContentHandler handler) throws SAXException
user - The user. If null no sax events will be generated.handler - The content handlerSAXException - If a SAX error occurspublic void saxUser(User user, ContentHandler handler, String tagName) throws SAXException
user - The user. If null no sax events will be generated.handler - The content handlertagName - The XML tag for saxed userSAXException - If a SAX error occurs