org.apache.turbine.services.schedule

## Class JobEntryQuartz

- java.lang.Object
- - org.apache.turbine.services.schedule.JobEntryQuartz

- All Implemented Interfaces:
    Comparable<JobEntry>, JobEntry, org.quartz.Job

      public class JobEntryQuartz
      extends Object
      implements JobEntry, org.quartz.Job

  This implements a Turbine scheduled job model for the `QuartzScheduler`.
  Author:
    Thomas Vandahl

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DEFAULT_JOB_GROUP_NAME` the default Quartz schedule group name for Turbine jobs

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JobEntryQuartz()` Default constructor
    `JobEntryQuartz(org.quartz.Trigger jobTrigger)` Constructor
    `JobEntryQuartz(org.quartz.Trigger jobTrigger, org.quartz.JobDetail jobDetail)` Constructor

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `calcRunTime()` Calculate how long before the next runtime.
    `int` | `compareTo(JobEntry o)`
    `void` | `execute(org.quartz.JobExecutionContext context)`
    `org.quartz.JobDetail` | `getJobDetail()`
    `int` | `getJobId()` Get the value of jobId.
    `org.quartz.Trigger` | `getJobTrigger()`
    `String` | `getNextRunAsString()` Get the next runtime for this job as a String.
    `Date` | `getNextRunDate()` Gets the next runtime as a date
    `long` | `getNextRuntime()` Get the next runtime for this job as a long.
    `String` | `getTask()` Get the value of task.
    `boolean` | `isActive()` Check to see if job is currently active/running
    `boolean` | `isNew()` Return true, if the entry is not yet persisted
    `void` | `setActive(boolean isActive)` Sets whether the job is running.
    `void` | `setJobId(int v)` Set the value of jobId.
    `void` | `setJobTrigger(org.quartz.Trigger jobTrigger)`
    `void` | `setTask(String v)` Set the value of task.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_JOB_GROUP_NAME

          public static final String DEFAULT_JOB_GROUP_NAME

      the default Quartz schedule group name for Turbine jobs
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### JobEntryQuartz

          public JobEntryQuartz()

      Default constructor

    - #### JobEntryQuartz

          public JobEntryQuartz(org.quartz.Trigger jobTrigger)

      Constructor
      Parameters:
        `jobTrigger` - Job time table

    - #### JobEntryQuartz

          public JobEntryQuartz(org.quartz.Trigger jobTrigger,
                        org.quartz.JobDetail jobDetail)

      Constructor
      Parameters:
        `jobTrigger` - Job time table
        `jobDetail` - job details

  - ### Method Detail

    - #### isNew

          public boolean isNew()

      Return true, if the entry is not yet persisted
      Specified by:
        `isNew` in interface `JobEntry`
      Returns:
        true if job is not yet saved, otherwise false

    - #### getJobId

          public int getJobId()

      Get the value of jobId.
      Specified by:
        `getJobId` in interface `JobEntry`
      Returns:
        int

    - #### setJobId

          public void setJobId(int v)

      Set the value of jobId.
      Specified by:
        `setJobId` in interface `JobEntry`
      Parameters:
        `v` - new value

    - #### getTask

          public String getTask()

      Get the value of task.
      Specified by:
        `getTask` in interface `JobEntry`
      Returns:
        String

    - #### setTask

          public void setTask(String v)

      Set the value of task.
      Specified by:
        `setTask` in interface `JobEntry`
      Parameters:
        `v` - new value

    - #### getJobTrigger

          public org.quartz.Trigger getJobTrigger()

      Returns:
        the jobTrigger

    - #### setJobTrigger

          public void setJobTrigger(org.quartz.Trigger jobTrigger)

      Parameters:
        `jobTrigger` - the jobTrigger to set

    - #### getJobDetail

          public org.quartz.JobDetail getJobDetail()

      Returns:
        the jobDetail

    - #### compareTo

          public int compareTo(JobEntry o)

      Specified by:
        `compareTo` in interface `Comparable<JobEntry>`
      See Also:
        `Comparable.compareTo(java.lang.Object)`

    - #### setActive

          public void setActive(boolean isActive)

      Description copied from interface: `JobEntry`
      Sets whether the job is running.
      Specified by:
        `setActive` in interface `JobEntry`
      Parameters:
        `isActive` - Whether the job is running.
      See Also:
        `JobEntry.setActive(boolean)`

    - #### isActive

          public boolean isActive()

      Description copied from interface: `JobEntry`
      Check to see if job is currently active/running
      Specified by:
        `isActive` in interface `JobEntry`
      Returns:
        true if job is currently being run by the worker thread, otherwise false
      See Also:
        `JobEntry.isActive()`

    - #### getNextRuntime

          public long getNextRuntime()

      Description copied from interface: `JobEntry`
      Get the next runtime for this job as a long.
      Specified by:
        `getNextRuntime` in interface `JobEntry`
      Returns:
        The next run time as a long.
      See Also:
        `JobEntry.getNextRuntime()`

    - #### getNextRunDate

          public Date getNextRunDate()

      Description copied from interface: `JobEntry`
      Gets the next runtime as a date
      Specified by:
        `getNextRunDate` in interface `JobEntry`
      Returns:
        Next run date
      See Also:
        `JobEntry.getNextRunDate()`

    - #### getNextRunAsString

          public String getNextRunAsString()

      Description copied from interface: `JobEntry`
      Get the next runtime for this job as a String.
      Specified by:
        `getNextRunAsString` in interface `JobEntry`
      Returns:
        The next run time as a String.
      See Also:
        `JobEntry.getNextRunAsString()`

    - #### calcRunTime

          public void calcRunTime()
                           throws TurbineException

      Description copied from interface: `JobEntry`
      Calculate how long before the next runtime.
      The runtime determines it's position in the job queue. Here's the logic:
      1. Create a date the represents when this job is to run.
      2. If this date has expired, them "roll" appropriate date fields forward to the next date.
      3. Calculate the diff in time between the current time and the next run time.
      Specified by:
        `calcRunTime` in interface `JobEntry`
      Throws:
        `TurbineException` - a generic exception.
      See Also:
        `JobEntry.calcRunTime()`

    - #### execute

          public void execute(org.quartz.JobExecutionContext context)
                       throws org.quartz.JobExecutionException

      Specified by:
        `execute` in interface `org.quartz.Job`
      Throws:
        `org.quartz.JobExecutionException`
      See Also:
        `Job.execute(org.quartz.JobExecutionContext)`

Copyright © 2000–2018 The Apache Software Foundation. All rights reserved.