Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.quartz
Class UICronTrigger

    java.lang.Object
      org.quartz.Trigger
          org.quartz.UICronTrigger

All Implemented Interfaces:
  Cloneable, Comparable, Serializable

public class UICronTrigger
extends Trigger

A concrete ``Trigger`` that is used to fire a ``Job`` at given moments in time, defined with Unix 'cron-like' definitions.

What you should know about this particular trigger is that it is based on org.quartz.CronTrigger, but the the functionality to build the sets from a string are unused. Whereas CronTrigger would essentially deserialize by rebuilding the TreeSets from the cronExpression, this class does not have a cronExpression, and de/serializes the TreeSets in their entirety. This is because the TreeSets map directly to the Struts user interface for set selection, and no effort is made to write an interpreter to map them back and forth between legacy UN*X cron expressions that CronTrigger uses.

The method I use with this trigger is to instantiate it, then put it in the ActionForm of a Struts bean, then let Struts manipulate it directly through BeanUtils. You are by no means required to do that, but to fully understand the concepts here, at least until there is better documentation, you should understand how it works within that context first so you can write the appropriate code that Struts does for you for free. I'll try to explain that here.

Struts JSP tags allow the user to use Apache BeanUtils to reference components of beans by path. This is to say that a bean `Foo` that has an accessor method `Bar getBar()` and given `Bar` has a primitive type `String` as a field named `splat`, one can set the field to "new string value" as follows:

`// create a new Foo with contained reference to a new Bar Foo fooBean = new Foo(); fooBean.setBar(new Bar()); // set the splat string in the Bar bean from Foo BeanUtils.setProperty(fooBean, "bar.splat", "new string value");`

In turn, Struts JSP tags use the bean addressing provided by BeanUtils to address accessor methods within the bean graph that is rooted with the ActionForm that is put into the Action context.

Finally, having all this allows you to put direct selection lists on the screen of the UI, then map them directly into the UICronTrigger bean. Given a ActionForm bean that was set up to contain a `UICronTrigger` in a field called `trigger`, the following HTML code will completely create your UI in Struts:

`
Date
Time
`

So if you don't want to use Struts, what you have to do is take the information that was submitted on the form in the HTML select ranges, iterate each of them, and add the values to the appropriate sets in the fields of this class. Make sense?

Note that this is not as versatile as the standard CronTrigger. There are tricks with "last day of month" and repeating sets that need to be manually selected, and sets that can happen for date ranges much longer than we can reasonably map with direct selection in a UI.

Author:
  Brian Topping, based on code by Sharada Jambula, James House, Mads Henderson
See Also:
  `CronTrigger`, `Trigger`, `SimpleTrigger`, Serialized Form

Field Summary
`static int` | `MISFIRE_INSTRUCTION_DO_NOTHING` Deprecated. Instructs the ``Scheduler`` that upon a mis-fire situation, the ``CronTrigger`` wants to have it's next-fire-time updated to the next time in the schedule after the current time, but it does not to be fired now.
`static int` | `MISFIRE_INSTRUCTION_FIRE_ONCE_NOW` Deprecated. Instructs the ``Scheduler`` that upon a mis-fire situation, the ``CronTrigger`` wants to be fired now by `Scheduler`.

Fields inherited from class org.quartz.Trigger
`INSTRUCTION_DELETE_TRIGGER, INSTRUCTION_NOOP, INSTRUCTION_RE_EXECUTE_JOB, INSTRUCTION_SET_ALL_JOB_TRIGGERS_COMPLETE, INSTRUCTION_SET_ALL_JOB_TRIGGERS_ERROR, INSTRUCTION_SET_TRIGGER_COMPLETE, INSTRUCTION_SET_TRIGGER_ERROR, MISFIRE_INSTRUCTION_SMART_POLICY, STATE_BLOCKED, STATE_COMPLETE, STATE_ERROR, STATE_NONE, STATE_NORMAL, STATE_PAUSED`

Constructor Summary
`UICronTrigger()` Deprecated. Create a `CronTrigger` with no settings.
`UICronTrigger(String name, String group)` Deprecated. Create a `CronTrigger` with the given name and group.
`UICronTrigger(String name, String group, String jobName, String jobGroup)` Deprecated. Create a `CronTrigger` with the given name and group, and associated with the identified ``Job``.

