|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.microsoft.tfs.core.util.UserNameUtil
public class UserNameUtil
UserNameUtil contains static utility methods for working with TFS /
Windows user names.
Equivalent to: Microsoft.TeamFoundation.Common.UserNameUtil
| Nested Class Summary | |
|---|---|
static class |
UserNameUtil.ParsedUserName
Represents a parsed user name's two components: domain and account name. |
| Field Summary | |
|---|---|
static char |
DOMAIN_SEPARATOR
|
| Constructor Summary | |
|---|---|
UserNameUtil()
|
|
| Method Summary | |
|---|---|
static int |
compare(java.lang.String username1,
java.lang.String username2)
Does a compare of two usernames / domains. |
static boolean |
equals(java.lang.String username1,
java.lang.String username2)
Compares two usernames / domains for equality. |
static java.lang.String |
format(java.lang.String username,
java.lang.String domain)
Formats the specified user account name and domain name. |
static java.lang.String |
getCurrentUserDomain()
Obtains the current user domain for this process, if available. |
static java.lang.String |
getCurrentUserName()
Obtains the current user name for this process, if available. |
static java.lang.String |
getDomain(java.lang.String userName)
Gets the domain portion of the specified user name. |
static void |
getIdentityName(java.lang.String identityType,
java.lang.String displayName,
java.lang.String attribute,
java.lang.String attribute2,
int uniqueUserID,
java.util.concurrent.atomic.AtomicReference<java.lang.String> outResolvableName,
java.util.concurrent.atomic.AtomicReference<java.lang.String> outDisplayableName)
|
static java.lang.String |
getName(java.lang.String userName)
Gets the name-only (no domain) portion of the specified user name. |
static boolean |
hasDomain(java.lang.String userName)
Tests whether the given user name contains a domain. |
static boolean |
isComplete(java.lang.String userName)
Tests whether the given user name is complete (contains a domain separator or equals the authenticated user constant). |
static java.lang.String |
makeComplete(java.lang.String userName,
java.lang.String relative,
boolean allowAuthenticatedUserConstant)
Completes the specified user name. |
static java.util.Comparator<java.lang.String> |
newUsernameComparator()
|
static UserNameUtil.ParsedUserName |
parse(java.lang.String userName)
Parses the specified user name, returning a UserNameUtil.ParsedUserName object
that contains the user and domain portions. |
static java.lang.String |
removeDomain(java.lang.String userName)
Removes the domain portion from the specified user name, if present. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final char DOMAIN_SEPARATOR
92| Constructor Detail |
|---|
public UserNameUtil()
| Method Detail |
|---|
public static java.lang.String getCurrentUserName()
null if not availablepublic static java.lang.String getCurrentUserDomain()
null if not available
public static boolean equals(java.lang.String username1,
java.lang.String username2)
username1 - the first username to compare (must not be null)username2 - the second username to compare (must not be null)
true if the two usernames are equal
public static int compare(java.lang.String username1,
java.lang.String username2)
username1 - the first username (must not be null)username2 - the second username (must not be null)
public static java.util.Comparator<java.lang.String> newUsernameComparator()
Comparator that uses the
compare(String, String) method to sort usernames /
domains (never null)public static boolean hasDomain(java.lang.String userName)
userName - the user name to test (must not be null)
true if the specified user name contains a domainpublic static java.lang.String getDomain(java.lang.String userName)
userName - the user name to get the domain for (must not be null
)
null if there is no domain
portionpublic static java.lang.String getName(java.lang.String userName)
userName - the user name to get the name for (must not be null)
null)
public static void getIdentityName(java.lang.String identityType,
java.lang.String displayName,
java.lang.String attribute,
java.lang.String attribute2,
int uniqueUserID,
java.util.concurrent.atomic.AtomicReference<java.lang.String> outResolvableName,
java.util.concurrent.atomic.AtomicReference<java.lang.String> outDisplayableName)
public static boolean isComplete(java.lang.String userName)
userName - the user name to test (must not be null or empty)
public static java.lang.String makeComplete(java.lang.String userName,
java.lang.String relative,
boolean allowAuthenticatedUserConstant)
.) and allowAuthenticatedUserConstant
is true, the specified user name is returnedrelative argument is non-
null, the domain is either the relative
argument or the domain portion of the relative argumentgetCurrentUserDomain()), that is used as the domain
userName - the user name to complete (must not be null or empty)relative - the relative argument (can be null)allowAuthenticatedUserConstant - true to allow usernames that are equal to the
authenticated user constant
null)
public static java.lang.String format(java.lang.String username,
java.lang.String domain)
DOMAIN\\user).
username - the user account portion (must not be null)domain - the domain portion (may be null)
public static java.lang.String removeDomain(java.lang.String userName)
userName - user name to parse (must not be null)
public static UserNameUtil.ParsedUserName parse(java.lang.String userName)
UserNameUtil.ParsedUserName object
that contains the user and domain portions.
userName - the user name to parse (must not be null)
null)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||