public TriggerPropertyBundle loadExtendedTriggerProperties(Connection conn, TriggerKey triggerKey) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(Util.rtp(SELECT_SIMPLE_TRIGGER, tablePrefix, schedNameLiteral)); ps.setString(1, triggerKey.getName()); ps.setString(2, triggerKey.getGroup()); rs = ps.executeQuery(); if (rs.next()) { int repeatCount = rs.getInt(COL_REPEAT_COUNT); long repeatInterval = rs.getLong(COL_REPEAT_INTERVAL); int timesTriggered = rs.getInt(COL_TIMES_TRIGGERED); SimpleScheduleBuilder sb = SimpleScheduleBuilder.simpleSchedule() .withRepeatCount(repeatCount) .withIntervalInMilliseconds(repeatInterval); String[] statePropertyNames = { "timesTriggered" }; Object[] statePropertyValues = { timesTriggered }; return new TriggerPropertyBundle(sb, statePropertyNames, statePropertyValues); } throw new IllegalStateException("No record found for selection of Trigger with key: '" + triggerKey + "' and statement: " + Util.rtp(SELECT_SIMPLE_TRIGGER, tablePrefix, schedNameLiteral)); } finally { Util.closeResultSet(rs); Util.closeStatement(ps); } }
.withIdentity(triggerKey) .modifiedByCalendar(calendarName) .withSchedule(triggerProps.getScheduleBuilder()) .forJob(jobKey(jobName, jobGroup));
Object[] statePropertyValues = { timesTriggered }; return new TriggerPropertyBundle(scheduleBuilder, statePropertyNames, statePropertyValues);
.withIdentity(triggerKey) .modifiedByCalendar(calendarName) .withSchedule(triggerProps.getScheduleBuilder()) .forJob(jobKey(jobName, jobGroup));
Object[] statePropertyValues = { timesTriggered }; return new TriggerPropertyBundle(scheduleBuilder, statePropertyNames, statePropertyValues);
public TriggerPropertyBundle loadExtendedTriggerProperties(Connection conn, TriggerKey triggerKey) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(Util.rtp(SELECT_SIMPLE_TRIGGER, tablePrefix, schedNameLiteral)); ps.setString(1, triggerKey.getName()); ps.setString(2, triggerKey.getGroup()); rs = ps.executeQuery(); if (rs.next()) { int repeatCount = rs.getInt(COL_REPEAT_COUNT); long repeatInterval = rs.getLong(COL_REPEAT_INTERVAL); int timesTriggered = rs.getInt(COL_TIMES_TRIGGERED); SimpleScheduleBuilder sb = SimpleScheduleBuilder.simpleSchedule() .withRepeatCount(repeatCount) .withIntervalInMilliseconds(repeatInterval); String[] statePropertyNames = { "timesTriggered" }; Object[] statePropertyValues = { timesTriggered }; return new TriggerPropertyBundle(sb, statePropertyNames, statePropertyValues); } throw new IllegalStateException("No record found for selection of Trigger with key: '" + triggerKey + "' and statement: " + Util.rtp(SELECT_SIMPLE_TRIGGER, tablePrefix, schedNameLiteral)); } finally { Util.closeResultSet(rs); Util.closeStatement(ps); } }
public TriggerPropertyBundle loadExtendedTriggerProperties(Connection conn, TriggerKey triggerKey) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(Util.rtp(SELECT_CRON_TRIGGER, tablePrefix, schedNameLiteral)); ps.setString(1, triggerKey.getName()); ps.setString(2, triggerKey.getGroup()); rs = ps.executeQuery(); if (rs.next()) { String cronExpr = rs.getString(COL_CRON_EXPRESSION); String timeZoneId = rs.getString(COL_TIME_ZONE_ID); CronScheduleBuilder cb = CronScheduleBuilder.cronSchedule(cronExpr); if (timeZoneId != null) cb.inTimeZone(TimeZone.getTimeZone(timeZoneId)); return new TriggerPropertyBundle(cb, null, null); } throw new IllegalStateException("No record found for selection of Trigger with key: '" + triggerKey + "' and statement: " + Util.rtp(SELECT_CRON_TRIGGER, tablePrefix, schedNameLiteral)); } finally { Util.closeResultSet(rs); Util.closeStatement(ps); } }
public TriggerPropertyBundle loadExtendedTriggerProperties(Connection conn, TriggerKey triggerKey) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; try { ps = conn.prepareStatement(Util.rtp(SELECT_CRON_TRIGGER, tablePrefix, schedNameLiteral)); ps.setString(1, triggerKey.getName()); ps.setString(2, triggerKey.getGroup()); rs = ps.executeQuery(); if (rs.next()) { String cronExpr = rs.getString(COL_CRON_EXPRESSION); String timeZoneId = rs.getString(COL_TIME_ZONE_ID); CronScheduleBuilder cb = CronScheduleBuilder.cronSchedule(cronExpr); if (timeZoneId != null) cb.inTimeZone(TimeZone.getTimeZone(timeZoneId)); return new TriggerPropertyBundle(cb, null, null); } throw new IllegalStateException("No record found for selection of Trigger with key: '" + triggerKey + "' and statement: " + Util.rtp(SELECT_CRON_TRIGGER, tablePrefix, schedNameLiteral)); } finally { Util.closeResultSet(rs); Util.closeStatement(ps); } }
@Override protected TriggerPropertyBundle getTriggerPropertyBundle(SimplePropertiesTriggerProperties props) { TimeZone tz = null; // if we use null, that's ok as system default tz will be used String tzId = props.getString2(); if(tzId != null && tzId.trim().length() != 0) // there could be null entries from previously released versions tz = TimeZone.getTimeZone(tzId); ScheduleBuilder<?> sb = CalendarIntervalScheduleBuilder.calendarIntervalSchedule() .withInterval(props.getInt1(), IntervalUnit.valueOf(props.getString1())) .inTimeZone(tz) .preserveHourOfDayAcrossDaylightSavings(props.isBoolean1()) .skipDayIfHourDoesNotExist(props.isBoolean2()); int timesTriggered = props.getInt2(); String[] statePropertyNames = { "timesTriggered" }; Object[] statePropertyValues = { timesTriggered }; return new TriggerPropertyBundle(sb, statePropertyNames, statePropertyValues); }
@Override protected TriggerPropertyBundle getTriggerPropertyBundle(SimplePropertiesTriggerProperties props) { TimeZone tz = null; // if we use null, that's ok as system default tz will be used String tzId = props.getString2(); if(tzId != null && tzId.trim().length() != 0) // there could be null entries from previously released versions tz = TimeZone.getTimeZone(tzId); ScheduleBuilder<?> sb = CalendarIntervalScheduleBuilder.calendarIntervalSchedule() .withInterval(props.getInt1(), IntervalUnit.valueOf(props.getString1())) .inTimeZone(tz) .preserveHourOfDayAcrossDaylightSavings(props.isBoolean1()) .skipDayIfHourDoesNotExist(props.isBoolean2()); int timesTriggered = props.getInt2(); String[] statePropertyNames = { "timesTriggered" }; Object[] statePropertyValues = { timesTriggered }; return new TriggerPropertyBundle(sb, statePropertyNames, statePropertyValues); }
private void setTriggerStateProperties(OperableTrigger trigger, TriggerPropertyBundle props) throws JobPersistenceException { if(props.getStatePropertyNames() == null) return; Util.setBeanProps(trigger, props.getStatePropertyNames(), props.getStatePropertyValues()); }
private void setTriggerStateProperties(OperableTrigger trigger, TriggerPropertyBundle props) throws JobPersistenceException { if(props.getStatePropertyNames() == null) return; Util.setBeanProps(trigger, props.getStatePropertyNames(), props.getStatePropertyValues()); }