@Override public void setStartTime(Date startTime) { if (startTime == null) { throw new IllegalArgumentException("Start time cannot be null"); } Date eTime = getEndTime(); if (eTime != null && startTime != null && eTime.before(startTime)) { throw new IllegalArgumentException("End time cannot be before start time"); } // round off millisecond... // Note timeZone is not needed here as parameter for // Calendar.getInstance(), // since time zone is implicit when using a Date in the setTime method. Calendar cl = Calendar.getInstance(); cl.setTime(startTime); cl.set(Calendar.MILLISECOND, 0); this.startTime = cl.getTime(); }
@Override public void setStartTime(Date startTime) { if (startTime == null) { throw new IllegalArgumentException("Start time cannot be null"); } Date eTime = getEndTime(); if (eTime != null && startTime != null && eTime.before(startTime)) { throw new IllegalArgumentException("End time cannot be before start time"); } // round off millisecond... // Note timeZone is not needed here as parameter for // Calendar.getInstance(), // since time zone is implicit when using a Date in the setTime method. Calendar cl = Calendar.getInstance(); cl.setTime(startTime); cl.set(Calendar.MILLISECOND, 0); this.startTime = cl.getTime(); }
@Override public void setStartTime(Date startTime) { if (startTime == null) { throw new IllegalArgumentException("Start time cannot be null"); } Date eTime = getEndTime(); if (eTime != null && startTime != null && eTime.before(startTime)) { throw new IllegalArgumentException("End time cannot be before start time"); } // round off millisecond... // Note timeZone is not needed here as parameter for // Calendar.getInstance(), // since time zone is implicit when using a Date in the setTime method. Calendar cl = Calendar.getInstance(); cl.setTime(startTime); cl.set(Calendar.MILLISECOND, 0); this.startTime = cl.getTime(); }
/** * Returns the next time at which the <code>CronTrigger</code> will fire, after the given time. If * the trigger will not fire after the given time, <code>null</code> will be returned. * * <p>Note that the date returned is NOT validated against the related org.quartz.Calendar (if * any) */ @Override public Date getFireTimeAfter(Date afterTime) { if (afterTime == null) { afterTime = new Date(); } if (getStartTime().after(afterTime)) { afterTime = new Date(getStartTime().getTime() - 1000l); } if (getEndTime() != null && (afterTime.compareTo(getEndTime()) >= 0)) { return null; } Date pot = getTimeAfter(afterTime); if (getEndTime() != null && pot != null && pot.after(getEndTime())) { return null; } return pot; }
/** * <p> * Returns the next time at which the <code>CronTrigger</code> will fire, after the given time. If the trigger will not fire after the given time, * <code>null</code> will be returned. * </p> * <p> * Note that the date returned is NOT validated against the related org.quartz.Calendar (if any) * </p> */ @Override public Date getFireTimeAfter(Date afterTime) { if (afterTime == null) { afterTime = new Date(); } if (getStartTime().after(afterTime)) { afterTime = new Date(getStartTime().getTime() - 1000l); } if (getEndTime() != null && (afterTime.compareTo(getEndTime()) >= 0)) { return null; } Date pot = getTimeAfter(afterTime); if (getEndTime() != null && pot != null && pot.after(getEndTime())) { return null; } return pot; }
/** * <p> * Returns the next time at which the <code>CronTrigger</code> will fire, after the given time. If the trigger will not fire after the given time, * <code>null</code> will be returned. * </p> * <p> * Note that the date returned is NOT validated against the related org.quartz.Calendar (if any) * </p> */ @Override public Date getFireTimeAfter(Date afterTime) { if (afterTime == null) { afterTime = new Date(); } if (getStartTime().after(afterTime)) { afterTime = new Date(getStartTime().getTime() - 1000l); } if (getEndTime() != null && (afterTime.compareTo(getEndTime()) >= 0)) { return null; } Date pot = getTimeAfter(afterTime); if (getEndTime() != null && pot != null && pot.after(getEndTime())) { return null; } return pot; }
/** * NOT YET IMPLEMENTED: Returns the final time at which the <code>CronTrigger</code> will fire. * * <p>Note that the return time *may* be in the past. and the date returned is not validated * against org.quartz.calendar */ @Override public Date getFinalFireTime() { Date resultTime; if (getEndTime() != null) { resultTime = getTimeBefore(new Date(getEndTime().getTime() + 1000l)); } else { resultTime = (cronEx == null) ? null : cronEx.getFinalFireTime(); } if ((resultTime != null) && (getStartTime() != null) && (resultTime.before(getStartTime()))) { return null; } return resultTime; }
/** * <p> * NOT YET IMPLEMENTED: Returns the final time at which the <code>CronTrigger</code> will fire. * </p> * <p> * Note that the return time *may* be in the past. and the date returned is not validated against org.quartz.calendar * </p> */ @Override public Date getFinalFireTime() { Date resultTime; if (getEndTime() != null) { resultTime = getTimeBefore(new Date(getEndTime().getTime() + 1000l)); } else { resultTime = (cronEx == null) ? null : cronEx.getFinalFireTime(); } if ((resultTime != null) && (getStartTime() != null) && (resultTime.before(getStartTime()))) { return null; } return resultTime; }
/** * <p> * NOT YET IMPLEMENTED: Returns the final time at which the <code>CronTrigger</code> will fire. * </p> * <p> * Note that the return time *may* be in the past. and the date returned is not validated against org.quartz.calendar * </p> */ @Override public Date getFinalFireTime() { Date resultTime; if (getEndTime() != null) { resultTime = getTimeBefore(new Date(getEndTime().getTime() + 1000l)); } else { resultTime = (cronEx == null) ? null : cronEx.getFinalFireTime(); } if ((resultTime != null) && (getStartTime() != null) && (resultTime.before(getStartTime()))) { return null; } return resultTime; }