com.perforce.api
Class User

java.lang.Object
  extended by com.perforce.api.SourceControlObject
      extended by com.perforce.api.User
All Implemented Interfaces:
Cacheable

public final class User
extends SourceControlObject

Representation of a source control user. Each instance can store one p4 user's information. The class methods can be used to get a particular user. If that user has been gotten before, their user information will not be reloaded from P4. It is instead loaded from an internal HashDecay.

If the user information must be up to date, then the sync() method must be called.

TBD: The current implementation does NOT handle the "reviews" information for each user. Should User extend Mapping?

Version:
$Date: 2002/05/16 $ $Revision: #2 $
Author:
David Markley
See Also:
HashDecay

Constructor Summary
User()
          Default no-argument constructor.
User(java.lang.String id)
          Constructor that accepts the id of the user.
 
Method Summary
 void commit()
          TBD: The commit method is not working yet.
 HashDecay getCache()
          Returns the HashDecay instance for this class
 java.lang.String getEmail()
          Returns the e-mail address for this user.
 java.lang.String getFullName()
          Returns the full name of this user.
 java.lang.String getId()
          Returns the id for this user.
static User getUser(Env env, java.lang.String uid)
          Gets the user information for the specified user.
static User getUser(java.lang.String uid)
          Deprecated. Use method with Env parameter.
static java.util.Enumeration getUsers()
          Returns an Enumeration of all User objects.
static java.util.Enumeration getUsers(Env env)
          Returns an Enumeration of all User objects.
static void main(java.lang.String[] argv)
          Deprecated. Actually in use, but this keeps it out of the docs.
 void setEmail(java.lang.String email)
          Sets the e-mail address for this user.
 void setFullName(java.lang.String fullname)
          Sets the full name of this user.
 void setId(java.lang.String id)
          Sets the id for this user.
 void sync()
          Synchronizes the user information with P4.
 void sync(java.lang.String id)
          Synchronizes the user information with P4.
 java.lang.String toString()
           
 java.lang.String toXML()
          Returns a string containing the object in XML form.
 
Methods inherited from class com.perforce.api.SourceControlObject
clearCache, getEnv, getSyncTime, getUpdateTime, inSync, invalidate, outOfSync, refreshUpdateTime, setEnv
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

User

public User()
Default no-argument constructor.


User

public User(java.lang.String id)
Constructor that accepts the id of the user. This simply creates an instance that has the id set. No other information in the class will be present until the sync() method is called.

Parameters:
id - Id for the user.
Method Detail

getCache

public HashDecay getCache()
Description copied from class: SourceControlObject
Returns the HashDecay instance for this class

Specified by:
getCache in interface Cacheable
Specified by:
getCache in class SourceControlObject

setId

public void setId(java.lang.String id)
Sets the id for this user.

Parameters:
id - Id for the user.

getUsers

public static java.util.Enumeration getUsers()
Returns an Enumeration of all User objects.


getUsers

public static java.util.Enumeration getUsers(Env env)
Returns an Enumeration of all User objects.


getUser

public static User getUser(java.lang.String uid)
Deprecated. Use method with Env parameter.

Gets the user information for the specified user. If that user has been gotten before, their user information will not be reloaded from P4. It is instead loaded from an internal HashDecay.

If the user information must be up to date, then the sync() method must be called.

Parameters:
uid - User id that is requested.

getUser

public static User getUser(Env env,
                           java.lang.String uid)
Gets the user information for the specified user. If that user has been gotten before, their user information will not be reloaded from P4. It is instead loaded from an internal HashDecay.

If the user information must be up to date, then the sync() method must be called.

Parameters:
env - Source control environment to use.
uid - The user id of the user information to get from p4.

getId

public java.lang.String getId()
Returns the id for this user.

Returns:
Id for the user.

setEmail

public void setEmail(java.lang.String email)
Sets the e-mail address for this user.

Parameters:
email - Email address for the user.

getEmail

public java.lang.String getEmail()
Returns the e-mail address for this user.

Returns:
Email address for the user.

setFullName

public void setFullName(java.lang.String fullname)
Sets the full name of this user.

Parameters:
fullname - The full name for the user.

getFullName

public java.lang.String getFullName()
Returns the full name of this user.

Returns:
The full name for the user.

commit

public void commit()
TBD: The commit method is not working yet.

Specified by:
commit in interface Cacheable
Specified by:
commit in class SourceControlObject

sync

public void sync(java.lang.String id)
Synchronizes the user information with P4. This method must be called to ensure that this contains the latest information from p4. This form of the method can be used to change the user Id in at the same time.

Parameters:
id - The user id for this to synchronize from p4.

sync

public void sync()
Synchronizes the user information with P4. This method must be called to ensure that this contains the latest information from p4.

Specified by:
sync in interface Cacheable
Specified by:
sync in class SourceControlObject

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toXML

public java.lang.String toXML()
Description copied from class: SourceControlObject
Returns a string containing the object in XML form.

Specified by:
toXML in class SourceControlObject

main

public static void main(java.lang.String[] argv)
Deprecated. Actually in use, but this keeps it out of the docs.

Used for testing.



Copyright © 2010. All Rights Reserved.