com.atlassian.crowd.model.user
Class UserTemplate

java.lang.Object
  extended by com.atlassian.crowd.model.user.UserTemplate
All Implemented Interfaces:
User, DirectoryEntity, 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:
Serialized Form

Constructor Summary
UserTemplate(String name)
           
UserTemplate(String username, long directoryId)
          Build a template for a new user.
UserTemplate(String username, String firstName, String lastName, String displayName)
           
UserTemplate(User user)
          Build a template from an existing user.
UserTemplate(User user)
          Build a template from an existing user.
 
Method Summary
 int compareTo(User other)
          CompareTo must be compatible with the equals() and hashCode() methods
 boolean equals(Object o)
          Implementations must ensure equality based on getDirectoryId() and case-insensitive getName().
 long getDirectoryId()
           
 String getDisplayName()
           
 String getEmailAddress()
           
 String getFirstName()
           
 String getLastName()
           
 String getName()
           
 int hashCode()
          Implementations must produce a hashcode based on getDirectoryId() and case-insensitive getName().
 boolean isActive()
           
 void setActive(boolean active)
           
 void setDirectoryId(long directoryId)
           
 void setDisplayName(String displayName)
           
 void setEmailAddress(String emailAddress)
           
 void setFirstName(String firstName)
           
 void setLastName(String lastName)
           
 void setName(String name)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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 Detail

setDirectoryId

public void setDirectoryId(long directoryId)

setName

public void setName(String name)

getDirectoryId

public long getDirectoryId()
Specified by:
getDirectoryId in interface User
Specified by:
getDirectoryId in interface DirectoryEntity
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()

setFirstName

public void setFirstName(String firstName)

getLastName

public String getLastName()

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 User
Specified by:
equals in interface DirectoryEntity
Specified by:
equals in interface Principal
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 User
Specified by:
hashCode in interface DirectoryEntity
Specified by:
hashCode in interface Principal
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 User
Specified by:
compareTo in interface Comparable<User>

toString

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


Copyright © 2012 Atlassian. All Rights Reserved.