com.perforce.p4java.impl.generic.core
Class Job

java.lang.Object
  extended by com.perforce.p4java.impl.generic.core.ServerResource
      extended by com.perforce.p4java.impl.generic.core.Job
All Implemented Interfaces:
IJob, IServerResource

public class Job
extends ServerResource
implements IJob

Simple generic default implementation class for the IJob interface.


Field Summary
 int SHORT_DESCR_LENGTH
          The max description length for "short" or summary descriptions
 
Fields inherited from class com.perforce.p4java.impl.generic.core.ServerResource
refreshable, server, updateable
 
Constructor Summary
Job(IServer server, Map<String,Object> map)
           
Job(IServer server, Map<String,Object> map, boolean longDescriptions)
           
 
Method Summary
 String getDescription()
           
protected  String getDescriptionString(Map<String,Object> map, boolean longDescriptions)
           
 String getId()
           
protected  String getJobIdString(Map<String,Object> map)
           
 IJobSpec getJobSpec()
           
 Map<String,Object> getRawFields()
           
static Job newJob(IServer server, Map<String,Object> map)
          Simple factory method for creating a new Job class.
 void refresh()
          This method will refresh by getting the complete job model.
 void setDescription(String description)
           
 void setId(String id)
           
 void setJobSpec(IJobSpec jobSpec)
           
 void setRawFields(Map<String,Object> rawFields)
           
 void update()
          Update the Perforce server object associated with the underlying P4Java object, if possible.
 String updateOnServer()
          Update the underlying Perforce job associated with this object in the Perforce server.
 
Methods inherited from class com.perforce.p4java.impl.generic.core.ServerResource
canRefresh, canUpdate, complete, setRefreshable, setServer, update, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.perforce.p4java.core.IServerResource
canRefresh, canUpdate, setServer, update, update
 

Field Detail

SHORT_DESCR_LENGTH

public int SHORT_DESCR_LENGTH
The max description length for "short" or summary descriptions

Constructor Detail

Job

public Job(IServer server,
           Map<String,Object> map)

Job

public Job(IServer server,
           Map<String,Object> map,
           boolean longDescriptions)
Method Detail

newJob

public static Job newJob(IServer server,
                         Map<String,Object> map)
Simple factory method for creating a new Job class.

Parameters:
server - non-null IServer to be associated with this job.
map - non-null fields map for the job to be created.
Returns:
new Job object

refresh

public void refresh()
             throws ConnectionException,
                    RequestException,
                    AccessException
This method will refresh by getting the complete job model. If this refresh is successful then this job will be marked as complete.

Specified by:
refresh in interface IServerResource
Overrides:
refresh in class ServerResource
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 request
AccessException - if the Perforce server denies access to the caller
See Also:
ServerResource.refresh()

updateOnServer

public String updateOnServer()
                      throws ConnectionException,
                             RequestException,
                             AccessException
Description copied from interface: IJob
Update the underlying Perforce job associated with this object in the Perforce server.

Basically a convenience method for IServer.updateJob(job).

Specified by:
updateOnServer in interface IJob
Returns:
possibly-null Perforce server-generated status resulting from operation.
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 request
AccessException - if the Perforce server denies access to the caller
See Also:
NOTE: do not use this method if the server field has not been set.

update

public void update()
            throws ConnectionException,
                   RequestException,
                   AccessException
Description copied from interface: IServerResource
Update the Perforce server object associated with the underlying P4Java object, if possible. The semantics of server updates are generally object-specific and will be spelled out for each participating object.

The results of calling this method on objects whose canUpdate method returns false are undefined (but will generally result in a UnimplementedError being thrown).

Specified by:
update in interface IServerResource
Overrides:
update in class ServerResource
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 request
AccessException - if the Perforce server denies access to the caller
See Also:
IServerResource.update()

getDescription

public String getDescription()
Specified by:
getDescription in interface IJob
See Also:
IJob.getDescription()

getId

public String getId()
Specified by:
getId in interface IJob
See Also:
IJob.getId()

getJobSpec

public IJobSpec getJobSpec()
Specified by:
getJobSpec in interface IJob
See Also:
IJob.getJobSpec()

getRawFields

public Map<String,Object> getRawFields()
Specified by:
getRawFields in interface IJob
See Also:
IJob.getRawFields()

setId

public void setId(String id)
Specified by:
setId in interface IJob
See Also:
IJob.setId(java.lang.String)

setRawFields

public void setRawFields(Map<String,Object> rawFields)
Specified by:
setRawFields in interface IJob
See Also:
IJob.setRawFields(java.util.Map)

setDescription

public void setDescription(String description)
Specified by:
setDescription in interface IJob
See Also:
IJob.setDescription(java.lang.String)

setJobSpec

public void setJobSpec(IJobSpec jobSpec)
Specified by:
setJobSpec in interface IJob
See Also:
IJob.setJobSpec(com.perforce.p4java.core.IJobSpec)

getJobIdString

protected String getJobIdString(Map<String,Object> map)

getDescriptionString

protected String getDescriptionString(Map<String,Object> map,
                                      boolean longDescriptions)


Copyright © 2015 Perforce Software. All Rights Reserved.