Class JobDelegator
- java.lang.Object
-
- com.perforce.p4java.impl.mapbased.server.cmd.BaseDelegator
-
- com.perforce.p4java.impl.mapbased.server.cmd.JobDelegator
-
- All Implemented Interfaces:
IJobDelegator
public class JobDelegator extends BaseDelegator implements IJobDelegator
Implementation for 'p4 job'..
-
-
Field Summary
-
Fields inherited from class com.perforce.p4java.impl.mapbased.server.cmd.BaseDelegator
MAX_LIMIT_SUPPORTED_MIN_VERSION, QUERY_EXPRESSIONS_SUPPORTED_MIN_VERSION, USER_RESTRICTIONS_SUPPORTED_MIN_VERSION
-
-
Constructor Summary
Constructors Constructor Description JobDelegator(IOptionsServer server)
Instantiates a new job delegator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IJob
createJob(java.util.Map<java.lang.String,java.lang.Object> fieldMap)
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).java.lang.String
deleteJob(java.lang.String jobId)
Delete a job from the Perforce server.IJob
getJob(java.lang.String jobId)
Get a specific job.java.lang.String
updateJob(IJob job)
Update a Perforce job on the Perforce server.
-
-
-
Constructor Detail
-
JobDelegator
public JobDelegator(IOptionsServer server)
Instantiates a new job delegator.- Parameters:
server
- the server
-
-
Method Detail
-
createJob
public IJob createJob(@Nonnull java.util.Map<java.lang.String,java.lang.Object> fieldMap) throws ConnectionException, RequestException, AccessException
Description copied from interface:IJobDelegator
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).Perforce job semantics, field count and layout, etc., are to some extent free-form and specified for each server by the associated job spec (retrievable using the getJobSpec() method below), so map fields are passed to the Perforce server exactly as passed to the create method in the job's field map, so you need to know the field names and semantics given by the associated job spec. This includes setting the relevant job ID field to "new", but otherwise, no checking is done on fields in this method against the job spec (this may be added later).
- Specified by:
createJob
in interfaceIJobDelegator
- Parameters:
fieldMap
- non-null field map defining the new job in the Perforce server.- Returns:
- returns an IJob representing the newly-created job, if successful.
- Throws:
ConnectionException
- if the Perforce server is unreachable or is not connected.RequestException
- if the Perforce server encounters an error during its processing of the requestAccessException
- if the Perforce server denies access to the caller
-
deleteJob
public java.lang.String deleteJob(java.lang.String jobId) throws ConnectionException, RequestException, AccessException
Description copied from interface:IJobDelegator
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.- Specified by:
deleteJob
in interfaceIJobDelegator
- Parameters:
jobId
- ID of the job to be deleted.- Returns:
- possibly-null status message as returned from the server; this may include form trigger output pre-pended and / or appended to the "normal" message.
- Throws:
ConnectionException
- if the Perforce server is unreachable or is not connected.RequestException
- if the Perforce server encounters an error during its processing of the requestAccessException
- if the Perforce server denies access to the caller
-
getJob
public IJob getJob(java.lang.String jobId) throws ConnectionException, RequestException, AccessException
Description copied from interface:IJobDelegator
Get a specific job. Note that some implementations of the underlying server do not return null if you ask for a job that doesn't exist; you must do your own checking to see of what's returned represents a real job or not.- Specified by:
getJob
in interfaceIJobDelegator
- Parameters:
jobId
- non-null job Id.- Returns:
- IJob for the named job; null if no such job.
- Throws:
ConnectionException
- if the Perforce server is unreachable or is not connected.RequestException
- if the Perforce server encounters an error during its processing of the requestAccessException
- if the Perforce server denies access to the caller
-
updateJob
public java.lang.String updateJob(@Nonnull IJob job) throws ConnectionException, RequestException, AccessException
Description copied from interface:IJobDelegator
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.The returned string will contain whatever the Perforce server returned in response to this command; in general, if the update fails, an exception will be thrown, meaning that the returned string represents success only. There are two success states -- either the job was saved or it didn't need saving (it was the same after updating). Consumers should parse this accordingly.
- Specified by:
updateJob
in interfaceIJobDelegator
- Parameters:
job
- non-null candidate for updating.- Returns:
- possibly-null status message as returned from the server; this may include form trigger output pre-pended and / or appended to the "normal" message.
- Throws:
ConnectionException
- if the Perforce server is unreachable or is not connected.RequestException
- if the Perforce server encounters an error during its processing of the requestAccessException
- if the Perforce server denies access to the caller
-
-