Class JobDelegator

    • 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 interface IJobDelegator
        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 request
        AccessException - 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 interface IJobDelegator
        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 request
        AccessException - 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 interface IJobDelegator
        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 request
        AccessException - 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 interface IJobDelegator
        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 request
        AccessException - if the Perforce server denies access to the caller