Perforce

com.perforce.api
Class User

java.lang.Object
  |
  +--com.perforce.api.SourceControlObject
        |
        +--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/08/05 $ $Revision: #6 $
Author:
David Markley
See Also:
HashDecay

Constructor Summary
User()
          Default no-argument constructor.
User(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
 String getEmail()
          Returns the e-mail address for this user.
 String getFullName()
          Returns the full name of this user.
 String getId()
          Returns the id for this user.
static User getUser(Env env, String uid)
          Gets the user information for the specified user.
static Enumeration getUsers()
          Returns an Enumeration of all User objects.
static Enumeration getUsers(Env env)
          Returns an Enumeration of all User objects.
 void setEmail(String email)
          Sets the e-mail address for this user.
 void setFullName(String fullname)
          Sets the full name of this user.
 void setId(String id)
          Sets the id for this user.
 void sync()
          Synchronizes the user information with P4.
 void sync(String id)
          Synchronizes the user information with P4.
 String toString()
           
 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(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

commit

public void commit()
TBD: The commit method is not working yet.
Overrides:
commit in class SourceControlObject

getCache

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

getEmail

public String getEmail()
Returns the e-mail address for this user.
Returns:
Email address for the user.

getFullName

public String getFullName()
Returns the full name of this user.
Returns:
The full name for the user.

getId

public String getId()
Returns the id for this user.
Returns:
Id for the user.

getUser

public static User getUser(Env env,
                           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.

getUsers

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

getUsers

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

setEmail

public void setEmail(String email)
Sets the e-mail address for this user.
Parameters:
email - Email address for the user.

setFullName

public void setFullName(String fullname)
Sets the full name of this user.
Parameters:
fullname - The full name for the user.

setId

public void setId(String id)
Sets the id for this user.
Parameters:
id - Id for the user.

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.
Overrides:
sync in class SourceControlObject

sync

public void sync(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.

toString

public String toString()
Overrides:
toString in class Object

toXML

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

Perforce

Copyright © 2001, Perforce Software, All rights reserved.