Method Summary
`Date` | `computeFirstFireTime(Calendar calendar)` Deprecated. Called by the scheduler at the time a `Trigger` is first added to the scheduler, in order to have the `Trigger` compute its first fire time, based on any associated calendar.
`int` | `executionComplete(JobExecutionContext context, JobExecutionException result)` Deprecated. Called after the ``Scheduler`` has executed the ``Job`` associated with the `Trigger` in order to get the final instruction code from the trigger.
`Integer[]` | `getDaysOfMonth()` Deprecated.
`Integer[]` | `getDaysOfMonthLabels()` Deprecated.
`Integer[]` | `getDaysOfMonthValues()` Deprecated.
`Integer[]` | `getDaysOfWeek()` Deprecated.
`String[]` | `getDaysOfWeekLabels()` Deprecated.
`Integer[]` | `getDaysOfWeekValues()` Deprecated.
`Date` | `getEndTime()` Deprecated. Get the time at which the `CronTrigger` should quit repeating - even if repeastCount isn't yet satisfied.
`String` | `getExpressionSummary()` Deprecated.
`Date` | `getFinalFireTime()` Deprecated. Returns the final time at which the `CronTrigger` will fire.
`Date` | `getFireTimeAfter(Date afterTime)` Deprecated. Returns the next time at which the `CronTrigger` will fire, after the given time.
`Integer[]` | `getHours()` Deprecated.
`String[]` | `getHoursLabels()` Deprecated.
`Integer[]` | `getHoursValues()` Deprecated.
`int` | `getLastDayOfMonth(int monthNum)` Deprecated.
`Integer[]` | `getMinutes()` Deprecated.
`Integer[]` | `getMinutesLabels()` Deprecated.
`Integer[]` | `getMinutesValues()` Deprecated.
`Integer[]` | `getMonths()` Deprecated.
`String[]` | `getMonthsLabels()` Deprecated.
`Integer[]` | `getMonthsValues()` Deprecated.
`Date` | `getNextFireTime()` Deprecated. Returns the next time at which the `CronTrigger` will fire.
`Date` | `getPreviousFireTime()` Deprecated. Returns the previous time at which the `Trigger` will fire.
`Integer[]` | `getSeconds()` Deprecated.
`Integer[]` | `getSecondsLabels()` Deprecated.
`Integer[]` | `getSecondsValues()` Deprecated.
`Date` | `getStartTime()` Deprecated. Get the time at which the `CronTrigger` should occur.
`TimeZone` | `getTimeZone()` Deprecated. Returns the time zone for which the `cronExpression` of this `CronTrigger` will be resolved.
`Integer[]` | `getYears()` Deprecated.
`Integer[]` | `getYearsLabels()` Deprecated.
`Integer[]` | `getYearsValues()` Deprecated.
`boolean` | `isLeapYear()` Deprecated.
`static void` | `main(String[] argv)` Deprecated.
`boolean` | `mayFireAgain()` Deprecated. Determines whether or not the `CronTrigger` will occur again.
`void` | `reset()` Deprecated.
`void` | `setDaysOfMonth(Integer[] val)` Deprecated.
`void` | `setDaysOfWeek(Integer[] val)` Deprecated.
`void` | `setEndTime(Date endTime)` Deprecated.
`void` | `setHours(Integer[] val)` Deprecated.
`void` | `setMinutes(Integer[] val)` Deprecated.
`void` | `setMonths(Integer[] val)` Deprecated.
`void` | `setNextFireTime(Date nextFireTime)` Deprecated. Sets the next time at which the `CronTrigger` will fire.
`void` | `setPreviousFireTime(Date previousFireTime)` Deprecated. Set the previous time at which the `SimpleTrigger` fired.
`void` | `setSeconds(Integer[] val)` Deprecated.
`void` | `setStartTime(Date startTime)` Deprecated.
`void` | `setTimeZone(TimeZone timeZone)` Deprecated. Sets the time zone for which the `cronExpression` of this `CronTrigger` will be resolved.
`void` | `setYears(Integer[] val)` Deprecated.
`void` | `triggered(Calendar calendar)` Deprecated. Called when the ``Scheduler`` has decided to 'fire' the trigger (execute the associated `Job`), in order to give the `Trigger` a chance to update itself for its next triggering (if any).
`void` | `updateAfterMisfire()` Deprecated. Updates the `CronTrigger`'s state based on the MISFIRE_INSTRUCTION_XXX that was selected when the `SimpleTrigger` was created.
`void` | `updateAfterMisfire(Calendar cal)` Deprecated. This method should not be used by the Quartz client.
`void` | `updateWithNewCalendar(Calendar calendar, long misfireThreshold)` Deprecated. This method should not be used by the Quartz client.
`protected boolean` | `validateMisfireInstruction(int misfireInstruction)` Deprecated.
`boolean` | `willFireOn(Calendar test)` Deprecated. Determines whether the date & time of the given java.util.Calendar instance falls on a scheduled fire-time of this trigger.

