jsJobTrigger.setNativeStartTime( DateTimeFormat.getFormat( PredefinedFormat.ISO_8601 ).format( startDateTime ) );
if ( endDate != null ) {
jsJobTrigger.setNativeEndTime( DateTimeFormat.getFormat( PredefinedFormat.ISO_8601 ).format( endDate ) );
}
} else {
JsArrayInteger jsDaysOfWeek = (JsArrayInteger) JavaScriptObject.createArray();
int i = 0;
for ( DayOfWeek dayOfWeek : daysOfWeek ) {
jsDaysOfWeek.set( i++, dayOfWeek.ordinal() + 1 );
}
JsArrayInteger hours = (JsArrayInteger) JavaScriptObject.createArray();
hours.set( 0, startHour );
JsArrayInteger minutes = (JsArrayInteger) JavaScriptObject.createArray();
hours.set( 0, startMin );
JsArrayInteger seconds = (JsArrayInteger) JavaScriptObject.createArray();
hours.set( 0, 0 );
jsJobTrigger.setType( "complexJobTrigger" ); //$NON-NLS-1$
jsJobTrigger.setDayOfWeekRecurrences( jsDaysOfWeek );
jsJobTrigger.setHourRecurrences( hours );
jsJobTrigger.setMinuteRecurrences( minutes );
jsJobTrigger.setSecondRecurrences( seconds );
jsJobTrigger.setNativeStartTime( DateTimeFormat.getFormat( PredefinedFormat.ISO_8601 ).format( startDateTime ) );
if ( endDate != null ) {
jsJobTrigger.setNativeEndTime( DateTimeFormat.getFormat( PredefinedFormat.ISO_8601 ).format( endDate ) );
}
}
} else if ( scheduleType == ScheduleType.CRON ) { // Cron jobs
jsJobTrigger.setType( "cronJobTrigger" ); //$NON-NLS-1$
} else if ( ( scheduleType == ScheduleType.WEEKLY ) && ( daysOfWeek.size() > 0 ) ) {
JsArrayInteger jsDaysOfWeek = (JsArrayInteger) JavaScriptObject.createArray();
int i = 0;
for ( DayOfWeek dayOfWeek : daysOfWeek ) {
jsDaysOfWeek.set( i++, dayOfWeek.ordinal() + 1 );
}
JsArrayInteger hours = (JsArrayInteger) JavaScriptObject.createArray();
hours.set( 0, startHour );
JsArrayInteger minutes = (JsArrayInteger) JavaScriptObject.createArray();
hours.set( 0, startMin );
JsArrayInteger seconds = (JsArrayInteger) JavaScriptObject.createArray();
hours.set( 0, 0 );
jsJobTrigger.setType( "complexJobTrigger" ); //$NON-NLS-1$
jsJobTrigger.setDayOfWeekRecurrences( jsDaysOfWeek );
jsJobTrigger.setHourRecurrences( hours );
jsJobTrigger.setMinuteRecurrences( minutes );
jsJobTrigger.setSecondRecurrences( seconds );
jsJobTrigger.setNativeStartTime( DateTimeFormat.getFormat( PredefinedFormat.ISO_8601 ).format( startDateTime ) );
if ( endDate != null ) {
jsJobTrigger.setNativeEndTime( DateTimeFormat.getFormat( PredefinedFormat.ISO_8601 ).format( endDate ) );
}
} else if ( ( scheduleType == ScheduleType.MONTHLY )
|| ( ( scheduleType == ScheduleType.YEARLY ) && ( monthOfYear != null ) ) ) {
jsJobTrigger.setType( "complexJobTrigger" ); //$NON-NLS-1$
if ( dayOfMonth != null ) {
JsArrayInteger jsDaysOfMonth = (JsArrayInteger) JavaScriptObject.createArray();
jsDaysOfMonth.set( 0, dayOfMonth );
JsArrayInteger hours = (JsArrayInteger) JavaScriptObject.createArray();
hours.set( 0, startHour );
JsArrayInteger minutes = (JsArrayInteger) JavaScriptObject.createArray();
hours.set( 0, startMin );
JsArrayInteger seconds = (JsArrayInteger) JavaScriptObject.createArray();
hours.set( 0, 0 );
jsJobTrigger.setType( "complexJobTrigger" ); //$NON-NLS-1$
if ( monthOfYear != null ) {
JsArrayInteger jsMonthsOfYear = (JsArrayInteger) JavaScriptObject.createArray();
jsMonthsOfYear.set( 0, monthOfYear.ordinal() + 1 );
jsJobTrigger.setMonthlyRecurrences( jsMonthsOfYear );
}
jsJobTrigger.setDayOfMonthRecurrences( jsDaysOfMonth );
jsJobTrigger.setHourRecurrences( hours );
jsJobTrigger.setMinuteRecurrences( minutes );
jsJobTrigger.setSecondRecurrences( seconds );
jsJobTrigger.setNativeStartTime( DateTimeFormat.getFormat( PredefinedFormat.ISO_8601 ).format( startDateTime ) );
if ( endDate != null ) {
jsJobTrigger.setNativeEndTime( DateTimeFormat.getFormat( PredefinedFormat.ISO_8601 ).format( endDate ) );
}
} else if ( ( daysOfWeek.size() > 0 ) && ( weekOfMonth != null ) ) {
JsArrayInteger jsDaysOfWeek = (JsArrayInteger) JavaScriptObject.createArray();
int i = 0;
for ( DayOfWeek dayOfWeek : daysOfWeek ) {
jsDaysOfWeek.set( i++, dayOfWeek.ordinal() + 1 );
}
JsArrayInteger hours = (JsArrayInteger) JavaScriptObject.createArray();
hours.set( 0, startHour );
JsArrayInteger minutes = (JsArrayInteger) JavaScriptObject.createArray();
hours.set( 0, startMin );
JsArrayInteger seconds = (JsArrayInteger) JavaScriptObject.createArray();
hours.set( 0, 0 );
jsJobTrigger.setType( "complexJobTrigger" ); //$NON-NLS-1$
if ( monthOfYear != null ) {
JsArrayInteger jsMonthsOfYear = (JsArrayInteger) JavaScriptObject.createArray();
jsMonthsOfYear.set( 0, monthOfYear.ordinal() + 1 );
jsJobTrigger.setMonthlyRecurrences( jsMonthsOfYear );
}
jsJobTrigger.setHourRecurrences( hours );
jsJobTrigger.setMinuteRecurrences( minutes );
jsJobTrigger.setSecondRecurrences( seconds );