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.*; ...@@ -20,9 +20,6 @@ import java.util.*;
@Transactional @Transactional
public class SchedulerTaskService extends XDFService<SchedulerTask, SchedulerTaskBean, BigInteger> { public class SchedulerTaskService extends XDFService<SchedulerTask, SchedulerTaskBean, BigInteger> {
@Autowired
private CalendarService calendarService;
@Autowired @Autowired
private CalendarService CalendarService; private CalendarService CalendarService;
...@@ -45,14 +42,12 @@ public class SchedulerTaskService extends XDFService<SchedulerTask, SchedulerTas ...@@ -45,14 +42,12 @@ public class SchedulerTaskService extends XDFService<SchedulerTask, SchedulerTas
throw new NotFoundException("Calendar can not be null"); throw new NotFoundException("Calendar can not be null");
} }
Optional<Calendar> calendarOptional = this.calendarRepository.findById(bean.getCalendarID()); Optional<Calendar> calendarOptional = this.calendarRepository.findById(bean.getCalendarID());
if (!calendarOptional.isPresent()) { if (!calendarOptional.isPresent()) {
throw new NotFoundException("Calendar not found " + bean.getCalendarID()); throw new NotFoundException("Calendar not found " + bean.getCalendarID());
} }
model.setCalendar(calendarOptional.get()); model.setCalendar(calendarOptional.get());
return model; return model;
} }
...@@ -61,13 +56,11 @@ public class SchedulerTaskService extends XDFService<SchedulerTask, SchedulerTas ...@@ -61,13 +56,11 @@ public class SchedulerTaskService extends XDFService<SchedulerTask, SchedulerTas
SchedulerTaskBean bean = new SchedulerTaskBean(); SchedulerTaskBean bean = new SchedulerTaskBean();
BeanUtils.copyProperties(model, bean); BeanUtils.copyProperties(model, bean);
bean.setInternals(model.getInternals().booleanValue() ? "Y" : "N"); bean.setInternals(model.getInternals().booleanValue() ? "Y" : "N");
// bean.setCalendar(model.getCalendar().getId());
Optional<Calendar> found = this.calendarRepository.findById(bean.getCalendarID()); CalendarBean found = this.CalendarService.getById(bean.getCalendarID().trim());
// Optional<Calendar> calendarModel = this.calendarRepository.findCalendarById("C-MSG");
if (found.isPresent()){ if(found != null){
bean.setCalendarName(found.get().getName()); bean.setCalendarName(found.getName());
}else{
bean.setCalendarName("Sigue intenetando");
} }
return bean; 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