com.perforce.p4java.ant.tasks
Class JobTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by com.perforce.p4java.ant.tasks.PerforceTask
              extended by com.perforce.p4java.ant.tasks.ServerTask
                  extended by com.perforce.p4java.ant.tasks.JobTask
All Implemented Interfaces:
java.lang.Cloneable

public class JobTask
extends ServerTask

Create and edit job specifications. A job is a defect, enhancement, or other unit of intended work. When a new job is saved a job name of the form jobNNNNNN is created. If a jobName is given on either that named job will be created or, if the job already exists, the job can be modified.

See Also:
PerforceTask, ServerTask

Nested Class Summary
 
Nested classes/interfaces inherited from class com.perforce.p4java.ant.tasks.ServerTask
ServerTask.GlobalOption
 
Nested classes/interfaces inherited from class com.perforce.p4java.ant.tasks.PerforceTask
PerforceTask.Field, PerforceTask.File
 
Field Summary
protected  boolean delete
          If true, the job will be deleted.
protected  java.lang.String fields
          Job fields.
protected  java.lang.String name
          The job name.
protected  java.lang.String property
          The property to be set with the job ID.
protected  IJob retJob
          New or updated job returned from the Perforce command.
 
Fields inherited from class com.perforce.p4java.ant.tasks.ServerTask
allHosts, commandOptions, globaloptions, hostName, P4_SERVER_PROTOCOL_PROPERTIES_FILE, P4_SERVER_USAGE_PROPERTIES_FILE, p4Server, programName, programVersion, protocolPropertiesFile, protocolProps, textLanguage, unsetClientName, unsetUserName, usagePropertiesFile, usageProps, workingDirectory
 
Fields inherited from class com.perforce.p4java.ant.tasks.PerforceTask
charset, client, failOnError, FILE_TOKEN_REGEX_PATTERN, fileList, files, fileSpecs, LINE_PADDING, LINE_SEPARATOR, p4Messages, passwd, port, protocol, retFileSpecs, retStatusMessage, user
 
Fields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
 
Constructor Summary
JobTask()
          Default constructor.
 
Method Summary
protected  void execP4Command()
          Execute the Perforce job command with the following logical sequence:
 IJob getRetJob()
          Gets the ret job.
 void setDelete(boolean delete)
          Sets the delete.
 void setName(java.lang.String name)
          Sets the name.
 void setProperty(java.lang.String property)
          Sets the property.
 
Methods inherited from class com.perforce.p4java.ant.tasks.ServerTask
cleanupP4, cleanupP4Server, createGlobalOption, getGlobalOptions, getP4Server, initP4, initP4Server, initP4ServerOptions, setAllHosts, setHostName, setP4Server, setProgramName, setProgramVersion, setProtocolPropertiesFile, setProtocolProps, setTextLanguage, setUnsetClientName, setUnsetUserName, setUsagePropertiesFile, setUsageProps, setWorkingDirectory
 
Methods inherited from class com.perforce.p4java.ant.tasks.PerforceTask
addFileset, createField, createFile, execute, getFields, getFiles, getFileSpecs, getRetFileSpecs, getRetStatusMessage, init, isEmpty, logChangelistSummaries, logChangelistSummary, logExtendedFileSpec, logExtendedFileSpecs, logFileDiff, logFileDiffs, logFileLineMatch, logFileLineMatches, logFileSpec, logFileSpecs, logFix, logFixes, logJob, logJobs, parseChangelist, setCharset, setClient, setFailOnError, setFiles, setPasswd, setPort, setProtocol, setUser
 
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

delete

protected boolean delete
If true, the job will be deleted.


name

protected java.lang.String name
The job name. 'new' generates a sequenced job number.


fields

protected java.lang.String fields
Job fields. Name value pair


property

protected java.lang.String property
The property to be set with the job ID.


retJob

protected IJob retJob
New or updated job returned from the Perforce command.

Constructor Detail

JobTask

public JobTask()
Default constructor.

Method Detail

setDelete

public void setDelete(boolean delete)
Sets the delete.

Parameters:
delete - the new delete

setName

public void setName(java.lang.String name)
Sets the name.

Parameters:
name - the new name

setProperty

public void setProperty(java.lang.String property)
Sets the property.

Parameters:
property - the new property

getRetJob

public IJob getRetJob()
Gets the ret job.

Returns:
the ret job

execP4Command

protected void execP4Command()
                      throws org.apache.tools.ant.BuildException
Execute the Perforce job command with the following logical sequence:

1. Delete the job, if "delete" is true.
2. Create a new job, if the job name is "new" or empty.
3. Update the job with update fields, if the job exists.

Delete a job from the Perforce server. Note that this method does not change the status of the associated job locally, just on the Perforce server.

Create a new Perforce job in the Perforce server corresponding to the passed-in Perforce job fields (which in turn should correspond to at least the mandatory fields defined in the reigning Perforce job spec).

Update a Perforce job on the Perforce server. Note that only the associated raw fields map is used for field values; the main description and ID fields are actually ignored.

Note: The fields from the "field" nested elements will be used as the raw fields for job creation and update.

Specified by:
execP4Command in class PerforceTask
Throws:
org.apache.tools.ant.BuildException - the build exception
See Also:
PerforceTask.execP4Command()


Copyright (c) 2010 Perforce Software. All rights reserved.