Class UserTemplate

java.lang.Object
com.atlassian.crowd.model.user.UserTemplate
All Implemented Interfaces:
User, DirectoryEntity, User, Serializable, Comparable<User>, Principal
Direct Known Subclasses:
UserTemplateWithAttributes

public class UserTemplate extends Object implements User, Serializable
A publicly mutable User implementation.

Used to create or update a user.

See Also:
  • Constructor Details

    • UserTemplate

      public UserTemplate(String username, long directoryId)
      Build a template for a new user.

      Used to create a user.

      Parameters:
      username - username of new user.
      directoryId - ID of the directory in which to store the new user.
    • UserTemplate

      public UserTemplate(String name)
    • UserTemplate

      public UserTemplate(User user)
      Build a template from an existing user.

      Used to update a user.

      Parameters:
      user - user to build template from.
    • UserTemplate

      public UserTemplate(String username, String firstName, String lastName, String displayName)
    • UserTemplate

      public UserTemplate(User user)
      Build a template from an existing user.

      Used to update a user.

      Parameters:
      user - user to build template from.
  • Method Details

    • setDirectoryId

      public void setDirectoryId(long directoryId)
    • setName

      public void setName(String name)
    • getDirectoryId

      public long getDirectoryId()
      Specified by:
      getDirectoryId in interface DirectoryEntity
      Specified by:
      getDirectoryId in interface User
      Returns:
      id of the directory in which the DirectoryEntity is stored.
    • isActive

      public boolean isActive()
      Specified by:
      isActive in interface User
      Returns:
      true if and only if the user is allowed to authenticate.
    • setActive

      public void setActive(boolean active)
    • getName

      public String getName()
      Specified by:
      getName in interface DirectoryEntity
      Specified by:
      getName in interface Principal
      Returns:
      name of the entity.
    • getEmailAddress

      public String getEmailAddress()
      Specified by:
      getEmailAddress in interface User
      Returns:
      email address of the user.
    • setEmailAddress

      public void setEmailAddress(String emailAddress)
    • getFirstName

      public String getFirstName()
      Specified by:
      getFirstName in interface User
    • setFirstName

      public void setFirstName(String firstName)
    • getLastName

      public String getLastName()
      Specified by:
      getLastName in interface User
    • setLastName

      public void setLastName(String lastName)
    • getDisplayName

      public String getDisplayName()
      Specified by:
      getDisplayName in interface User
      Returns:
      display name (eg. full name) of the user, must never be null.
    • setDisplayName

      public void setDisplayName(String displayName)
    • equals

      public boolean equals(Object o)
      Description copied from interface: DirectoryEntity
      Implementations must ensure equality based on getDirectoryId() and case-insensitive getName().
      Specified by:
      equals in interface DirectoryEntity
      Specified by:
      equals in interface Principal
      Specified by:
      equals in interface User
      Overrides:
      equals in class Object
      Parameters:
      o - object to compare to.
      Returns:
      true if and only if the directoryId and the lowercase names of the directory entities match.
    • hashCode

      public int hashCode()
      Description copied from interface: DirectoryEntity
      Implementations must produce a hashcode based on getDirectoryId() and case-insensitive getName().
      Specified by:
      hashCode in interface DirectoryEntity
      Specified by:
      hashCode in interface Principal
      Specified by:
      hashCode in interface User
      Overrides:
      hashCode in class Object
      Returns:
      hashcode.
    • compareTo

      public int compareTo(User other)
      Description copied from interface: User
      CompareTo must be compatible with the equals() and hashCode() methods
      Specified by:
      compareTo in interface Comparable<User>
      Specified by:
      compareTo in interface User
    • getExternalId

      public String getExternalId()
      Specified by:
      getExternalId in interface User
    • setExternalId

      public void setExternalId(String externalId)
    • toString

      public String toString()
      Specified by:
      toString in interface Principal
      Overrides:
      toString in class Object