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.

Version:
$Date: 2001/11/02 $ $Revision: #1 $
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()
          Stores this object back into Perforce, creating it if it didn't already exist.
 HashDecay getCache()
           
 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)
           
static User getUser(String uid)
          Gets the user information for the specified user.
static Enumeration getUsers()
           
static Enumeration getUsers(Env env)
           
static void main(String[] argv)
           
 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()
           
 
Methods inherited from class com.perforce.api.SourceControlObject
clearCache, getEnv, getSyncTime, getUpdateTime, inSync, invalidate, outOfSync, refreshUpdateTime, setEnv, toXML
 
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()
Description copied from class: SourceControlObject
Stores this object back into Perforce, creating it if it didn't already exist.
Overrides:
commit in class SourceControlObject

getCache

public HashDecay getCache()
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)

getUser

public static User getUser(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:
uid - The user id of the user information to get from p4.

getUsers

public static Enumeration getUsers()

getUsers

public static Enumeration getUsers(Env env)

main

public static void main(String[] argv)

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

Perforce

Copyright © 2001, Perforce Software, All rights reserved.