Java Code Examples for org.quartz.impl.triggers.SimpleTriggerImpl#setTimesTriggered()

The following examples show how to use org.quartz.impl.triggers.SimpleTriggerImpl#setTimesTriggered() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EntityMocksHelper.java    From griffin with Apache License 2.0 5 votes vote down vote up
public static SimpleTrigger createSimpleTrigger(
    int repeatCount,
    int triggerCount) {
    SimpleTriggerImpl trigger = new SimpleTriggerImpl();
    trigger.setRepeatCount(repeatCount);
    trigger.setTimesTriggered(triggerCount);
    trigger.setPreviousFireTime(new Date());
    return trigger;
}
 
Example 2
Source File: SimpleTriggerSupport.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public static OperableTrigger newTrigger(CompositeData cData) throws ParseException {
    SimpleTriggerImpl result = new SimpleTriggerImpl();
    result.setRepeatCount(((Integer) cData.get("repeatCount")).intValue());
    result.setRepeatInterval(((Long) cData.get("repeatInterval")).longValue());
    result.setTimesTriggered(((Integer) cData.get("timesTriggered")).intValue());
    TriggerSupport.initializeTrigger(result, cData);
    return result;
}
 
Example 3
Source File: SimpleTriggerSupport.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public static OperableTrigger newTrigger(Map<String, Object> attrMap) throws ParseException {
    SimpleTriggerImpl result = new SimpleTriggerImpl();
    if(attrMap.containsKey("repeatCount")) {
        result.setRepeatCount(((Integer) attrMap.get("repeatCount")).intValue());
    }
    if(attrMap.containsKey("repeatInterval")) {
        result.setRepeatInterval(((Long) attrMap.get("repeatInterval")).longValue());
    }
    if(attrMap.containsKey("timesTriggered")) {
        result.setTimesTriggered(((Integer) attrMap.get("timesTriggered")).intValue());
    }
    TriggerSupport.initializeTrigger(result, attrMap);
    return result;
}
 
Example 4
Source File: RedisJobStore.java    From redis-quartz with MIT License 5 votes vote down vote up
private OperableTrigger toOperableTrigger(TriggerKey triggerKey, Map<String, String> trigger) {
	if (TRIGGER_TYPE_SIMPLE.equals(trigger.get(TRIGGER_TYPE))) {
		SimpleTriggerImpl simpleTrigger = new SimpleTriggerImpl();
		setOperableTriggerFields(triggerKey, trigger, simpleTrigger);
		if (trigger.get(REPEAT_COUNT) != null && !trigger.get(REPEAT_COUNT).isEmpty())
			simpleTrigger.setRepeatCount(Integer.parseInt(trigger.get(REPEAT_COUNT)));
		if (trigger.get(REPEAT_INTERVAL) != null && !trigger.get(REPEAT_INTERVAL).isEmpty())
			simpleTrigger.setRepeatInterval(Long.parseLong(trigger.get(REPEAT_INTERVAL)));
		if (trigger.get(TIMES_TRIGGERED) != null && !trigger.get(TIMES_TRIGGERED).isEmpty())
			simpleTrigger.setTimesTriggered(Integer.parseInt(trigger.get(TIMES_TRIGGERED)));
		
		return simpleTrigger;
	} else if (TRIGGER_TYPE_CRON.equals(trigger.get(TRIGGER_TYPE))) {
		CronTriggerImpl cronTrigger = new CronTriggerImpl();
		setOperableTriggerFields(triggerKey, trigger, cronTrigger);
		if (trigger.get(TIME_ZONE_ID) != null && !trigger.get(TIME_ZONE_ID).isEmpty())
			cronTrigger.getTimeZone().setID(trigger.get(TIME_ZONE_ID).isEmpty() ? null : trigger.get(TIME_ZONE_ID));
		try {
			if (trigger.get(CRON_EXPRESSION) != null && !trigger.get(CRON_EXPRESSION).isEmpty())
				cronTrigger.setCronExpression(trigger.get(CRON_EXPRESSION).isEmpty() ? null : trigger.get(CRON_EXPRESSION));
		} catch (ParseException ex) {
			log.warn("could not parse cron_expression: " + trigger.get(CRON_EXPRESSION) + " for trigger: " + createTriggerHashKey(triggerKey.getGroup(), triggerKey.getName()));
		}
		
		return cronTrigger;					
	} else { // other trigger types are not supported
		 throw new UnsupportedOperationException();
	}
}