CronTriggerFactoryBean allows 'calendarName' and 'description' to be specified

Also making 'description' available on SimpleTriggerFactoryBean.

Issue: SPR-9771
This commit is contained in:
Juergen Hoeller 2014-01-13 23:18:31 +01:00
parent 477e60f28a
commit 7502ecd35e
2 changed files with 33 additions and 0 deletions

View File

@ -84,10 +84,14 @@ public class CronTriggerFactoryBean implements FactoryBean<CronTrigger>, BeanNam
private TimeZone timeZone; private TimeZone timeZone;
private String calendarName;
private int priority; private int priority;
private int misfireInstruction; private int misfireInstruction;
private String description;
private String beanName; private String beanName;
private CronTrigger cronTrigger; private CronTrigger cronTrigger;
@ -174,6 +178,13 @@ public class CronTriggerFactoryBean implements FactoryBean<CronTrigger>, BeanNam
this.timeZone = timeZone; this.timeZone = timeZone;
} }
/**
* Associate a specific calendar with this cron trigger.
*/
public void setCalendarName(String calendarName) {
this.calendarName = calendarName;
}
/** /**
* Specify the priority of this trigger. * Specify the priority of this trigger.
*/ */
@ -200,6 +211,13 @@ public class CronTriggerFactoryBean implements FactoryBean<CronTrigger>, BeanNam
this.misfireInstruction = constants.asNumber(constantName).intValue(); this.misfireInstruction = constants.asNumber(constantName).intValue();
} }
/**
* Associate a textual description with this trigger.
*/
public void setDescription(String description) {
this.description = description;
}
public void setBeanName(String beanName) { public void setBeanName(String beanName) {
this.beanName = beanName; this.beanName = beanName;
} }
@ -231,8 +249,10 @@ public class CronTriggerFactoryBean implements FactoryBean<CronTrigger>, BeanNam
cti.setStartTime(this.startTime); cti.setStartTime(this.startTime);
cti.setCronExpression(this.cronExpression); cti.setCronExpression(this.cronExpression);
cti.setTimeZone(this.timeZone); cti.setTimeZone(this.timeZone);
cti.setCalendarName(this.calendarName);
cti.setPriority(this.priority); cti.setPriority(this.priority);
cti.setMisfireInstruction(this.misfireInstruction); cti.setMisfireInstruction(this.misfireInstruction);
cti.setDescription(this.description);
this.cronTrigger = cti; this.cronTrigger = cti;
*/ */
@ -264,8 +284,10 @@ public class CronTriggerFactoryBean implements FactoryBean<CronTrigger>, BeanNam
pvs.add("startTime", this.startTime); pvs.add("startTime", this.startTime);
pvs.add("cronExpression", this.cronExpression); pvs.add("cronExpression", this.cronExpression);
pvs.add("timeZone", this.timeZone); pvs.add("timeZone", this.timeZone);
pvs.add("calendarName", this.calendarName);
pvs.add("priority", this.priority); pvs.add("priority", this.priority);
pvs.add("misfireInstruction", this.misfireInstruction); pvs.add("misfireInstruction", this.misfireInstruction);
pvs.add("description", this.description);
bw.setPropertyValues(pvs); bw.setPropertyValues(pvs);
this.cronTrigger = (CronTrigger) bw.getWrappedInstance(); this.cronTrigger = (CronTrigger) bw.getWrappedInstance();
} }

View File

@ -87,6 +87,8 @@ public class SimpleTriggerFactoryBean implements FactoryBean<SimpleTrigger>, Bea
private int misfireInstruction; private int misfireInstruction;
private String description;
private String beanName; private String beanName;
private SimpleTrigger simpleTrigger; private SimpleTrigger simpleTrigger;
@ -204,6 +206,13 @@ public class SimpleTriggerFactoryBean implements FactoryBean<SimpleTrigger>, Bea
this.misfireInstruction = constants.asNumber(constantName).intValue(); this.misfireInstruction = constants.asNumber(constantName).intValue();
} }
/**
* Associate a textual description with this trigger.
*/
public void setDescription(String description) {
this.description = description;
}
public void setBeanName(String beanName) { public void setBeanName(String beanName) {
this.beanName = beanName; this.beanName = beanName;
} }
@ -234,6 +243,7 @@ public class SimpleTriggerFactoryBean implements FactoryBean<SimpleTrigger>, Bea
sti.setRepeatCount(this.repeatCount); sti.setRepeatCount(this.repeatCount);
sti.setPriority(this.priority); sti.setPriority(this.priority);
sti.setMisfireInstruction(this.misfireInstruction); sti.setMisfireInstruction(this.misfireInstruction);
cti.setDescription(this.description);
this.simpleTrigger = sti; this.simpleTrigger = sti;
*/ */
@ -267,6 +277,7 @@ public class SimpleTriggerFactoryBean implements FactoryBean<SimpleTrigger>, Bea
pvs.add("repeatCount", this.repeatCount); pvs.add("repeatCount", this.repeatCount);
pvs.add("priority", this.priority); pvs.add("priority", this.priority);
pvs.add("misfireInstruction", this.misfireInstruction); pvs.add("misfireInstruction", this.misfireInstruction);
pvs.add("description", this.description);
bw.setPropertyValues(pvs); bw.setPropertyValues(pvs);
this.simpleTrigger = (SimpleTrigger) bw.getWrappedInstance(); this.simpleTrigger = (SimpleTrigger) bw.getWrappedInstance();
} }