Methods inherited from class org.quartz.Trigger
`addTriggerListener, clone, compareTo, equals, getCalendarName, getDescription, getFireInstanceId, getFullJobName, getFullName, getGroup, getJobDataMap, getJobGroup, getJobName, getMisfireInstruction, getName, getTriggerListenerNames, hashCode, isVolatile, removeTriggerListener, setCalendarName, setDescription, setFireInstanceId, setGroup, setJobDataMap, setJobGroup, setJobName, setMisfireInstruction, setName, setVolatility, toString, validate`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### MISFIRE_INSTRUCTION_FIRE_ONCE_NOW

    public static final int MISFIRE_INSTRUCTION_FIRE_ONCE_NOW

  Deprecated.

  Instructs the ``Scheduler`` that upon a mis-fire situation, the ``CronTrigger`` wants to be fired now by `Scheduler`.

  See Also:
    Constant Field Values

### MISFIRE_INSTRUCTION_DO_NOTHING

    public static final int MISFIRE_INSTRUCTION_DO_NOTHING

  Deprecated.

  Instructs the ``Scheduler`` that upon a mis-fire situation, the ``CronTrigger`` wants to have it's next-fire-time updated to the next time in the schedule after the current time, but it does not to be fired now.

  See Also:
    Constant Field Values

Constructor Detail

### UICronTrigger

    public UICronTrigger()

  Deprecated.

  Create a `CronTrigger` with no settings.

### UICronTrigger

    public UICronTrigger(String name,
                         String group)

  Deprecated.

  Create a `CronTrigger` with the given name and group.

### UICronTrigger

    public UICronTrigger(String name,
                         String group,
                         String jobName,
                         String jobGroup)

  Deprecated.

  Create a `CronTrigger` with the given name and group, and associated with the identified ``Job``.

Method Detail

### reset

    public void reset()

  Deprecated.

### getStartTime

    public Date getStartTime()

  Deprecated.

  Get the time at which the `CronTrigger` should occur.

  Specified by:
    `getStartTime` in class `Trigger`

### setStartTime

    public void setStartTime(Date startTime)

  Deprecated.
  Specified by:
    `setStartTime` in class `Trigger`

### getEndTime

    public Date getEndTime()

  Deprecated.

  Get the time at which the `CronTrigger` should quit repeating - even if repeastCount isn't yet satisfied.

  Specified by:
    `getEndTime` in class `Trigger`
  See Also:
    `getFinalFireTime()`

### setEndTime

    public void setEndTime(Date endTime)

  Deprecated.
  Specified by:
    `setEndTime` in class `Trigger`

### getNextFireTime

    public Date getNextFireTime()

  Deprecated.

  Returns the next time at which the `CronTrigger` will fire. If the trigger will not fire again, `null` will be returned. The value returned is not guaranteed to be valid until after the `Trigger` has been added to the scheduler.

  Specified by:
    `getNextFireTime` in class `Trigger`

