com.atlassian.jira.user
Interface ApplicationUser

All Superinterfaces:
Principal
All Known Implementing Classes:
DelegatingApplicationUser, MockApplicationUser

public interface ApplicationUser
extends Principal

Represents a person who uses JIRA. This differs from a User, which represents a user in a user directory. An ApplicationUser encompasses all users with the same username (ignoring case) across all directories.

Note that the v6.0 version of this interface differs from the v5.x experimental version in one important regard: the v5.x version extended the User interface. Unfortunately, the two interfaces have incompatible contracts for equals, so they have been divided.

This incompatibility could lead, for example, to duplicate members in a Set if you were to mix the two implementations. Developers writing plugins that target JIRA 5.x should be careful not to mix ApplicationUser objects with other implementations of User; otherwise, unexpected results can occur (and it won't be compatible with 6.0).

ApplicationUsers is a utility class that allows you to easily switch between ApplicationUser and User. If you want to access the mapping between user keys and usernames directly, use the UserKeyService.

Since:
v5.1.1
See Also:
ApplicationUsers, UserKeyService

Method Summary
 boolean equals(Object obj)
          Implementations must ensure equality based on getKey().
 long getDirectoryId()
           
 com.atlassian.crowd.embedded.api.User getDirectoryUser()
           
 String getDisplayName()
          Returns the display name of the user.
 String getEmailAddress()
           
 String getKey()
          Returns the key which distinguishes the ApplicationUser as unique.
 String getName()
          Synonym for getUsername() and implementation of Principal.getName().
 String getUsername()
           
 int hashCode()
          Implementations must produce a hashcode based on getKey().
 boolean isActive()
           
 
Methods inherited from interface java.security.Principal
toString
 

Method Detail

getKey

String getKey()
Returns the key which distinguishes the ApplicationUser as unique. The same key is shared by all Users with the same username (ignoring case) across all user directories.

Returns:
the key which distinguishes the ApplicationUser as unique

getUsername

String getUsername()
Returns:
the username (login) of the user; must never be null.
See Also:
getName()

getName

String getName()
Synonym for getUsername() and implementation of Principal.getName().

Specified by:
getName in interface Principal
Returns:
the username (login) of the user; must never be null.
See Also:
getUsername()

getDirectoryId

long getDirectoryId()
Returns:
the ID of the user directory that this user comes from.

isActive

boolean isActive()
Returns:
true if this user is active.

getEmailAddress

String getEmailAddress()
Returns:
email address of the user.

getDisplayName

String getDisplayName()
Returns the display name of the user. This is sometimes referred to as "full name".

Returns:
display name of the user, must never be null.

getDirectoryUser

com.atlassian.crowd.embedded.api.User getDirectoryUser()
Returns:
the user as seen by the particular user directory that this User is defined in.

equals

boolean equals(Object obj)
Implementations must ensure equality based on getKey().

Specified by:
equals in interface Principal
Overrides:
equals in class Object
Parameters:
obj - object to compare to.
Returns:
true if and only if the key matches.

hashCode

int hashCode()
Implementations must produce a hashcode based on getKey().

Specified by:
hashCode in interface Principal
Overrides:
hashCode in class Object
Returns:
hashcode.


Copyright © 2002-2014 Atlassian. All Rights Reserved.