Class UserHelper

All Implemented Interfaces:
LogEnabled, Component, Serviceable

public class UserHelper extends AbstractLogEnabled implements Component, Serviceable
Simple user helper, for common function working on User
  • Field Details

    • ROLE

      public static final String ROLE
      The Avalon role
  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager smanager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Throws:
      ServiceException
    • getUserFullName

      public String getUserFullName(UserIdentity userIdentity)
      Get the user's full name handling request cache
      Parameters:
      userIdentity - The user identity
      Returns:
      user's full name or null if user does not exist
    • getUserSortableName

      public String getUserSortableName(UserIdentity userIdentity)
      Get the user's sortable name handling request cache
      Parameters:
      userIdentity - The user identity
      Returns:
      user's full name or null if user does not exist
    • userIdentities2json

      Populate a list of map, where each map representing an user.
      Parameters:
      users - The list of users
      Returns:
      The list of map.
    • users2json

      Populate a list of map, where each map representing an user.
      Parameters:
      users - The list of users
      Returns:
      The list of map.
    • users2json

      public List<Map<String,Object>> users2json(Collection<User> users, boolean full)
      Populate a list of map, where each map representing an user.
      Parameters:
      users - The list of users
      full - Set to true to get full information on user
      Returns:
      The list of map.
    • users2json

      public List<Map<String,Object>> users2json(Collection<User> users, boolean full, boolean limitedToStoredUserData)
      Populate a list of map, where each map representing an user.
      Parameters:
      users - The list of users
      full - Set to true to get full information on user
      limitedToStoredUserData - Set to true to get the information from the stored user instead of the user
      Returns:
      The list of map.
    • user2json

      public Map<String,Object> user2json(UserIdentity userIdentity)
      Get the JSON object representing a user
      Parameters:
      userIdentity - The user identity
      Returns:
      The user as JSON object
    • user2json

      public Map<String,Object> user2json(UserIdentity userIdentity, boolean full)
      Get the JSON object representing a user
      Parameters:
      userIdentity - The user identity
      full - Set to true to get full information on user
      Returns:
      The user as JSON object
    • user2json

      public Map<String,Object> user2json(UserIdentity userIdentity, boolean full, boolean limitedToStoredUserData)
      Get the JSON object representing a user
      Parameters:
      userIdentity - The user identity
      full - Set to true to get full information on user
      limitedToStoredUserData - Set to true to get the information from the stored user instead of the user
      Returns:
      The user as JSON object
    • user2json

      public Map<String,Object> user2json(User user)
      Get the JSON object representing a user
      Parameters:
      user - The user
      Returns:
      The user as JSON object
    • user2json

      public Map<String,Object> user2json(User user, boolean full)
      Get the JSON object representing a user
      Parameters:
      user - The user
      full - Set to true to get full information on user
      Returns:
      The user as JSON object or null, if the given user is null
    • user2json

      public Map<String,Object> user2json(User user, boolean full, boolean limitedToStoredUserData)
      Get the JSON object representing a user
      Parameters:
      user - The user
      full - Set to true to get full information on user
      limitedToStoredUserData - Set to true to get the information from the stored user instead of the user
      Returns:
      The user as JSON object or null, if the given user is null
    • json2userIdentity

      public UserIdentity json2userIdentity(Map<String,? extends Object> json)
      Get the user identity from a JSON object
      Parameters:
      json - the JSON object representing the user
      Returns:
      the user identity
    • getUser

      @Deprecated public User getUser(UserIdentity userIdentity)
      Deprecated.
      Get the user from its identity
      Parameters:
      userIdentity - The user identity
      Returns:
      The user or null if not found
    • getUserByEmail

      @Deprecated public User getUserByEmail(String populationId, String email)
      Get the user from its email
      Parameters:
      populationId - The population id
      email - The email
      Returns:
      The user or null if not found or if multiple user were found with this email
    • saxUserIdentity

      public void saxUserIdentity(UserIdentity userIdentity, ContentHandler handler) throws SAXException
      SAX an user identity
      Parameters:
      userIdentity - The user identity to SAX
      handler - The content handler
      Throws:
      SAXException - If a SAX error occurs
    • saxUserIdentity

      public void saxUserIdentity(UserIdentity userIdentity, ContentHandler handler, String tagName) throws SAXException
      SAX an user identity
      Parameters:
      userIdentity - The user identity to SAX
      handler - The content handler
      tagName - The XML tag for saxed user
      Throws:
      SAXException - If a SAX error occurs
    • saxUser

      public void saxUser(User user, ContentHandler handler) throws SAXException
      SAX an user
      Parameters:
      user - The user. If null no sax events will be generated.
      handler - The content handler
      Throws:
      SAXException - If a SAX error occurs
    • saxUser

      public void saxUser(User user, ContentHandler handler, String tagName) throws SAXException
      SAX an user
      Parameters:
      user - The user. If null no sax events will be generated.
      handler - The content handler
      tagName - The XML tag for saxed user
      Throws:
      SAXException - If a SAX error occurs
    • xml2userIdentity

      Get the user identity from an XML configuration
      Parameters:
      userConfiguration - The configuration
      Returns:
      The user identity
      Throws:
      ConfigurationException - if an error occurs during value retrieving
    • xml2userIdentity

      Get the user identity from a DOM Node object
      Parameters:
      userNode - The node
      Returns:
      The user identity
      Throws:
      TransformerException - if an error occurs during value retrieving