boolean schedule = Boolean.valueOf(getBooleanCheckboxParameter(SCHEDULE)).booleanValue();
if (schedule) {
deleteParameter(SCHEDULE);
String dateString = getParameterAsString(SCHEDULE_TIME);
DateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
UsecaseScheduler scheduler = null;
try {
Date date = null;
try {
date = format.parse(dateString);
} catch (ParseException e) {
addErrorMessage("The scheduler date must be of the form 'yyyy-MM-dd hh:mm:ss'.");
}
if (date != null) {
scheduler = (UsecaseScheduler) this.manager.lookup(UsecaseScheduler.ROLE);
scheduler.schedule(this, date);
}
} finally {
if (scheduler != null) {
this.manager.release(scheduler);
}