com.atlassian.crowd.integration.rest.entity
Class UserEntity

java.lang.Object
  extended by com.atlassian.crowd.integration.rest.entity.UserEntity
All Implemented Interfaces:
Attributes, User, UserWithAttributes, DirectoryEntity, Comparable<User>, Principal

public class UserEntity
extends Object
implements UserWithAttributes

Represents a User entity.

Since:
v2.1

Constructor Summary
UserEntity(String name, String firstName, String lastName, String displayName, String emailAddress, PasswordEntity password, boolean active)
           
 
Method Summary
 int compareTo(User user)
          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().
 MultiValuedAttributeEntityList getAttributes()
           
 long getDirectoryId()
           
 String getDisplayName()
           
 String getEmailAddress()
           
 String getFirstName()
           
 Set<String> getKeys()
          Gets all the keys of the attributes.
 String getLastName()
           
 String getName()
           
 PasswordEntity getPassword()
           
 String getValue(String key)
          Returns any value associated with the given key, returns null if there is no value.
 Set<String> getValues(String key)
          Get all the values associated with a given key.
 int hashCode()
          Implementations must produce a hashcode based on getDirectoryId() and case-insensitive getName().
 boolean isActive()
           
 boolean isEmpty()
           
static UserEntity newMinimalInstance(String username)
          Creates a new minimal user instance.
 void setAttributes(MultiValuedAttributeEntityList attributes)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UserEntity

public UserEntity(String name,
                  String firstName,
                  String lastName,
                  String displayName,
                  String emailAddress,
                  PasswordEntity password,
                  boolean active)
Method Detail

getDisplayName

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

getFirstName

public String getFirstName()

getLastName

public String getLastName()

getEmailAddress

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

getPassword

public PasswordEntity getPassword()

isActive

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

getName

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

setAttributes

public void setAttributes(MultiValuedAttributeEntityList attributes)

getAttributes

public MultiValuedAttributeEntityList getAttributes()

getValues

public Set<String> getValues(String key)
Description copied from interface: Attributes
Get all the values associated with a given key. Duplicate values are not allowed, and this should be enforced case-insensitively to match the behaviour of LDAP servers. Will return null if the key does not exist.

Specified by:
getValues in interface Attributes
Parameters:
key - the key to retrieve the values for
Returns:
the values associated with the given key, or null if the key does not exist.

getValue

public String getValue(String key)
Description copied from interface: Attributes
Returns any value associated with the given key, returns null if there is no value.

Specified by:
getValue in interface Attributes
Parameters:
key - the key to retrieve the value for
Returns:
any value associated with the given key, or null if there is no value

getKeys

public Set<String> getKeys()
Description copied from interface: Attributes
Gets all the keys of the attributes. Warning: case-insensitive keys are currently no enforced, however this is the case for LDAP, so this may be implemented in the future.

Specified by:
getKeys in interface Attributes
Returns:
a set of all the keys.

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Attributes
Returns:
true if there are no attributes

getDirectoryId

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

compareTo

public int compareTo(User user)
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>

equals

public boolean equals(Object o)
Description copied from interface: User
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 name.toLowerCase() of the directory entities match.

hashCode

public int hashCode()
Description copied from interface: User
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.

toString

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

newMinimalInstance

public static UserEntity newMinimalInstance(String username)
Creates a new minimal user instance.

Parameters:
username - username for the user
Returns:
minimal user instance


Copyright © 2012 Atlassian. All Rights Reserved.