Perforce

com.perforce.api
Class Change

java.lang.Object
  |
  +--com.perforce.api.SourceControlObject
        |
        +--com.perforce.api.Change
All Implemented Interfaces:
Cacheable

public final class Change
extends SourceControlObject

Representation of a source control change. This class can be used to determine information for a particular p4 change. It can be constructed using the change number, but will not contain any additional change information until the sync() method is called.

Version:
$Date: 2001/11/02 $ $Revision: #2 $
Author:
David Markley

Field Summary
static int PENDING
          Indicates that the Change is pending submission.
static int SUBMITTED
          Indicates that the Change has been submitted.
 
Constructor Summary
Change()
          Default no-argument constructor.
Change(Env environ)
           
Change(int number)
          Constructor that accepts the change number.
Change(String number)
           
 
Method Summary
 void commit()
          Stores this object back into Perforce, creating it if it didn't already exist.
 String deleteEmptyChange()
          Deletes the Changelist if it is empty.
 HashDecay getCache()
           
static Change getChange(Env env, int number, boolean force)
           
static Change getChange(Env env, String number, boolean force)
           
static Change getChange(int number)
           
static Change getChange(int number, boolean force)
           
static Change getChange(String number)
           
static Change getChange(String number, boolean force)
           
static Change[] getChanges(Env env, String path)
           
static Change[] getChanges(Env env, String path, int max, String start, String end, boolean use_integs, String ufilter)
           
static Change[] getChanges(String path)
           
 String getClientName()
           
 String getDescription()
          Returns the description for the Change.
 Vector getFileEntries()
           
 Vector getFiles()
          Returns a Vector filled with the files (including revision numbers) that were affected by this change.
 String getModtimeString()
           
 int getNumber()
          Returns the number of this Change.
 String getShortDescription()
           
 String getShortDescription(boolean blurb)
           
 int getStatus()
          Returns the status for the Change.
 User getUser()
          Returns the User that owns this Change.
static void main(String[] argv)
           
 String resolve(boolean force)
           
 void setClientName(String name)
           
 void setDescription(String description)
          Sets the description for the change.
 void setModtimeString(String modtime)
           
 void setNumber(int number)
          Sets the change number for the Change.
 void setStatus(int status)
          Sets status for the Change.
 void setUser(User user)
          Sets the User that owns this Change.
 String submit()
          Submits the change, if it is pending.
 void sync()
          Synchronizes the Change with the correct information from P4, using whatever change number has already been set in the Change.
 void sync(int number)
          Sycnhronizes the Change with the correct information from P4.
 String toString()
          Overrides the default toString() method.
 
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
 

Field Detail

PENDING

public static final int PENDING
Indicates that the Change is pending submission.

SUBMITTED

public static final int SUBMITTED
Indicates that the Change has been submitted.
Constructor Detail

Change

public Change()
Default no-argument constructor.

Change

public Change(Env environ)

Change

public Change(int number)
Constructor that accepts the change number. This change is not populated with the correct information until the sync() method is called on it.
Parameters:
number - Change number

Change

public Change(String number)
Method Detail

commit

public void commit()
            throws CommitException
Description copied from class: SourceControlObject
Stores this object back into Perforce, creating it if it didn't already exist.
Overrides:
commit in class SourceControlObject

deleteEmptyChange

public String deleteEmptyChange()
                         throws PerforceException
Deletes the Changelist if it is empty.
Returns:
String Contents of the information returned by P4 as a result of the delete call.

getCache

public HashDecay getCache()
Overrides:
getCache in class SourceControlObject

getChange

public static Change getChange(Env env,
                               int number,
                               boolean force)

getChange

public static Change getChange(Env env,
                               String number,
                               boolean force)

getChange

public static Change getChange(int number)

getChange

public static Change getChange(int number,
                               boolean force)

getChange

public static Change getChange(String number)

getChange

public static Change getChange(String number,
                               boolean force)

getChanges

public static Change[] getChanges(Env env,
                                  String path)

getChanges

public static Change[] getChanges(Env env,
                                  String path,
                                  int max,
                                  String start,
                                  String end,
                                  boolean use_integs,
                                  String ufilter)

getChanges

public static Change[] getChanges(String path)

getClientName

public String getClientName()

getDescription

public String getDescription()
Returns the description for the Change. This description includes not only the textual description provided by the user, but also the list of affected files and how they were affected. The String returned includes newline characters.

getFileEntries

public Vector getFileEntries()

getFiles

public Vector getFiles()
Returns a Vector filled with the files (including revision numbers) that were affected by this change. What was done to each file as a result of this Change is stripped off. This method uses the value of the Change's description to determine the files that are affected.
Returns:
Vector of files affected.

getModtimeString

public String getModtimeString()

getNumber

public int getNumber()
Returns the number of this Change.

getShortDescription

public String getShortDescription()

getShortDescription

public String getShortDescription(boolean blurb)

getStatus

public int getStatus()
Returns the status for the Change. This can be either PENDING or SUBMITTED.

getUser

public User getUser()
Returns the User that owns this Change.

main

public static void main(String[] argv)

resolve

public String resolve(boolean force)
               throws PerforceException

setClientName

public void setClientName(String name)

setDescription

public void setDescription(String description)
Sets the description for the change.

setModtimeString

public void setModtimeString(String modtime)

setNumber

public void setNumber(int number)
Sets the change number for the Change. This invalidates all the other data for the Change.
Parameters:
number - Change number

setStatus

public void setStatus(int status)
Sets status for the Change. This can be either PENDING or SUBMITTED.

setUser

public void setUser(User user)
Sets the User that owns this Change.
Parameters:
user - Owning user.

submit

public String submit()
              throws SubmitException
Submits the change, if it is pending.
Throws:
SubmitException - If the submit fails.

sync

public void sync()
Synchronizes the Change with the correct information from P4, using whatever change number has already been set in the Change. After this method is called, all the information in the Change is valid.
Overrides:
sync in class SourceControlObject

sync

public void sync(int number)
Sycnhronizes the Change with the correct information from P4. After this method is called, all the information in the Change is valid.
Parameters:
number - Change number

toString

public String toString()
Overrides the default toString() method.
Overrides:
toString in class Object

Perforce

Copyright © 2001, Perforce Software, All rights reserved.