Commit cf1a0441 authored by jgomez's avatar jgomez

SchedulerTask

Arreglo en recuperacion de nombre de calendario
parent 5085570f
......@@ -20,9 +20,6 @@ import java.util.*;
@Transactional
public class SchedulerTaskService extends XDFService<SchedulerTask, SchedulerTaskBean, BigInteger> {
@Autowired
private CalendarService calendarService;
@Autowired
private CalendarService CalendarService;
......@@ -45,14 +42,12 @@ public class SchedulerTaskService extends XDFService<SchedulerTask, SchedulerTas
throw new NotFoundException("Calendar can not be null");
}
Optional<Calendar> calendarOptional = this.calendarRepository.findById(bean.getCalendarID());
if (!calendarOptional.isPresent()) {
throw new NotFoundException("Calendar not found " + bean.getCalendarID());
}
model.setCalendar(calendarOptional.get());
return model;
}
......@@ -61,13 +56,11 @@ public class SchedulerTaskService extends XDFService<SchedulerTask, SchedulerTas
SchedulerTaskBean bean = new SchedulerTaskBean();
BeanUtils.copyProperties(model, bean);
bean.setInternals(model.getInternals().booleanValue() ? "Y" : "N");
// bean.setCalendar(model.getCalendar().getId());
Optional<Calendar> found = this.calendarRepository.findById(bean.getCalendarID());
// Optional<Calendar> calendarModel = this.calendarRepository.findCalendarById("C-MSG");
if (found.isPresent()){
bean.setCalendarName(found.get().getName());
}else{
bean.setCalendarName("Sigue intenetando");
CalendarBean found = this.CalendarService.getById(bean.getCalendarID().trim());
if(found != null){
bean.setCalendarName(found.getName());
}
return bean;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment