Record Class JobTaskContext

java.lang.Object
java.lang.Record
ch.tocco.nice2.rest.action.spi.JobTaskContext
All Implemented Interfaces:
TaskContext

public record JobTaskContext(AbstractJob job, org.quartz.JobExecutionContext jobContext) extends Record implements TaskContext
  • Constructor Details

    • JobTaskContext

      public JobTaskContext(AbstractJob job, org.quartz.JobExecutionContext jobContext)
      Creates an instance of a JobTaskContext record class.
      Parameters:
      job - the value for the job record component
      jobContext - the value for the jobContext record component
  • Method Details

    • isCancelled

      public boolean isCancelled()
      Specified by:
      isCancelled in interface TaskContext
    • getProgress

      public Progress getProgress()
      Description copied from interface: TaskContext
      Get an instance of Progress to update the current progress.

      Note: will throw an IllegalStateException if the progress is not available. This might be the case if the task is not trackable or if no RemoteContext is available.

      Check if the progress is available by calling TaskContext.isProgressAvailable() if you're not sure.

      Specified by:
      getProgress in interface TaskContext
      Returns:
      an instance of Progress
      See Also:
    • isProgressAvailable

      public boolean isProgressAvailable()
      Description copied from interface: TaskContext
      Check if the progress is available.
      Specified by:
      isProgressAvailable in interface TaskContext
      Returns:
      true if the progress is available, false otherwise.
    • getProgressLog

      public ProgressLog getProgressLog()
      Description copied from interface: TaskContext
      Get an instance of ProgressLog to update the current progress log.

      Note: will throw an IllegalStateException if the progress log is not available. This might be the case if the task is not trackable.

      Check if the progress log is available by calling TaskContext.isProgressLogAvailable() if you're not sure.

      Specified by:
      getProgressLog in interface TaskContext
      Returns:
      an instance of ProgressLog
      See Also:
    • isProgressLogAvailable

      public boolean isProgressLogAvailable()
      Description copied from interface: TaskContext
      Check if the progress log is available.
      Specified by:
      isProgressLogAvailable in interface TaskContext
      Returns:
      true if the progress log is available, false otherwise.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • job

      public AbstractJob job()
      Returns the value of the job record component.
      Returns:
      the value of the job record component
    • jobContext

      public org.quartz.JobExecutionContext jobContext()
      Returns the value of the jobContext record component.
      Returns:
      the value of the jobContext record component