Class Job

    • Method Detail

      • setCredential

        public void setCredential​(Credential credential)
        Sets the credential used to authenticate the user with this job.
        Specified by:
        setCredential in interface RemoteResource
        Parameters:
        credential - the credential used to authenticate the user with this job
        Since:
        100.0.0
      • getCredential

        public Credential getCredential()
        Gets the credential used to authenticate the user with this job.
        Specified by:
        getCredential in interface RemoteResource
        Returns:
        the credential, or null if there is none
        Since:
        100.0.0
      • setRequestConfiguration

        public void setRequestConfiguration​(RequestConfiguration requestConfiguration)
        Sets configuration parameters used for network requests sent using this job. The global RequestConfiguration is used if no RequestConfiguration is set.
        Specified by:
        setRequestConfiguration in interface RemoteResource
        Parameters:
        requestConfiguration - object containing the parameters to use
        Since:
        100.0.0
      • setUri

        @Deprecated
        public void setUri​(String uri)
        Deprecated.
        As of 100.1.0, no replacement.
        Sets the URI of this job.
        Parameters:
        uri - the URI of this job
        Since:
        100.0.0
      • getUri

        public String getUri()
        Gets the URI of this job.
        Specified by:
        getUri in interface RemoteResource
        Returns:
        the URI of this job
        Since:
        100.0.0
      • fromJson

        public static Job fromJson​(String json)
        Creates a Job instance from a JSON string.
        Parameters:
        json - a JSON string that represents a Job
        Returns:
        a Job instance
        Throws:
        IllegalArgumentException - if json is null or empty
        Since:
        100.0.0
      • toJson

        public String toJson()
        Description copied from interface: JsonSerializable
        Serializes this object to a JSON string. Note that unknown JSON is omitted from the serialized string.
        Specified by:
        toJson in interface JsonSerializable
        Returns:
        a JSON string
      • getUnknownJson

        public Map<String,​Object> getUnknownJson()
        Jobs never have any unknown JSON so this returns an empty Map.
        Specified by:
        getUnknownJson in interface JsonSerializable
        Returns:
        an empty unmodifiable Map
        Since:
        100.0.0
      • getUnsupportedJson

        public Map<String,​Object> getUnsupportedJson()
        Jobs never have any unsupported JSON so this returns an empty Map.
        Specified by:
        getUnsupportedJson in interface JsonSerializable
        Returns:
        an empty unmodifiable Map
        Since:
        100.0.0
      • getError

        public ArcGISRuntimeException getError()
        Gets the error if this job has terminated due to an error.
        Returns:
        an ArcGISRuntimeException describing the error, or null if the job succeeded or is not done yet
        Since:
        100.0.0
      • getMessages

        public List<Job.Message> getMessages()
        Gets a list containing messages describing the current state of this job. For an up to date list of messages, call this method each time a JobChanged or JobDone event fires.
        Returns:
        an unmodifiable List of messages describing the current state of this job
        Since:
        100.0.0
      • getProgress

        public int getProgress()
        Gets a measure of the progress of this job. This is the percentage of the job that has been completed, ranging from zero before starting to 100 when complete.
        Returns:
        the percentage of the job that has been completed
        Since:
        100.1.0
        See Also:
        addProgressChangedListener(Runnable)
      • getResult

        public abstract Object getResult()
        Gets the result of this job.
        Returns:
        an Object containing the result, or null if the job failed or is not done yet
        Since:
        100.0.0
      • getStatus

        public Job.Status getStatus()
        Gets the current status of this job.
        Returns:
        the status of this job
        Since:
        100.0.0
      • getServerJobId

        public String getServerJobId()
        Gets the ID used by the server to identify this job.
        Returns:
        the server ID of this job
        Since:
        100.0.0
      • cancel

        public boolean cancel()
        Cancels this job.
        Returns:
        true if the job was successfully cancelled, false if it is already done or if an error occurred
        Since:
        100.0.0
      • pause

        public boolean pause()
        Pauses this job.
        Returns:
        true if the job was successfully paused; false if it is already paused or already done or an error occurred
        Since:
        100.0.0
      • start

        public boolean start()
        Starts or resumes this job. Call this method to start the job initially and also to resume it after it is paused.
        Returns:
        true if the job was successfully started/resumed; false if it has not been paused or is already done, or if an error occurs
        Since:
        100.0.0
      • addJobDoneListener

        public void addJobDoneListener​(Runnable listener)
        Adds a listener to run on successful or unsuccessful completion of the job. The listener will run immediately if the job is already complete when this method is called.

        Adding this listener on the UI thread will cause it to be invoked on the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.

        Parameters:
        listener - a Runnable to run when the job is done
        Throws:
        IllegalArgumentException - if listener is null
        Since:
        100.0.0
      • removeJobDoneListener

        public boolean removeJobDoneListener​(Runnable listener)
        Removes a job done listener so that it will not be called when the job completes.
        Parameters:
        listener - the listener to be removed
        Returns:
        true if the listener was removed, otherwise false
        Since:
        100.0.0
      • addJobChangedListener

        public void addJobChangedListener​(Runnable listener)
        Adds a listener to run each time the status of this job changes or a new JobMessage is generated.

        Adding this listener on the UI thread will cause it to be invoked on the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.

        Parameters:
        listener - a Runnable to run when the job changes
        Throws:
        IllegalArgumentException - if listener is null
        Since:
        100.0.0
      • removeJobChangedListener

        public boolean removeJobChangedListener​(Runnable listener)
        Removes a job changed listener so that it will not be called when the job changes.
        Parameters:
        listener - the listener to be removed
        Returns:
        true if the listener was removed, otherwise false
        Since:
        100.0.0
      • addProgressChangedListener

        public void addProgressChangedListener​(Runnable listener)
        Adds a listener to run each time the progress of this job changes. This method will be called each time the job's progress increments.

        Adding this listener on the UI thread will cause it to be invoked on the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.

        Parameters:
        listener - a Runnable to run when the job progress changes
        Throws:
        IllegalArgumentException - if listener is null
        Since:
        100.1.0
        See Also:
        getProgress()
      • removeProgressChangedListener

        public boolean removeProgressChangedListener​(Runnable listener)
        Removes a progress changed listener so that it will not be called when the job progress changes.
        Parameters:
        listener - the listener to be removed
        Returns:
        true if the listener was removed, otherwise false
        Since:
        100.1.0