return isAdjustedNextRunTimeValid();
}
void setNextRunTime(long baseTime) throws Exception {
if (repeating == NOT_SPECIFIED) {
throw new InvalidDataException(Phrase.get("TX_REPEATING"));
} if (repeating == REPEATING_ONCE) {
if (startTime == NOT_SPECIFIED)
throw new InvalidDataException(Phrase.get("TX_START_TIME"));
if (startTime >= System.currentTimeMillis())
nextRunTime = startTime;
else
status = STATUS_INACTIVE;
} else if (repeating == REPEATING_MINUTELY) {
if (startTime == NOT_SPECIFIED)
throw new InvalidDataException(Phrase.get("TX_START_TIME"));
if (minutelyPeriod <= 0)
throw new InvalidDataException(Phrase.get("TX_MINUTELY_PERIOD") + ": " +
minutelyPeriod);
setNextRunTimeForMinutely(baseTime, minutelyPeriod);
} else if (repeating == REPEATING_HOURLY) {
if (startTime == NOT_SPECIFIED)
throw new InvalidDataException(Phrase.get("TX_START_TIME"));
if (hourlyPeriod <= 0)
throw new InvalidDataException(Phrase.get("TX_HOURLY_PERIOD") + ": " +
hourlyPeriod);
setNextRunTimeForMinutely(baseTime, hourlyPeriod * 60);
} else if (repeating == REPEATING_DAILY) {
if (startTime == NOT_SPECIFIED)
throw new InvalidDataException(Phrase.get("TX_START_TIME"));
if (dailyPeriod <= 0)
throw new InvalidDataException(Phrase.get("TX_DAILY_PERIOD") + ": " +
dailyPeriod);
setNextRunTimeForDaily(baseTime, dailyPeriod);
} else if (repeating == REPEATING_WEEKLY) {
if (startTime == NOT_SPECIFIED)
throw new InvalidDataException(Phrase.get("TX_START_TIME"));
if (weeklyPeriod <= 0)
throw new InvalidDataException(Phrase.get("TX_WEEKLY_PERIOD") + ": " + weeklyPeriod);
if (weeklyWeekDay <= 0)
throw new InvalidDataException(Phrase.get("TX_WEEKDAY") + ": " + weeklyWeekDay);
if ((holidayPolicy != HOLIDAY_POLICY_SAME) &&
(weeklyWeekDay == Calendar.SATURDAY || weeklyWeekDay == Calendar.SUNDAY))
throw new InvalidDataException(Phrase.get("ER_CONFLICT_BETWEEN_DATA_AND_WEEKEND_POLICY"));
setNextRunTimeForWeekly(baseTime);
} else if (repeating == REPEATING_MONTHLY) {
if (startTime == NOT_SPECIFIED)
throw new InvalidDataException(Phrase.get("TX_START_TIME"));
if (monthlyTheDay <= 0)
throw new InvalidDataException(Phrase.get("TX_MONTHLY_THE_DAY") + ": " + monthlyTheDay);
if (monthlyPeriod <= 0)
throw new InvalidDataException(Phrase.get("TX_MONTHLY_PERIOD") + ": " + monthlyTheDay);
setNextRunTimeForMonthly(baseTime);
} else if (repeating == REPEATING_WEEK_DAY_MONTHLY) {
if (startTime == NOT_SPECIFIED)
throw new InvalidDataException(Phrase.get("TX_START_TIME"));
if (monthlyPeriod <= 0)
throw new InvalidDataException(Phrase.get("TX_MONTHLY_PERIOD") + ": " + monthlyTheDay);
if ((holidayPolicy != HOLIDAY_POLICY_SAME) &&
(monthlyWhichWeekWeekDay == Calendar.SATURDAY ||
monthlyWhichWeekWeekDay == Calendar.SUNDAY))
throw new InvalidDataException(Phrase.get("ER_CONFLICT_BETWEEN_DATA_AND_WEEKEND_POLICY"));
setNextRunTimeForWeekDayMonthly(baseTime);
} else if (repeating == REPEATING_AT_SPECIFIED_TIMES) {
setNextRunTimeForSpecifiedTimes(baseTime);