### updateAfterMisfire

    public void updateAfterMisfire(Calendar cal)

  Deprecated.
  Description copied from class: `Trigger`

  This method should not be used by the Quartz client.

  To be implemented by the concrete classes that extend this class.

  The implementation should update the `Trigger`'s state based on the MISFIRE_INSTRUCTION_XXX that was selected when the `Trigger` was created.

  Specified by:
    `updateAfterMisfire` in class `Trigger`

### getPreviousFireTime

    public Date getPreviousFireTime()

  Deprecated.
  Description copied from class: `Trigger`

  Returns the previous time at which the `Trigger` will fire. If the trigger has not yet fired, `null` will be returned.

  Specified by:
    `getPreviousFireTime` in class `Trigger`

### setPreviousFireTime

    public void setPreviousFireTime(Date previousFireTime)

  Deprecated.

  Set the previous time at which the `SimpleTrigger` fired.

  This method should not be invoked by client code.

### setNextFireTime

    public void setNextFireTime(Date nextFireTime)

  Deprecated.

  Sets the next time at which the `CronTrigger` will fire. If the trigger will not fire again, `null` will be returned.

### getTimeZone

    public TimeZone getTimeZone()

  Deprecated.

  Returns the time zone for which the `cronExpression` of this `CronTrigger` will be resolved.

### setTimeZone

    public void setTimeZone(TimeZone timeZone)

  Deprecated.

  Sets the time zone for which the `cronExpression` of this `CronTrigger` will be resolved.

### getFireTimeAfter

    public Date getFireTimeAfter(Date afterTime)

  Deprecated.

  Returns the next time at which the `CronTrigger` will fire, after the given time. If the trigger will not fire after the given time, `null` will be returned.

  Note that the date returned is NOT validated against the related org.quartz.Calendar (if any)

  Specified by:
    `getFireTimeAfter` in class `Trigger`

### getFinalFireTime

    public Date getFinalFireTime()

  Deprecated.

  Returns the final time at which the `CronTrigger` will fire.

  Note that the return time *may* be in the past. and the date returned is not validated against org.quartz.calendar

  Specified by:
    `getFinalFireTime` in class `Trigger`

### mayFireAgain

    public boolean mayFireAgain()

  Deprecated.

  Determines whether or not the `CronTrigger` will occur again.

  Specified by:
    `mayFireAgain` in class `Trigger`

### validateMisfireInstruction

    protected boolean validateMisfireInstruction(int misfireInstruction)

  Deprecated.
  Specified by:
    `validateMisfireInstruction` in class `Trigger`

### updateAfterMisfire

    public void updateAfterMisfire()

  Deprecated.

  Updates the `CronTrigger`'s state based on the MISFIRE_INSTRUCTION_XXX that was selected when the `SimpleTrigger` was created.

  If the misfire instruction is set to MISFIRE_INSTRUCTION_SMART_POLICY, then the following scheme will be used:

  - The instruction will be interpreted as `MISFIRE_INSTRUCTION_DO_NOTHING`

### willFireOn

    public boolean willFireOn(Calendar test)

  Deprecated.

  Determines whether the date & time of the given java.util.Calendar instance falls on a scheduled fire-time of this trigger.

  Note that the date returned is NOT validated against the related org.quartz.Calendar (if any)

### executionComplete

    public int executionComplete(JobExecutionContext context,
                                 JobExecutionException result)

  Deprecated.

  Called after the ``Scheduler`` has executed the ``Job`` associated with the `Trigger` in order to get the final instruction code from the trigger.

  Specified by:
    `executionComplete` in class `Trigger`
  Parameters:
    `context` - is the `JobExecutionContext` that was used by the `Job`'s`execute(xx)` method.
    `result` - is the `JobExecutionException` thrown by the `Job`, if any (may be null).
  Returns:
    one of the Trigger.INSTRUCTION_XXX constants.
  See Also:
    `Trigger.INSTRUCTION_NOOP`, `Trigger.INSTRUCTION_RE_EXECUTE_JOB`, `Trigger.INSTRUCTION_DELETE_TRIGGER`, `Trigger.INSTRUCTION_SET_TRIGGER_COMPLETE`, `triggered(Calendar)`

