Class UserAccount

All Implemented Interfaces:
Persistable<UserAccount.UserAccountIdentifier>

@Entity public class UserAccount extends AbstractAggregateRoot<UserAccount.UserAccountIdentifier>
A user account aggregate.
Author:
Oliver Gierke, Paul Henke
  • Method Details

    • getId

      Returns the unique identifier of this UserAccount.
      Returns:
      will never be null
    • add

      public boolean add(Role role)
      Adds a Role to the UserAccount.
      Parameters:
      role - role which the user will receive, must not be null.
      Returns:
      true if successful, false otherwise.
    • remove

      public boolean remove(Role role)
      Removes a Role from a UserAccount.
      Parameters:
      role - role which will be removed from user, must not be null.
      Returns:
      true if successful, false otherwise.
    • hasRole

      public boolean hasRole(Role role)
      Checks if a UserAccount has a specific Role
      Parameters:
      role - Role for which the user will be checked for, must not be null.
      Returns:
      true if role was granted to user
    • getRoles

      public Streamable<Role> getRoles()
      Returns:
      A Streamable with all Roles of the user
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getPassword

      public Password.EncryptedPassword getPassword()
    • getFirstname

      public String getFirstname()
    • getLastname

      public String getLastname()
    • setFirstname

      public UserAccount setFirstname(String firstname)
      Returns:
      this.
    • setLastname

      public UserAccount setLastname(String lastname)
      Returns:
      this.
    • getEmail

      public String getEmail()
    • setEmail

      public UserAccount setEmail(String email)
      Returns:
      this.
    • getUsername

      public String getUsername()
    • setUsername

      public UserAccount setUsername(String username)
      Returns:
      this.
    • isEnabled

      public boolean isEnabled()
    • setEnabled

      public UserAccount setEnabled(boolean enabled)
      Returns:
      this.