Commit 8c48bb1f authored by Roberto Loayza Miljanovich's avatar Roberto Loayza Miljanovich

Merge branch 'dev_marcos' into 'developer'

Dev marcos

See merge request ByteBot/web/bytebot-service!18
parents e0102006 0f43298e
...@@ -50,10 +50,10 @@ public class SchedulerTask implements Serializable { ...@@ -50,10 +50,10 @@ public class SchedulerTask implements Serializable {
@Column(name= "cale_id") @Column(name= "cale_id")
private String calendarID; private String calendarID;
@ManyToOne(optional = false) // @ManyToOne(optional = false)
@NotFound(action = NotFoundAction.IGNORE) // @NotFound(action = NotFoundAction.IGNORE)
@JoinColumn(name = "CALE_ID", referencedColumnName = "CALE_ID", nullable = false) // @JoinColumn(name = "CALE_ID", referencedColumnName = "CALE_ID", nullable = false)
private Calendar calendar; // private Calendar calendar;
/*@ManyToOne(optional = false) /*@ManyToOne(optional = false)
......
...@@ -12,7 +12,7 @@ import java.util.Optional; ...@@ -12,7 +12,7 @@ import java.util.Optional;
public interface SchedulerTaskRepository extends CrudRepository<SchedulerTask, BigInteger>, JpaSpecificationExecutor<SchedulerTask> { public interface SchedulerTaskRepository extends CrudRepository<SchedulerTask, BigInteger>, JpaSpecificationExecutor<SchedulerTask> {
@Query("select b from SchedulerTask b where b.calendar.id = :calendarId") @Query("select b from SchedulerTask b where b.calendarID = :calendarId")
Optional<List<SchedulerTask>> findByCalendarId(@Param("calendarId") String calendarId); Optional<List<SchedulerTask>> findByCalendarId(@Param("calendarId") String calendarId);
@Query("select b from SchedulerTask b where b.processETL = :processId") @Query("select b from SchedulerTask b where b.processETL = :processId")
......
...@@ -128,11 +128,11 @@ public class CalendarService extends XDFService<Calendar, CalendarBean, String> ...@@ -128,11 +128,11 @@ 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()) {
weekIds.add(weekSchedulerOptional.get().getId());
if (delete) { if (delete) {
this.weekSchedulerRepository.delete(weekSchedulerOptional.get()); this.weekSchedulerRepository.delete(weekSchedulerOptional.get());
continue; continue;
} }
weekIds.add(weekSchedulerOptional.get().getId());
weekScheduler = weekSchedulerOptional.get(); weekScheduler = weekSchedulerOptional.get();
} else { } else {
weekScheduler = new WeekScheduler(); weekScheduler = new WeekScheduler();
...@@ -158,7 +158,7 @@ public class CalendarService extends XDFService<Calendar, CalendarBean, String> ...@@ -158,7 +158,7 @@ public class CalendarService extends XDFService<Calendar, CalendarBean, String>
if (weekSchedulerBeanListBD.isPresent()){ if (weekSchedulerBeanListBD.isPresent()){
for (WeekScheduler weekScheduler: weekSchedulerBeanListBD.get()) { for (WeekScheduler weekScheduler: weekSchedulerBeanListBD.get()) {
if (!weekIds.contains(weekScheduler.getId())) { if (!weekIds.contains(weekScheduler.getId())) {
weekSchedulerRepository.deleteById(weekScheduler.getId()); weekSchedulerRepository.deleteById(weekScheduler.getId());
} }
} }
} }
...@@ -174,6 +174,9 @@ public class CalendarService extends XDFService<Calendar, CalendarBean, String> ...@@ -174,6 +174,9 @@ public class CalendarService extends XDFService<Calendar, CalendarBean, String>
if (calendarExceptionBean.getId() != null) { if (calendarExceptionBean.getId() != null) {
Optional<CalendarException> calendarExceptionOptional = calendarExceptionRepository.findById(calendarExceptionBean.getId()); Optional<CalendarException> calendarExceptionOptional = calendarExceptionRepository.findById(calendarExceptionBean.getId());
if (calendarExceptionOptional.isPresent()) {
exceptionIds.add(calendarExceptionBean.getId());
}
if (calendarExceptionBean.isDelete()) { if (calendarExceptionBean.isDelete()) {
calendarExceptionRepository.delete(calendarExceptionOptional.get()); calendarExceptionRepository.delete(calendarExceptionOptional.get());
continue; continue;
...@@ -183,7 +186,6 @@ public class CalendarService extends XDFService<Calendar, CalendarBean, String> ...@@ -183,7 +186,6 @@ public class CalendarService extends XDFService<Calendar, CalendarBean, String>
if (!calendarExceptionOptional.get().getFrequencyType().equals(calendarExceptionBean.getFrequencyType())) { if (!calendarExceptionOptional.get().getFrequencyType().equals(calendarExceptionBean.getFrequencyType())) {
calendarExceptionRepository.delete(calendarExceptionOptional.get()); calendarExceptionRepository.delete(calendarExceptionOptional.get());
} else { } else {
exceptionIds.add(calendarExceptionBean.getId());
calendarExceptionBean.setCalendar(bean); calendarExceptionBean.setCalendar(bean);
calendarException = calendarExceptionService.toModel(calendarExceptionOptional.get(), calendarExceptionBean); calendarException = calendarExceptionService.toModel(calendarExceptionOptional.get(), calendarExceptionBean);
calendarExceptionRepository.save(calendarException); calendarExceptionRepository.save(calendarException);
......
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