我正在使用与JSF,JPA和RichFaces集成的Seam 2.1.2。
在我的应用程序中,我使用的是QuartzTriggerHandle
,我需要从UI控制Trigger
。我应该如何从用户界面执行此操作?
示例代码:
@Override
public String triggerCustomerMigration() {
Calendar cal = Calendar.getInstance();
cal.set(2040, Calendar.MAY, 10);
QuartzTriggerHandle customerHandler = asyncCustomerScheduler
.scheduleCustomerMigration(new Date(), "0 0/6 * * * ?", cal.getTime());
return customerHandler.getTrigger().getName();
}
@Asynchronous
@Transactional
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public QuartzTriggerHandle scheduleCustomerMigration(@Expiration Date when,
@IntervalCron String cron, @FinalExpiration Date endDate)
{
QuartzTriggerHandle handle = new QuartzTriggerHandle(
SystemJobs.MIGRATE_CUSTOMER.getJobName());
PersistenceProvider.instance().setFlushModeManual(getEntityManager());
}