* @return IResult
* @throws SchedulerException
*/
public IResult schModify(IRequest request) throws SchedulerException {
AjaxFormResult result = new AjaxFormResult();
BatchSchedule oldSch = batchSrv.findSchById(request.get("schId"));
BatchSchedule newSch = new BatchSchedule();
boolean isnew = (oldSch == null);
if (!isnew) {
CapBeanUtil.copyBean(oldSch, newSch,
CapBeanUtil.getFieldName(BatchSchedule.class, true));
}
CapBeanUtil.map2Bean(request, newSch, BatchSchedule.class);
newSch.setNotifyStatus(CapString.array2String(request
.getParamsAsStringArray("notifyStatus")));
if (!"C".equals(newSch.getSchType())) {
newSch.setCronExpression(null);
newSch.setTimeZoneId(null);
} else if (!"T".equals(newSch.getSchType())) {
newSch.setRepeatCount(0);
newSch.setRepeatInterval(0);
}
if (!newSch.isNotify()) {
newSch.setNotifyStatus(null);
newSch.setNotifyTo(null);
}
newSch.setUpdater(CapSecurityContext.getUserId());
newSch.setUpdateTime(CapDate.getCurrentTimestamp());
if (isnew) {
batchSrv.insertSch(newSch);
} else {
batchSrv.updateSch(newSch);
}