### triggered

    public void triggered(Calendar calendar)

  Deprecated.

  Called when the ``Scheduler`` has decided to 'fire' the trigger (execute the associated `Job`), in order to give the `Trigger` a chance to update itself for its next triggering (if any).

  Specified by:
    `triggered` in class `Trigger`
  See Also:
    `executionComplete(JobExecutionContext, JobExecutionException)`

### updateWithNewCalendar

    public void updateWithNewCalendar(Calendar calendar,
                                      long misfireThreshold)

  Deprecated.
  Description copied from class: `Trigger`

  This method should not be used by the Quartz client.

  To be implemented by the concrete class.

  The implementation should update the `Trigger`'s state based on the given new version of the associated `Calendar` (the state should be updated so that it's next fire time is appropriate given the Calendar's new settings).

  Specified by:
    `updateWithNewCalendar` in class `Trigger`
  Parameters:
    `calendar` -
  See Also:
    `Trigger.updateWithNewCalendar(org.quartz.Calendar, long)`

### computeFirstFireTime

    public Date computeFirstFireTime(Calendar calendar)

  Deprecated.

  Called by the scheduler at the time a `Trigger` is first added to the scheduler, in order to have the `Trigger` compute its first fire time, based on any associated calendar.

  After this method has been called, `getNextFireTime()` should return a valid answer.

  Specified by:
    `computeFirstFireTime` in class `Trigger`
  Returns:
    the first time at which the `Trigger` will be fired by the scheduler, which is also the same value `getNextFireTime()` will return (until after the first firing of the `Trigger`).

### getExpressionSummary

    public String getExpressionSummary()

  Deprecated.

### isLeapYear

    public boolean isLeapYear()

  Deprecated.

### getLastDayOfMonth

    public int getLastDayOfMonth(int monthNum)

  Deprecated.

### getSecondsValues

    public Integer[] getSecondsValues()

  Deprecated.

### getSecondsLabels

    public Integer[] getSecondsLabels()

  Deprecated.

### getSeconds

    public Integer[] getSeconds()

  Deprecated.

### setSeconds

    public void setSeconds(Integer[] val)

  Deprecated.

### getMinutesValues

    public Integer[] getMinutesValues()

  Deprecated.

### getMinutesLabels

    public Integer[] getMinutesLabels()

  Deprecated.

### getMinutes

    public Integer[] getMinutes()

  Deprecated.

### setMinutes

    public void setMinutes(Integer[] val)

  Deprecated.

### getHoursValues

    public Integer[] getHoursValues()

  Deprecated.

### getHoursLabels

    public String[] getHoursLabels()

  Deprecated.

### getHours

    public Integer[] getHours()

  Deprecated.

### setHours

    public void setHours(Integer[] val)

  Deprecated.

### getDaysOfMonthValues

    public Integer[] getDaysOfMonthValues()

  Deprecated.

### getDaysOfMonthLabels

    public Integer[] getDaysOfMonthLabels()

  Deprecated.

### getDaysOfMonth

    public Integer[] getDaysOfMonth()

  Deprecated.

### setDaysOfMonth

    public void setDaysOfMonth(Integer[] val)

  Deprecated.

### getMonthsValues

    public Integer[] getMonthsValues()

  Deprecated.

### getMonthsLabels

    public String[] getMonthsLabels()

  Deprecated.

### getMonths

    public Integer[] getMonths()

  Deprecated.

### setMonths

    public void setMonths(Integer[] val)

  Deprecated.

### getDaysOfWeekLabels

    public String[] getDaysOfWeekLabels()

  Deprecated.

### getDaysOfWeekValues

    public Integer[] getDaysOfWeekValues()

  Deprecated.

### getDaysOfWeek

    public Integer[] getDaysOfWeek()

  Deprecated.

### setDaysOfWeek

    public void setDaysOfWeek(Integer[] val)

  Deprecated.

### getYearsValues

    public Integer[] getYearsValues()

  Deprecated.

### getYearsLabels

    public Integer[] getYearsLabels()

  Deprecated.

### getYears

    public Integer[] getYears()

  Deprecated.

### setYears

    public void setYears(Integer[] val)

  Deprecated.

### main

    public static void main(String[] argv)

  Deprecated.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Quartz Enterprise Job Scheduler Project Page
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD