com.perforce.api
Class Job

java.lang.Object
  extended by com.perforce.api.SourceControlObject
      extended by 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: 2002/08/05 $ $Revision: #2 $
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, java.lang.String name)
           
Job(java.lang.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, java.lang.String changelist, boolean del, java.lang.String job)
           
static void fix(Env env, java.lang.String changelist, boolean del, java.util.Vector jobs)
           
 HashDecay getCache()
          Returns the HashDecay instance for this class
static Change[] getChangeFixes(Env env, java.lang.String jobname, java.lang.String[] files)
          Returns an array of changes that are fixed by the named job, limited to the list of files if specified.
 Change[] getChanges()
           
 java.lang.String getDescription()
          Returns the description for the Job.
 java.lang.String getField(java.lang.String name)
           
 java.util.Enumeration getFieldNames()
           
 java.util.Vector getFileEntries()
           
static Job getJob(Env env, java.lang.String name)
          Returns the job with the specified name.
static Job getJob(java.lang.String name)
          Returns the job with the specified name.
static Job[] getJobFixes(Env env, java.lang.String change, java.lang.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, java.lang.String jobview, int max, boolean use_integs, java.lang.String[] files)
           
 java.lang.String getModtimeString()
          Returns the job's modification time
 java.lang.String getName()
          Returns the name of this Job.
 int getStatus()
          Returns the status for the Job.
 java.lang.String getStatusName()
           
 java.lang.String getUser()
          Returns the User that owns this Job.
static void main(java.lang.String[] args)
          Deprecated. Actually in use, but this keeps it out of the docs.
 void removeFix(int changelist)
           
 void setDescription(java.lang.String description)
          Sets the description for the job.
 void setField(java.lang.String name, java.lang.String value)
           
 void setModtimeString(java.lang.String modtime)
          Sets the job's modification time
 void setName(java.lang.String name)
          Sets the job name for the Job.
 void setStatus(int status)
          Sets status for the Job.
 void setStatus(java.lang.String status)
          Sets status for the Job.
 void setUser(java.lang.String user)
          Sets the User that owns this Job.
 void store()
          Deprecated. Use commit() instead.
 void sync()
          Synchronizes the Job with the correct information from P4, using whatever job number has already been set in the Job.
 void sync(java.lang.String name)
          Sycnhronizes the Job with the correct information from P4.
 java.lang.String toString()
          Overrides the default toString() method.
 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
 

Field Detail

OPEN

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

See Also:
Constant Field Values

CLOSED

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

See Also:
Constant Field Values

SUSPENDED

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

See Also:
Constant Field Values
Constructor Detail

Job

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


Job

public Job(java.lang.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

Job

public Job()

Job

public Job(Env env,
           java.lang.String name)
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

getJob

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


getJob

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


getModtimeString

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


setModtimeString

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


setName

public void setName(java.lang.String name)
Sets the job name for the Job. This invalidates all the other data for the Job.

Parameters:
name - Job name

getName

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


setUser

public void setUser(java.lang.String user)
Sets the User that owns this Job.

Parameters:
user - Owning user.

getUser

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


setDescription

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


getDescription

public java.lang.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.


getFieldNames

public java.util.Enumeration getFieldNames()

setField

public void setField(java.lang.String name,
                     java.lang.String value)

getField

public java.lang.String getField(java.lang.String name)

getFileEntries

public java.util.Vector getFileEntries()

setStatus

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


setStatus

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


getStatus

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


getStatusName

public java.lang.String getStatusName()

store

public void store()
           throws CommitException
Deprecated. Use commit() instead.

Stores the job information back into perforce.

Throws:
CommitException

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.

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

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.

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

sync

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

fix

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

fix

public static void fix(Env env,
                       java.lang.String changelist,
                       boolean del,
                       java.util.Vector jobs)

removeFix

public void removeFix(int changelist)

toString

public java.lang.String toString()
Overrides the default toString() method.

Overrides:
toString in class java.lang.Object

getJobs

public static Job[] getJobs(Env env)

getJobs

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

getChanges

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

getChangeFixes

public static Change[] getChangeFixes(Env env,
                                      java.lang.String jobname,
                                      java.lang.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.

getJobFixes

public static Job[] getJobFixes(Env env,
                                java.lang.String change,
                                java.lang.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.

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[] args)
Deprecated. Actually in use, but this keeps it out of the docs.

Used for testing.



Copyright © 2009. All Rights Reserved.