private void setupExisting(JsJob jsJob) { if (jsJob != null && !jsJob.equals("")) { // $NON-NLS-1$ JsJobTrigger jsJobTrigger = jsJob.getJobTrigger(); ScheduleType scheduleType = ScheduleType.valueOf(jsJobTrigger.getScheduleType()); // scheduleEditor.setScheduleName(jsJob.getJobName()); scheduleEditor.setScheduleType(scheduleType); if (scheduleType == ScheduleType.CRON || jsJobTrigger.getType().equals("cronJobTrigger")) { // $NON-NLS-1$ scheduleEditor.getCronEditor().setCronString(jsJobTrigger.getCronString()); } else if (jsJobTrigger.getType().equals("simpleJobTrigger")) { // $NON-NLS-1$ if (jsJobTrigger.getRepeatCount() == -1) { // Recurring simple Trigger int interval = jsJobTrigger.getRepeatInterval(); scheduleEditor.setRepeatInSecs(interval); if (scheduleType == ScheduleType.DAILY) { DailyRecurrenceEditor dailyRecurrenceEditor = scheduleEditor.getRecurrenceEditor().getDailyEditor(); dailyRecurrenceEditor.setEveryNDays(); } } } else if (jsJobTrigger.getType().equals("complexJobTrigger")) { // $NON-NLS-1$ if (scheduleType == ScheduleType.DAILY) { // Daily DailyRecurrenceEditor dailyRecurrenceEditor = scheduleEditor.getRecurrenceEditor().getDailyEditor(); if (jsJobTrigger.isWorkDaysInWeek()) { dailyRecurrenceEditor.setEveryWeekday(); } else { dailyRecurrenceEditor.setEveryNDays(); } } else if (scheduleType == ScheduleType.WEEKLY) { int[] daysOfWeek = jsJobTrigger.getDayOfWeekRecurrences(); WeeklyRecurrenceEditor weeklyRecurrenceEditor = scheduleEditor.getRecurrenceEditor().getWeeklyEditor(); String strDays = ""; // $NON-NLS-1$ for (int i = 0; i < daysOfWeek.length; i++) { strDays += Integer.toString(daysOfWeek[i]) + ","; // $NON-NLS-1$ } weeklyRecurrenceEditor.setCheckedDaysAsString(strDays, 1); } else if (scheduleType == ScheduleType.MONTHLY) { MonthlyRecurrenceEditor monthlyRecurrenceEditor = scheduleEditor.getRecurrenceEditor().getMonthlyEditor(); if (jsJobTrigger.isQualifiedDayOfWeekRecurrence()) { // Run Every on ___day of Nth week every month monthlyRecurrenceEditor.setDayOfWeek( TimeUtil.DayOfWeek.valueOf(jsJobTrigger.getQualifiedDayOfWeek())); monthlyRecurrenceEditor.setWeekOfMonth( TimeUtil.WeekOfMonth.valueOf(jsJobTrigger.getDayOfWeekQualifier())); monthlyRecurrenceEditor.setNthDayNameOfMonth(); } else { // Run on Nth day of the month monthlyRecurrenceEditor.setDayOfMonth( Integer.toString(jsJobTrigger.getDayOfMonthRecurrences()[0])); } } else if (scheduleType == ScheduleType.YEARLY) { YearlyRecurrenceEditor yearlyRecurrenceEditor = scheduleEditor.getRecurrenceEditor().getYearlyEditor(); if (jsJobTrigger.isQualifiedDayOfWeekRecurrence()) { // Run Every on ___day of Nth week of the month M yearly yearlyRecurrenceEditor.setDayOfWeek( TimeUtil.DayOfWeek.valueOf(jsJobTrigger.getQualifiedDayOfWeek())); yearlyRecurrenceEditor.setWeekOfMonth( TimeUtil.WeekOfMonth.valueOf(jsJobTrigger.getDayOfWeekQualifier())); yearlyRecurrenceEditor.setMonthOfYear1( TimeUtil.MonthOfYear.get(jsJobTrigger.getMonthlyRecurrences()[0] - 1)); yearlyRecurrenceEditor.setNthDayNameOfMonthName(); } else { // Run on Nth day of the month M yearly yearlyRecurrenceEditor.setDayOfMonth( Integer.toString(jsJobTrigger.getDayOfMonthRecurrences()[0])); yearlyRecurrenceEditor.setMonthOfYear0( TimeUtil.MonthOfYear.get(jsJobTrigger.getMonthlyRecurrences()[0] - 1)); yearlyRecurrenceEditor.setEveryMonthOnNthDay(); } } } scheduleEditor.setStartDate(jsJobTrigger.getStartTime()); scheduleEditor.setStartTime( DateTimeFormat.getFormat(PredefinedFormat.HOUR_MINUTE_SECOND) .format(jsJobTrigger.getStartTime())); if (jsJobTrigger.getEndTime() == null) { scheduleEditor.setNoEndDate(); } else { scheduleEditor.setEndDate(jsJobTrigger.getEndTime()); scheduleEditor.setEndBy(); } if (isBlockoutDialog) { this.scheduleEditor.setDurationFields(jsJobTrigger.getBlockDuration()); } } }