com.perforce.p4java.ant.tasks
Class LabelTask

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.ClientTask
                      extended by com.perforce.p4java.ant.tasks.LabelTask
All Implemented Interfaces:
java.lang.Cloneable

public class LabelTask
extends ClientTask

Create a new label specification or edit an existing label specification. A name is required.

A label is a shorthand for referring to a collection of revisions. See 'p4 help revisions' for information on using labels. A label is either automatic or static.

An automatic label refers to the revisions given in the View: and Revision: fields.

A static label refers to the revisions associated with the label by the 'p4 tag' or 'p4 labelsync' commands. A static label cannot have a Revision: field.

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
          Delete the label.
protected  java.lang.String description
          Description of the label.
protected  boolean force
          Force the update or deletion of a label.
protected  boolean locked
          Lock the label.
protected  java.lang.String name
          Name of the label.
protected  java.lang.String owner
          Owner of the label.
protected  ILabel retLabel
          New or updated label returned from the Perforce command.
protected  java.lang.String revision
          Revision specification for the label.
 
Fields inherited from class com.perforce.p4java.ant.tasks.ClientTask
p4Client
 
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, fields, 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
location, project
 
Constructor Summary
LabelTask()
          Default constructor.
 
Method Summary
protected  void execP4Command()
          Execute the Perforce label command with the following logical sequence:
 ILabel getRetLabel()
          Gets the ret label.
 void setDelete(boolean delete)
          Sets the delete.
 void setDescription(java.lang.String description)
          Sets the description.
 void setForce(boolean force)
          Sets the force.
 void setLocked(boolean locked)
          Sets the locked.
 void setName(java.lang.String name)
          Sets the name.
 void setOwner(java.lang.String owner)
          Sets the owner.
 void setRevision(java.lang.String revision)
          Sets the revision.
 
Methods inherited from class com.perforce.p4java.ant.tasks.ClientTask
cleanupP4, getP4Client, initP4, setP4Client
 
Methods inherited from class com.perforce.p4java.ant.tasks.ServerTask
cleanupP4Server, createGlobalOption, getGlobalOptions, getP4Server, 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, setLocation, setProject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
Name of the label.


owner

protected java.lang.String owner
Owner of the label.


description

protected java.lang.String description
Description of the label.


revision

protected java.lang.String revision
Revision specification for the label.


locked

protected boolean locked
Lock the label.


delete

protected boolean delete
Delete the label.


force

protected boolean force
Force the update or deletion of a label.


retLabel

protected ILabel retLabel
New or updated label returned from the Perforce command.

Constructor Detail

LabelTask

public LabelTask()
Default constructor.

Method Detail

setName

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

Parameters:
name - the new name

setOwner

public void setOwner(java.lang.String owner)
Sets the owner.

Parameters:
owner - the new owner

setDescription

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

Overrides:
setDescription in class org.apache.tools.ant.ProjectComponent
Parameters:
description - the new description

setLocked

public void setLocked(boolean locked)
Sets the locked.

Parameters:
locked - the new locked

setRevision

public void setRevision(java.lang.String revision)
Sets the revision.

Parameters:
revision - the new revision

setDelete

public void setDelete(boolean delete)
Sets the delete.

Parameters:
delete - the new delete

setForce

public void setForce(boolean force)
Sets the force.

Parameters:
force - the new force

getRetLabel

public ILabel getRetLabel()
Gets the ret label.

Returns:
the ret label

execP4Command

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

1. Delete the label, if "delete" is true.
2. Otherwise, create a new label, if the required label fields are set.
3. Otherwise, update the label with new info, if it exists.

Also, log the info of the newly created or updated label.

Delete a named Perforce label from the Perforce server.

Update an existing Perforce label in the Perforce server.

Create a new Perforce label in the Perforce server.

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.