use of org.wso2.carbon.bpel.config.TSchedules in project carbon-business-process by wso2.
the class BPELServerConfiguration method getSystemCleanupCronJobs.
public List<ProcessConf.CronJob> getSystemCleanupCronJobs() {
List<ProcessConf.CronJob> jobs = new ArrayList<ProcessConf.CronJob>();
TSchedules schedules = bpsConfigDocument.getWSO2BPS().getSchedules();
if (schedules != null && schedules.getScheduleArray() != null && schedules.getScheduleArray().length > 0) {
for (TSchedule schedule : schedules.getScheduleArray()) {
ProcessConf.CronJob job = new ProcessConf.CronJob();
try {
job.setCronExpression(new CronExpression(schedule.getWhen()));
for (final TCleanup aCleanup : schedule.getCleanupArray()) {
ProcessConf.CleanupInfo cleanupInfo = new ProcessConf.CleanupInfo();
assert !(aCleanup.getFilterArray().length == 0);
cleanupInfo.setFilters(Arrays.asList(aCleanup.getFilterArray()));
processACleanup(cleanupInfo.getCategories(), Arrays.asList(aCleanup.getCategoryArray()));
Scheduler.JobDetails runnableDetails = new Scheduler.JobDetails();
runnableDetails.getDetailsExt().put(BPELConstants.ODE_DETAILS_EXT_CLEAN_UP_INFO, cleanupInfo);
runnableDetails.getDetailsExt().put(BPELConstants.ODE_DETAILS_EXT_TRANSACTION_SIZE, 10);
job.getRunnableDetailList().add(runnableDetails);
log.info("SYSTEM CRON configuration added a runtime data cleanup: " + runnableDetails);
}
jobs.add(job);
} catch (ParseException e) {
log.error("Exception during parsing the schedule cron expression: " + schedule.getWhen() + ", skipped the scheduled job.");
}
}
}
return jobs;
}
Aggregations