protected String getYearlyCronString() throws RuntimeException { String cronStr; StringBuilder recurrenceSb = new StringBuilder(); if (yearlyEditor.isEveryMonthOnNthDay()) { String monthOfYear = Integer.toString(yearlyEditor.getMonthOfYear0().value() + 1); recurrenceSb .append(RecurrenceType.EveryMonthNameN) .append(SPACE) .append(getTimeOfRecurrence()) .append(SPACE) .append(yearlyEditor.getDayOfMonth()) .append(SPACE) .append(monthOfYear); } else if (yearlyEditor.isNthDayNameOfMonthName()) { if (yearlyEditor.getWeekOfMonth() != WeekOfMonth.LAST) { String monthOfYear = Integer.toString(yearlyEditor.getMonthOfYear1().value() + 1); String dayOfWeek = Integer.toString(yearlyEditor.getDayOfWeek().value() + 1); String weekOfMonth = Integer.toString(yearlyEditor.getWeekOfMonth().value() + 1); recurrenceSb .append(RecurrenceType.NthDayNameOfMonthName) .append(SPACE) .append(getTimeOfRecurrence()) .append(SPACE) .append(dayOfWeek) .append(SPACE) .append(weekOfMonth) .append(SPACE) .append(monthOfYear); } else { String monthOfYear = Integer.toString(yearlyEditor.getMonthOfYear1().value() + 1); String dayOfWeek = Integer.toString(yearlyEditor.getDayOfWeek().value() + 1); recurrenceSb .append(RecurrenceType.LastDayNameOfMonthName) .append(SPACE) .append(getTimeOfRecurrence()) .append(SPACE) .append(dayOfWeek) .append(SPACE) .append(monthOfYear); } } else { throw new RuntimeException(Messages.getString("schedule.noRadioBtnsSelected")); } try { cronStr = CronParser.recurrenceStringToCronString(recurrenceSb.toString()); } catch (CronParseException e) { throw new RuntimeException( Messages.getString("schedule.invalidRecurrenceString", recurrenceSb.toString())); } return cronStr; }
public WeekOfMonth getSelectedWeekOfMonth() { WeekOfMonth selectedWeekOfMonth = null; if ((temporalState == TemporalValue.MONTHLY) && monthlyEditor.isNthDayNameOfMonth()) { selectedWeekOfMonth = monthlyEditor.getWeekOfMonth(); } else if ((temporalState == TemporalValue.YEARLY) && yearlyEditor.isNthDayNameOfMonthName()) { selectedWeekOfMonth = yearlyEditor.getWeekOfMonth(); } return selectedWeekOfMonth; }