Class User

java.lang.Object
org.ametys.core.user.User
All Implemented Interfaces:
Principal

public class User extends Object implements Principal
Implementation of the principal abstraction to represent an user with a login and eventually a fullname and an email.
  • Field Details

  • Constructor Details

    • User

      public User(String login, String populationId)
      Construct a new UserPrincipal, associated with the specified login et population id.
      Parameters:
      login - The login of the principal.
      populationId - The id of the population
    • User

      public User(UserIdentity identity)
      Construct a new UserPrincipal, associated with the specified identity.
      Parameters:
      identity - The identity of this user. Cannot be null
    • User

      public User(UserIdentity identity, String lastName, String firstName, String email, UserDirectory userDirectory)
      Construct a new UserPrincipal, associated with a last name, a first name, an email and identified by a login.
      Parameters:
      identity - The identity of this user. Cannot be null
      lastName - The last name
      firstName - The first name
      email - The email
      userDirectory - The user directory the use rbelongs to. Can be null.
    • User

      public User(UserIdentity identity, String lastName, String firstName, String email, UserDirectory userDirectory, ZonedDateTime creationDate, User.UserCreationOrigin creationOrigin)
      Construct a new UserPrincipal, associated with a last name, a first name, an email and identified by a login.
      Parameters:
      identity - The identity of this user. Cannot be null
      lastName - The last name
      firstName - The first name
      email - The email
      creationDate - the creation date
      creationOrigin - the creation origin
      userDirectory - The user directory the use rbelongs to. Can be null.
  • Method Details

    • getIdentity

      The identity of the user.
      Returns:
      The identity.
    • getName

      public String getName()
      Specified by:
      getName in interface Principal
    • getLastName

      public String getLastName()
      The last name of the user
      Returns:
      The last name.
    • getFirstName

      public String getFirstName()
      The first name of the user
      Returns:
      The first name.
    • getEmail

      public String getEmail()
      The email of the user represented by this Principal.
      Returns:
      The email.
    • getFullName

      public String getFullName()
      The fullname of this user.
      Returns:
      The full name
    • getSortableName

      The fullname to use to display if sort is needed. Ensure the sort will be on
      Returns:
      The sortable name
    • getUserDirectory

      The user directory this user belongs to.
      Returns:
      The user directory
    • getCreationDate

      Get the user's creation date
      Returns:
      the creation date
    • getCreationOrigin

      Get the user's creation origin
      Returns:
      the creation origin
    • _getFullName

      protected String _getFullName(boolean firstLast)
      The full name of the user represented by this Principal.
      Parameters:
      firstLast - Define the name order if the full name. If true, first name then last name. If false, the contrary.
      Returns:
      The full name.
    • toString

      public String toString()
      Return a String representation of this object, which exposes only information that should be public.
      Specified by:
      toString in interface Principal
      Overrides:
      toString in class Object
      Returns:
      A string representing the user.
    • equals

      public boolean equals(Object another)
      Test if two principal are equals.
      Specified by:
      equals in interface Principal
      Overrides:
      equals in class Object
      Returns:
      true if the given Object represents the same Principal.
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Principal
      Overrides:
      hashCode in class Object