Perforce

com.perforce.api
Class Job

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

public final class Job
extends SourceControlObject

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

Version:
$Date: 2006/06/11 $ $Revision: #1 $
Author:
David Markley

Field Summary
static int CLOSED
          Indicates that the Job is closed.
static int OPEN
          Indicates that the Job is open.
static int SUSPENDED
          Indicates that the Job is suspended.
 
Constructor Summary
Job()
           
Job(Env env)
          Default no-argument constructor.
Job(Env env, String name)
           
Job(String name)
          Constructor that accepts the job number.
 
Method Summary
 void commit()
          Stores this object back into Perforce, creating it if it didn't already exist.
static void fix(Env env, String changelist, boolean del, String job)
           
static void fix(Env env, String changelist, boolean del, Vector jobs)
           
 HashDecay getCache()
          Returns the HashDecay instance for this class
static Change[] getChangeFixes(Env env, String jobname, String[] files)
          Returns an array of changes that are fixed by the named job, limited to the list of files if specified.
 Change[] getChanges()
           
 String getDescription()
          Returns the description for the Job.
 String getField(String name)
           
 Enumeration getFieldNames()
           
 Vector getFileEntries()
           
static Job getJob(Env env, String name)
          Returns the job with the specified name.
static Job getJob(String name)
          Returns the job with the specified name.
static Job[] getJobFixes(Env env, String change, String[] files)
          Returns an array of jobs that fix the specified change, limited to the list of files if specified.
static Job[] getJobs(Env env)
           
static Job[] getJobs(Env env, String jobview, int max, boolean use_integs, String[] files)
           
 String getModtimeString()
          Returns the job's modification time
 String getName()
          Returns the name of this Job.
 int getStatus()
          Returns the status for the Job.
 String getStatusName()
           
 String getUser()
          Returns the User that owns this Job.
 void removeFix(int changelist)
           
 void setDescription(String description)
          Sets the description for the job.
 void setField(String name, String value)
           
 void setModtimeString(String modtime)
          Sets the job's modification time
 void setName(String name)
          Sets the job name for the Job.
 void setStatus(int status)
          Sets status for the Job.
 void setStatus(String status)
          Sets status for the Job.
 void setUser(String user)
          Sets the User that owns this Job.
 void sync()
          Synchronizes the Job with the correct information from P4, using whatever job number has already been set in the Job.
 void sync(String name)
          Sycnhronizes the Job with the correct information from P4.
 String toString()
          Overrides the default toString() method.
 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
 

Field Detail

CLOSED

public static final int CLOSED
Indicates that the Job is closed.

OPEN

public static final int OPEN
Indicates that the Job is open.

SUSPENDED

public static final int SUSPENDED
Indicates that the Job is suspended.
Constructor Detail

Job

public Job()

Job

public Job(Env env)
Default no-argument constructor.

Job

public Job(Env env,
           String name)

Job

public Job(String name)
Constructor that accepts the job number. This job is not populated with the correct information until the sync() method is called on it.
Parameters:
name - Job name
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

fix

public static void fix(Env env,
                       String changelist,
                       boolean del,
                       String job)

fix

public static void fix(Env env,
                       String changelist,
                       boolean del,
                       Vector jobs)

getCache

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

getChangeFixes

public static Change[] getChangeFixes(Env env,
                                      String jobname,
                                      String[] files)
Returns an array of changes that are fixed by the named job, limited to the list of files if specified.
Parameters:
env - Perforce environment to use.
jobname - Named job to get fixes for.
files - array of files (including wildcards) used to limit to lookup.
Returns:
array of changes fixed by the named job.

getChanges

public Change[] getChanges()
Returns:
Array of changes that are fixed by this job.

getDescription

public String getDescription()
Returns the description for the Job. 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.

getField

public String getField(String name)

getFieldNames

public Enumeration getFieldNames()

getFileEntries

public Vector getFileEntries()

getJob

public static Job getJob(Env env,
                         String name)
Returns the job with the specified name.

getJob

public static Job getJob(String name)
Returns the job with the specified name.

getJobFixes

public static Job[] getJobFixes(Env env,
                                String change,
                                String[] files)
Returns an array of jobs that fix the specified change, limited to the list of files if specified.
Parameters:
env - Perforce environment to use.
change - Change number (as a String) to lookup jobs for.
files - array of files (including wildcards) used to limit to lookup.
Returns:
array of jobs that fix the specified change.

getJobs

public static Job[] getJobs(Env env)

getJobs

public static Job[] getJobs(Env env,
                            String jobview,
                            int max,
                            boolean use_integs,
                            String[] files)

getModtimeString

public String getModtimeString()
Returns the job's modification time

getName

public String getName()
Returns the name of this Job.

getStatus

public int getStatus()
Returns the status for the Job. This can be either OPEN, CLOSED, or SUSPENDED.

getStatusName

public String getStatusName()

getUser

public String getUser()
Returns the User that owns this Job.

removeFix

public void removeFix(int changelist)

setDescription

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

setField

public void setField(String name,
                     String value)

setModtimeString

public void setModtimeString(String modtime)
Sets the job's modification time

setName

public void setName(String name)
Sets the job name for the Job. This invalidates all the other data for the Job.
Parameters:
name - Job name

setStatus

public void setStatus(int status)
Sets status for the Job. This can be either OPEN, CLOSED, or SUSPENDED.

setStatus

public void setStatus(String status)
Sets status for the Job. This can be either OPEN, CLOSED, or SUSPENDED.

setUser

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

sync

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

sync

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

toString

public String toString()
Overrides the default toString() method.
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.