Commit a577f209 authored by jgomez's avatar jgomez

SchedulerTask, calendar, calendarExeption

Correccion de dependencias.
parent d07682b4
...@@ -13,12 +13,15 @@ import java.util.List; ...@@ -13,12 +13,15 @@ import java.util.List;
public class CalendarBean implements Serializable { public class CalendarBean implements Serializable {
@Expose @Expose
private String id; private String id;
@Expose private long version; @Expose
@Expose private String name; private long version;
// @TODO: Revisar List<WeekScheduler> weekSchedulerList de la clase Calendar @Expose
// @Expose private List<WeekSchedulerBean> weekSchedulerBeanList; private String name;
// @Expose private List<CalendarExceptionBean> calendarExceptionBeanList;
//@TODO: Revisar List<WeekScheduler> weekSchedulerList de la clase Calendar
@Expose private List<String> weekSchedulerBeanList; @Expose
@Expose private List<String> calendarExceptionBeanList; private List<WeekSchedulerBean> weekSchedulerBeanList;
@Expose
private List<CalendarExceptionBean> calendarExceptionBeanList;
} }
\ No newline at end of file
...@@ -13,23 +13,38 @@ import java.time.OffsetDateTime; ...@@ -13,23 +13,38 @@ import java.time.OffsetDateTime;
public class CalendarExceptionBean { public class CalendarExceptionBean {
@Expose @Expose
private BigInteger id; private BigInteger id;
@Expose private long version; @Expose
@Expose private String description; private long version;
//@Expose private CalendarBean calendar; @Expose
@Expose private String calendar; private String description;
@Expose private String calendarExceptionType; @Expose
private CalendarBean calendar;
@Expose
private String calendarExceptionType;
//Frecuencia //Frecuencia
@Expose private String frequencyType; @Expose
private String frequencyType;
//annualCalendar y UniqueWeekly //annualCalendar y UniqueWeekly
@Expose private int month; @Expose
@Expose private int dayOfMonth; private int month;
@Expose private int weekOfMonth; @Expose
@Expose private int dayOfWeek; private int dayOfMonth;
@Expose
private int weekOfMonth;
@Expose
private int dayOfWeek;
//UniqueCalendar //UniqueCalendar
@Expose private LocalDate date; @Expose
//rangeCalendar private LocalDate date;
@Expose private OffsetDateTime from;
@Expose private OffsetDateTime to;
@Expose private boolean delete;
//rangeCalendar
@Expose
private OffsetDateTime from;
@Expose
private OffsetDateTime to;
@Expose
private boolean delete;
} }
...@@ -12,10 +12,15 @@ import java.time.OffsetTime; ...@@ -12,10 +12,15 @@ import java.time.OffsetTime;
public class WeekSchedulerBean { public class WeekSchedulerBean {
@Expose @Expose
private BigInteger id; private BigInteger id;
@Expose private long version; @Expose
@Expose private int dayOfWeek; private long version;
@Expose private OffsetTime from; @Expose
@Expose private OffsetTime to; private int dayOfWeek;
//@Expose private CalendarBean calendar; @Expose
@Expose private String calendar; private OffsetTime from;
@Expose
private OffsetTime to;
@Expose
private CalendarBean calendar;
} }
...@@ -32,9 +32,7 @@ public class Calendar implements Serializable { ...@@ -32,9 +32,7 @@ public class Calendar implements Serializable {
@Column(name = "cale_name", nullable = false) @Column(name = "cale_name", nullable = false)
private String name; private String name;
// @OneToMany(mappedBy = "calendar")
// private List<WeekScheduler> weekSchedulerList;
@OneToMany(mappedBy = "calendar") @OneToMany(mappedBy = "calendar")
private List<String> weekSchedulerList; private List<WeekScheduler> weekSchedulerList;
} }
package com.bytesw.bytebot.model; package com.bytesw.bytebot.model;
import com.bytesw.bytebot.model.converters.CalendarExceptionTypeConverter;
import com.bytesw.bytebot.model.enums.CalendarExceptionType;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
...@@ -35,9 +37,8 @@ public abstract class CalendarException implements Serializable { ...@@ -35,9 +37,8 @@ public abstract class CalendarException implements Serializable {
private long version; private long version;
@Column(name = "CALE_EXC_TYPE") @Column(name = "CALE_EXC_TYPE")
//@Convert(converter = CalendarExceptionTypeConverter.class) @Convert(converter = CalendarExceptionTypeConverter.class)
//private CalendarExceptionType calendarExceptionType; private CalendarExceptionType calendarExceptionType;
private String calendarExceptionType;
@Column(name = "CALE_EXC_FRECU", insertable = false, updatable = false) @Column(name = "CALE_EXC_FRECU", insertable = false, updatable = false)
private String frequencyType; private String frequencyType;
...@@ -47,6 +48,6 @@ public abstract class CalendarException implements Serializable { ...@@ -47,6 +48,6 @@ public abstract class CalendarException implements Serializable {
@ManyToOne(optional = false) @ManyToOne(optional = false)
@JoinColumn(name = "CALE_ID", referencedColumnName = "CALE_ID", nullable = false) @JoinColumn(name = "CALE_ID", referencedColumnName = "CALE_ID", nullable = false)
//private Calendar calendar; private Calendar calendar;
private String calendar;
} }
\ No newline at end of file
...@@ -45,11 +45,8 @@ public class SchedulerTask implements Serializable { ...@@ -45,11 +45,8 @@ public class SchedulerTask implements Serializable {
@Column(name = "SHTA_PARAM") @Column(name = "SHTA_PARAM")
private String stringParameters; private String stringParameters;
// @ManyToOne(optional = false)
// @JoinColumn(name = "CALE_ID", referencedColumnName = "CALE_ID", nullable = false)
// private Calendar calendar;
@ManyToOne(optional = false) @ManyToOne(optional = false)
@JoinColumn(name = "CALE_ID", referencedColumnName = "CALE_ID", nullable = false) @JoinColumn(name = "CALE_ID", referencedColumnName = "CALE_ID", nullable = false)
private String calendar; private Calendar calendar;
} }
...@@ -43,7 +43,6 @@ public class WeekScheduler implements Serializable { ...@@ -43,7 +43,6 @@ public class WeekScheduler implements Serializable {
@ManyToOne(optional = false) @ManyToOne(optional = false)
@JoinColumn(name = "CALE_ID", referencedColumnName = "CALE_ID", nullable = false) @JoinColumn(name = "CALE_ID", referencedColumnName = "CALE_ID", nullable = false)
//private Calendar calendar; private Calendar calendar;
private String calendar;
} }
package com.bytesw.bytebot.model.converters;
import com.bytesw.bytebot.model.enums.CalendarExceptionType;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
/**
* @author Renzo Carranza
* @version 26/08/2021
* <p>
* Copyright (c) 2019 Byte, S.A. Todos los derechos reservados.
* <p>
* Este software constituye información confidencial y propietaria de Byte, S.A.
* ("Información Confidencial"). Usted no debe develar dicha Información
* Confidencial y debe usarla de acuerdo con los términos de aceptación de
* licencia de uso que firmó con Byte.
*/
@Converter
public class CalendarExceptionTypeConverter implements AttributeConverter<CalendarExceptionType, String> {
@Override
public String convertToDatabaseColumn(CalendarExceptionType calendarExceptionType) {
if (calendarExceptionType == null) return null;
return calendarExceptionType.getName();
}
@Override
public CalendarExceptionType convertToEntityAttribute(String s) {
return CalendarExceptionType.fromString(s);
}
}
package com.bytesw.bytebot.repository; package com.bytesw.bytebot.repository;
import com.bytesw.bytebot.model.CalendarException; import com.bytesw.bytebot.model.CalendarException;
import com.bytesw.bytebot.model.enums.CalendarExceptionType;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.CrudRepository;
...@@ -13,7 +14,8 @@ import java.util.List; ...@@ -13,7 +14,8 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
public interface CalendarExceptionRepository extends CrudRepository<CalendarException, BigInteger>, JpaSpecificationExecutor<CalendarException> { public interface CalendarExceptionRepository extends CrudRepository<CalendarException, BigInteger>, JpaSpecificationExecutor<CalendarException> {
/*@Query("select s from RangeCalendarException s where s.calendar.id = :calendarId and s.from < :date and s.to > :date and s.calendarExceptionType = :type")
@Query("select s from RangeCalendarException s where s.calendar.id = :calendarId and s.from < :date and s.to > :date and s.calendarExceptionType = :type")
Optional<CalendarException> findByRangeExceptionByCalendarIdAndDateAndType(@Param("calendarId") String calendarId, @Param("date") OffsetDateTime date, @Param("type") CalendarExceptionType type); Optional<CalendarException> findByRangeExceptionByCalendarIdAndDateAndType(@Param("calendarId") String calendarId, @Param("date") OffsetDateTime date, @Param("type") CalendarExceptionType type);
@Query("select s from AnnualCalendarException s where s.calendar.id = :calendarId and s.month = :month and s.dayOfMonth = :dayOfMonth") @Query("select s from AnnualCalendarException s where s.calendar.id = :calendarId and s.month = :month and s.dayOfMonth = :dayOfMonth")
...@@ -29,6 +31,6 @@ public interface CalendarExceptionRepository extends CrudRepository<CalendarExce ...@@ -29,6 +31,6 @@ public interface CalendarExceptionRepository extends CrudRepository<CalendarExce
Optional<CalendarException> findByRangeExceptionByCalendarIdFromDateAndType(@Param("calendarId") String calendarId, @Param("date") OffsetDateTime date, @Param("type") CalendarExceptionType type); Optional<CalendarException> findByRangeExceptionByCalendarIdFromDateAndType(@Param("calendarId") String calendarId, @Param("date") OffsetDateTime date, @Param("type") CalendarExceptionType type);
@Query("select s from CalendarException s where s.calendar.id = :calendarId") @Query("select s from CalendarException s where s.calendar.id = :calendarId")
Optional<List<CalendarException>> findByCalendarId(@Param("calendarId") String calendarId);*/ Optional<List<CalendarException>> findByCalendarId(@Param("calendarId") String calendarId);
} }
...@@ -11,6 +11,6 @@ import java.util.List; ...@@ -11,6 +11,6 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
public interface WeekSchedulerRepository extends CrudRepository<WeekScheduler, BigInteger>, JpaSpecificationExecutor<WeekScheduler> { public interface WeekSchedulerRepository extends CrudRepository<WeekScheduler, BigInteger>, JpaSpecificationExecutor<WeekScheduler> {
//@Query("select b from WeekScheduler b where b.calendar.id = :caleId") @Query("select b from WeekScheduler b where b.calendar.id = :caleId")
//Optional<List<WeekScheduler>> findByCalendarId(@Param("caleId") String caleId); Optional<List<WeekScheduler>> findByCalendarId(@Param("caleId") String caleId);
} }
...@@ -2,8 +2,10 @@ package com.bytesw.bytebot.service; ...@@ -2,8 +2,10 @@ package com.bytesw.bytebot.service;
import com.bytesw.bytebot.bean.CalendarExceptionBean; import com.bytesw.bytebot.bean.CalendarExceptionBean;
import com.bytesw.bytebot.model.*; import com.bytesw.bytebot.model.*;
import com.bytesw.bytebot.model.Calendar;
import com.bytesw.bytebot.model.enums.CalendarExceptionType; import com.bytesw.bytebot.model.enums.CalendarExceptionType;
import com.bytesw.bytebot.repository.CalendarExceptionRepository; import com.bytesw.bytebot.repository.CalendarExceptionRepository;
import com.bytesw.bytebot.repository.CalendarRepository;
import com.bytesw.xdf.dao.rsql.CustomRsqlVisitor; import com.bytesw.xdf.dao.rsql.CustomRsqlVisitor;
import com.bytesw.xdf.exception.NotFoundException; import com.bytesw.xdf.exception.NotFoundException;
import com.bytesw.xdf.service.XDFService; import com.bytesw.xdf.service.XDFService;
...@@ -23,18 +25,15 @@ import java.util.*; ...@@ -23,18 +25,15 @@ import java.util.*;
@Transactional @Transactional
public class CalendarExceptionService extends XDFService<CalendarException, CalendarExceptionBean, BigInteger> { public class CalendarExceptionService extends XDFService<CalendarException, CalendarExceptionBean, BigInteger> {
//@Autowired @Autowired
//CalendarRepository calendarRepository; CalendarRepository calendarRepository;
//@Autowired @Autowired
//CalendarService gatewayCalendarService; CalendarService calendarService;
@Autowired @Autowired
CalendarExceptionRepository calendarExceptionRepository; CalendarExceptionRepository calendarExceptionRepository;
//@Autowired
//BusinessFlowService businessFlowService;
protected CalendarExceptionService(CalendarExceptionRepository repository) { protected CalendarExceptionService(CalendarExceptionRepository repository) {
super(repository); super(repository);
} }
...@@ -49,7 +48,7 @@ public class CalendarExceptionService extends XDFService<CalendarException, Cale ...@@ -49,7 +48,7 @@ public class CalendarExceptionService extends XDFService<CalendarException, Cale
if (bean.getCalendar() == null) { if (bean.getCalendar() == null) {
throw new NotFoundException("Calendar can not be null"); throw new NotFoundException("Calendar can not be null");
} }
Optional<Calendar> calendarOptional = calendarRepository.findById(bean.getCalendar().getId()); Optional<Calendar> calendarOptional = this.calendarRepository.findById(bean.getCalendar().getId());
if (!calendarOptional.isPresent()) { if (!calendarOptional.isPresent()) {
throw new NotFoundException("Calendar not found " + bean.getCalendar().getId()); throw new NotFoundException("Calendar not found " + bean.getCalendar().getId());
} }
...@@ -86,7 +85,6 @@ public class CalendarExceptionService extends XDFService<CalendarException, Cale ...@@ -86,7 +85,6 @@ public class CalendarExceptionService extends XDFService<CalendarException, Cale
CalendarExceptionBean bean = new CalendarExceptionBean(); CalendarExceptionBean bean = new CalendarExceptionBean();
BeanUtils.copyProperties(model, bean); BeanUtils.copyProperties(model, bean);
bean.setCalendar(this.calendarService.toBean(model.getCalendar())); bean.setCalendar(this.calendarService.toBean(model.getCalendar()));
bean.setCalendarExceptionType(model.getCalendarExceptionType().getName()); bean.setCalendarExceptionType(model.getCalendarExceptionType().getName());
bean.setFrequencyType(model.getFrequencyType()); bean.setFrequencyType(model.getFrequencyType());
return bean; return bean;
......
package com.bytesw.bytebot.service; package com.bytesw.bytebot.service;
import com.bytesw.bytebot.bean.CalendarBean; import com.bytesw.bytebot.bean.CalendarBean;
import com.bytesw.bytebot.bean.CalendarExceptionBean;
import com.bytesw.bytebot.bean.WeekSchedulerBean;
import com.bytesw.bytebot.model.Calendar; import com.bytesw.bytebot.model.Calendar;
import com.bytesw.bytebot.model.CalendarException;
import com.bytesw.bytebot.model.SchedulerTask;
import com.bytesw.bytebot.model.WeekScheduler;
import com.bytesw.bytebot.repository.CalendarExceptionRepository;
import com.bytesw.bytebot.repository.CalendarRepository; import com.bytesw.bytebot.repository.CalendarRepository;
import com.bytesw.bytebot.repository.SchedulerTaskRepository;
import com.bytesw.bytebot.repository.WeekSchedulerRepository;
import com.bytesw.xdf.exception.AlreadyExistsException; import com.bytesw.xdf.exception.AlreadyExistsException;
import com.bytesw.xdf.exception.NotFoundException; import com.bytesw.xdf.exception.NotFoundException;
import com.bytesw.xdf.exception.ReferentialIntegrityException; import com.bytesw.xdf.exception.ReferentialIntegrityException;
...@@ -12,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -12,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.transaction.Transactional; import javax.transaction.Transactional;
import java.util.List;
import java.util.Optional; import java.util.Optional;
@Service @Service
...@@ -20,15 +29,19 @@ public class CalendarService extends XDFService<Calendar, CalendarBean, String> ...@@ -20,15 +29,19 @@ public class CalendarService extends XDFService<Calendar, CalendarBean, String>
@Autowired @Autowired
private WeekSchedulerService weekSchedulerService; private WeekSchedulerService weekSchedulerService;
@Autowired @Autowired
private WeekSchedulerRepository weekSchedulerRepository; private WeekSchedulerRepository weekSchedulerRepository;
@Autowired @Autowired
private SchedulerTaskRepository schedulerTaskRepository; private SchedulerTaskRepository schedulerTaskRepository;
@Autowired @Autowired
private CalendarExceptionRepository calendarExceptionRepository; private CalendarExceptionRepository calendarExceptionRepository;
@Autowired @Autowired
private CalendarRepository calendarRepository; private CalendarRepository calendarRepository;
@Autowired @Autowired
private CalendarExceptionService calendarExceptionService; private CalendarExceptionService calendarExceptionService;
...@@ -76,7 +89,7 @@ public class CalendarService extends XDFService<Calendar, CalendarBean, String> ...@@ -76,7 +89,7 @@ public class CalendarService extends XDFService<Calendar, CalendarBean, String>
@Override @Override
public CalendarBean create(CalendarBean bean) { public CalendarBean create(CalendarBean bean) {
if( this.calendarRepository.existsById(bean.getId())) { if (this.calendarRepository.existsById(bean.getId())) {
throw new AlreadyExistsException("errors.form.duplicated.id"); throw new AlreadyExistsException("errors.form.duplicated.id");
} }
Calendar model = new Calendar(); Calendar model = new Calendar();
...@@ -109,7 +122,7 @@ public class CalendarService extends XDFService<Calendar, CalendarBean, String> ...@@ -109,7 +122,7 @@ public class CalendarService extends XDFService<Calendar, CalendarBean, String>
if (weekSchedulerBean.getId() != null) { if (weekSchedulerBean.getId() != null) {
Optional<WeekScheduler> weekSchedulerOptional = this.weekSchedulerRepository.findById(weekSchedulerBean.getId()); Optional<WeekScheduler> weekSchedulerOptional = this.weekSchedulerRepository.findById(weekSchedulerBean.getId());
if (weekSchedulerOptional.isPresent()) { if (weekSchedulerOptional.isPresent()) {
if(delete){ if (delete) {
this.weekSchedulerRepository.delete(weekSchedulerOptional.get()); this.weekSchedulerRepository.delete(weekSchedulerOptional.get());
continue; continue;
} }
...@@ -157,6 +170,7 @@ public class CalendarService extends XDFService<Calendar, CalendarBean, String> ...@@ -157,6 +170,7 @@ public class CalendarService extends XDFService<Calendar, CalendarBean, String>
} }
} }
// Nueva excepción // Nueva excepción
calendarException = calendarExceptionService.getCalendarException(calendarExceptionBean); calendarException = calendarExceptionService.getCalendarException(calendarExceptionBean);
calendarExceptionBean.setCalendar(bean); calendarExceptionBean.setCalendar(bean);
......
package com.bytesw.bytebot.service; package com.bytesw.bytebot.service;
import com.bytesw.bytebot.bean.CalendarBean;
import com.bytesw.bytebot.bean.SchedulerTaskBean; import com.bytesw.bytebot.bean.SchedulerTaskBean;
import com.bytesw.bytebot.model.Calendar;
import com.bytesw.bytebot.model.SchedulerTask; import com.bytesw.bytebot.model.SchedulerTask;
import com.bytesw.bytebot.repository.CalendarRepository;
import com.bytesw.bytebot.repository.SchedulerTaskRepository; import com.bytesw.bytebot.repository.SchedulerTaskRepository;
import com.bytesw.xdf.exception.NotFoundException; import com.bytesw.xdf.exception.NotFoundException;
import com.bytesw.xdf.service.XDFService; import com.bytesw.xdf.service.XDFService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -16,12 +20,14 @@ import java.util.*; ...@@ -16,12 +20,14 @@ import java.util.*;
@Transactional @Transactional
public class SchedulerTaskService extends XDFService<SchedulerTask, SchedulerTaskBean, BigInteger> { public class SchedulerTaskService extends XDFService<SchedulerTask, SchedulerTaskBean, BigInteger> {
// @Autowired @Autowired
// private CalendarService calendarService; private CalendarService calendarService;
// @Autowired
// private CalendarService CalendarService; @Autowired
// @Autowired private CalendarService CalendarService;
// private CalendarRepository calendarRepository;
@Autowired
private CalendarRepository calendarRepository;
protected SchedulerTaskService(SchedulerTaskRepository repository) { protected SchedulerTaskService(SchedulerTaskRepository repository) {
super(repository); super(repository);
...@@ -35,14 +41,14 @@ public class SchedulerTaskService extends XDFService<SchedulerTask, SchedulerTas ...@@ -35,14 +41,14 @@ public class SchedulerTaskService extends XDFService<SchedulerTask, SchedulerTas
BeanUtils.copyProperties(bean, model); BeanUtils.copyProperties(bean, model);
model.setInternals("Y".equals(bean.getInternals())); model.setInternals("Y".equals(bean.getInternals()));
// Optional<Calendar> calendarOptional = calendarRepository.findById(bean.getCalendar()); if (bean.getCalendar() == null) {
// if (!calendarOptional.isPresent()) { throw new NotFoundException("Calendar can not be null");
// throw new NotFoundException("Calendar not found " + bean.getCalendar()); }
// } Optional<Calendar> calendarOptional = this.calendarRepository.findById(bean.getCalendar());
// model.setCalendar(calendarOptional.get()); if (!calendarOptional.isPresent()) {
throw new NotFoundException("Calendar not found " + bean.getCalendar());
model.setCalendar("Mientras Se implementa Calendario en Backend"); }
model.setCalendar(calendarOptional.get());
return model; return model;
} }
...@@ -51,17 +57,13 @@ public class SchedulerTaskService extends XDFService<SchedulerTask, SchedulerTas ...@@ -51,17 +57,13 @@ 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()); bean.setCalendar(model.getCalendar().getId());
bean.setCalendar(model.getCalendar()); bean.setCalendarName(model.getCalendar().getName());
// bean.setCalendarName(model.getCalendar().getName());
bean.setCalendarName(model.getCalendar());
return bean; return bean;
} }
public Map<String, List> getInitialData() { public Map<String, List> getInitialData() {
// List<CalendarBean> calendarBeanList = CalendarService.getAll(); List<CalendarBean> calendarBeanList = this.CalendarService.getAll();
List<String> calendarBeanList = new ArrayList<>();
calendarBeanList.add("Hola Mundo");
Map<String, List> initialData = new HashMap<>(); Map<String, List> initialData = new HashMap<>();
initialData.put("calendarList", calendarBeanList); initialData.put("calendarList", calendarBeanList);
return initialData; return initialData;
......
package com.bytesw.bytebot.service; package com.bytesw.bytebot.service;
import com.bytesw.bytebot.bean.WeekSchedulerBean; import com.bytesw.bytebot.bean.WeekSchedulerBean;
import com.bytesw.bytebot.model.Calendar;
import com.bytesw.bytebot.model.WeekScheduler; import com.bytesw.bytebot.model.WeekScheduler;
import com.bytesw.bytebot.repository.CalendarRepository;
import com.bytesw.bytebot.repository.WeekSchedulerRepository; import com.bytesw.bytebot.repository.WeekSchedulerRepository;
import com.bytesw.xdf.exception.NotFoundException; import com.bytesw.xdf.exception.NotFoundException;
import com.bytesw.xdf.service.XDFService; import com.bytesw.xdf.service.XDFService;
...@@ -46,17 +48,17 @@ public class WeekSchedulerService extends XDFService<WeekScheduler, WeekSchedule ...@@ -46,17 +48,17 @@ public class WeekSchedulerService extends XDFService<WeekScheduler, WeekSchedule
return model; return model;
} }
// @Override @Override
// protected WeekSchedulerBean toBean(WeekScheduler model) { protected WeekSchedulerBean toBean(WeekScheduler model) {
// WeekSchedulerBean bean = new WeekSchedulerBean(); WeekSchedulerBean bean = new WeekSchedulerBean();
// BeanUtils.copyProperties(model, bean); BeanUtils.copyProperties(model, bean);
// bean.setCalendar(gatewayCalendarService.toBean(model.getCalendar())); bean.setCalendar(calendarService.toBean(model.getCalendar()));
// return bean; return bean;
// } }
public List<WeekSchedulerBean> getWeekSchedulerByCalId(String caleID) { public List<WeekSchedulerBean> getWeekSchedulerByCalId(String caleID) {
List<WeekSchedulerBean> weekSchedulerBeanList = new ArrayList<>(7); List<WeekSchedulerBean> weekSchedulerBeanList = new ArrayList<>(7);
Optional<List<WeekScheduler>> weekSchedulerOptional = weekSchedulerRepository.findByCalendarId(caleID); Optional<List<WeekScheduler>> weekSchedulerOptional = this.weekSchedulerRepository.findByCalendarId(caleID);
if (!weekSchedulerOptional.isPresent()) { if (!weekSchedulerOptional.isPresent()) {
for (int i = 0; i < 7; i++) { for (int i = 0; i < 7; i++) {
weekSchedulerBeanList.add(i, new WeekSchedulerBean()); weekSchedulerBeanList.add(i, new WeekSchedulerBean());
......
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