From e18bd760e54553ef0df43dd42931e4228ccb6acc Mon Sep 17 00:00:00 2001 From: Fabio Buracchi <45599613+buracchi@users.noreply.github.com> Date: Sun, 4 Jul 2021 17:30:45 +0200 Subject: [PATCH 1/4] Refactory #100 --- .../cinehub/app/repository/cinema/CinemaProxy.java | 12 ++---------- .../app/repository/customer/CustomerProxy.java | 12 ++---------- .../employee/projectionist/ProjectionistProxy.java | 12 ++---------- .../app/repository/employee/usher/UsherProxy.java | 12 ++---------- .../ttbmp/cinehub/app/repository/hall/HallProxy.java | 12 ++---------- .../cinehub/app/repository/movie/MovieProxy.java | 12 ++---------- .../app/repository/projection/ProjectionProxy.java | 12 ++---------- .../ttbmp/cinehub/app/repository/seat/SeatProxy.java | 2 ++ .../shift/projectionist/ProjectionistShiftProxy.java | 12 ++---------- .../app/repository/shift/usher/UsherShiftProxy.java | 12 ++---------- .../ttbmp/cinehub/app/repository/user/UserProxy.java | 2 ++ 11 files changed, 22 insertions(+), 90 deletions(-) diff --git a/app/src/main/java/com/ttbmp/cinehub/app/repository/cinema/CinemaProxy.java b/app/src/main/java/com/ttbmp/cinehub/app/repository/cinema/CinemaProxy.java index 050f66bd..6dee24a7 100644 --- a/app/src/main/java/com/ttbmp/cinehub/app/repository/cinema/CinemaProxy.java +++ b/app/src/main/java/com/ttbmp/cinehub/app/repository/cinema/CinemaProxy.java @@ -6,12 +6,14 @@ import com.ttbmp.cinehub.app.repository.hall.HallRepository; import com.ttbmp.cinehub.domain.Cinema; import com.ttbmp.cinehub.domain.Hall; +import lombok.EqualsAndHashCode; import java.util.List; /** * @author Fabio Buracchi */ +@EqualsAndHashCode(callSuper = true) public class CinemaProxy extends Cinema { private final HallRepository hallRepository; @@ -41,14 +43,4 @@ public void setHallList(List hallList) { super.setHallList(hallList); } - @Override - public boolean equals(Object obj) { - return super.equals(obj); - } - - @Override - public int hashCode() { - return super.hashCode(); - } - } diff --git a/app/src/main/java/com/ttbmp/cinehub/app/repository/customer/CustomerProxy.java b/app/src/main/java/com/ttbmp/cinehub/app/repository/customer/CustomerProxy.java index 5b7d78d2..e503f111 100644 --- a/app/src/main/java/com/ttbmp/cinehub/app/repository/customer/CustomerProxy.java +++ b/app/src/main/java/com/ttbmp/cinehub/app/repository/customer/CustomerProxy.java @@ -9,12 +9,14 @@ import com.ttbmp.cinehub.domain.security.Permission; import com.ttbmp.cinehub.domain.security.Role; import com.ttbmp.cinehub.domain.ticket.Ticket; +import lombok.EqualsAndHashCode; import java.util.List; /** * @author Fabio Buracchi */ +@EqualsAndHashCode(callSuper = true) public class CustomerProxy extends Customer { private final TicketRepository ticketRepository; @@ -134,14 +136,4 @@ public void setOwnedTicketList(List ownedTicketList) { super.setOwnedTicketList(ownedTicketList); } - @Override - public boolean equals(Object obj) { - return super.equals(obj); - } - - @Override - public int hashCode() { - return super.hashCode(); - } - } diff --git a/app/src/main/java/com/ttbmp/cinehub/app/repository/employee/projectionist/ProjectionistProxy.java b/app/src/main/java/com/ttbmp/cinehub/app/repository/employee/projectionist/ProjectionistProxy.java index 3560d20e..6675fa17 100644 --- a/app/src/main/java/com/ttbmp/cinehub/app/repository/employee/projectionist/ProjectionistProxy.java +++ b/app/src/main/java/com/ttbmp/cinehub/app/repository/employee/projectionist/ProjectionistProxy.java @@ -11,6 +11,7 @@ import com.ttbmp.cinehub.domain.security.Permission; import com.ttbmp.cinehub.domain.security.Role; import com.ttbmp.cinehub.domain.shift.Shift; +import lombok.EqualsAndHashCode; import java.time.LocalDate; import java.util.List; @@ -18,6 +19,7 @@ /** * @author Fabio Buracchi */ +@EqualsAndHashCode(callSuper = true) public class ProjectionistProxy extends Projectionist { private final UserRepository userRepository; @@ -167,14 +169,4 @@ public List getShiftListBetween(LocalDate start, LocalDate end) { } } - @Override - public boolean equals(Object obj) { - return super.equals(obj); - } - - @Override - public int hashCode() { - return super.hashCode(); - } - } diff --git a/app/src/main/java/com/ttbmp/cinehub/app/repository/employee/usher/UsherProxy.java b/app/src/main/java/com/ttbmp/cinehub/app/repository/employee/usher/UsherProxy.java index 9bb1d535..a54609f6 100644 --- a/app/src/main/java/com/ttbmp/cinehub/app/repository/employee/usher/UsherProxy.java +++ b/app/src/main/java/com/ttbmp/cinehub/app/repository/employee/usher/UsherProxy.java @@ -11,6 +11,7 @@ import com.ttbmp.cinehub.domain.security.Permission; import com.ttbmp.cinehub.domain.security.Role; import com.ttbmp.cinehub.domain.shift.Shift; +import lombok.EqualsAndHashCode; import java.time.LocalDate; import java.util.List; @@ -18,6 +19,7 @@ /** * @author Fabio Buracchi */ +@EqualsAndHashCode(callSuper = true) public class UsherProxy extends Usher { private final UserRepository userRepository; @@ -169,14 +171,4 @@ public List getShiftListBetween(LocalDate start, LocalDate end) { } } - @Override - public boolean equals(Object obj) { - return super.equals(obj); - } - - @Override - public int hashCode() { - return super.hashCode(); - } - } diff --git a/app/src/main/java/com/ttbmp/cinehub/app/repository/hall/HallProxy.java b/app/src/main/java/com/ttbmp/cinehub/app/repository/hall/HallProxy.java index e914ac79..505292b7 100644 --- a/app/src/main/java/com/ttbmp/cinehub/app/repository/hall/HallProxy.java +++ b/app/src/main/java/com/ttbmp/cinehub/app/repository/hall/HallProxy.java @@ -6,12 +6,14 @@ import com.ttbmp.cinehub.app.repository.seat.SeatRepository; import com.ttbmp.cinehub.domain.Hall; import com.ttbmp.cinehub.domain.Seat; +import lombok.EqualsAndHashCode; import java.util.List; /** * @author Fabio Buracchi */ +@EqualsAndHashCode(callSuper = true) public class HallProxy extends Hall { private final SeatRepository seatRepository; @@ -41,14 +43,4 @@ public void setSeatList(List seatList) { super.setSeatList(seatList); } - @Override - public int hashCode() { - return super.hashCode(); - } - - @Override - public boolean equals(Object obj) { - return super.equals(obj); - } - } diff --git a/app/src/main/java/com/ttbmp/cinehub/app/repository/movie/MovieProxy.java b/app/src/main/java/com/ttbmp/cinehub/app/repository/movie/MovieProxy.java index e3c5daba..8fa1e77d 100644 --- a/app/src/main/java/com/ttbmp/cinehub/app/repository/movie/MovieProxy.java +++ b/app/src/main/java/com/ttbmp/cinehub/app/repository/movie/MovieProxy.java @@ -5,10 +5,12 @@ import com.ttbmp.cinehub.app.service.movieapi.MovieApiService; import com.ttbmp.cinehub.app.service.movieapi.MovieApiServiceException; import com.ttbmp.cinehub.domain.Movie; +import lombok.EqualsAndHashCode; /** * @author Fabio Buracchi */ +@EqualsAndHashCode(callSuper = true) public class MovieProxy extends Movie { private final MovieApiService movieApiService; @@ -83,14 +85,4 @@ private void loadMovie() { } } - @Override - public int hashCode() { - return super.hashCode(); - } - - @Override - public boolean equals(Object obj) { - return super.equals(obj); - } - } diff --git a/app/src/main/java/com/ttbmp/cinehub/app/repository/projection/ProjectionProxy.java b/app/src/main/java/com/ttbmp/cinehub/app/repository/projection/ProjectionProxy.java index 9a72d5b1..0c592b34 100644 --- a/app/src/main/java/com/ttbmp/cinehub/app/repository/projection/ProjectionProxy.java +++ b/app/src/main/java/com/ttbmp/cinehub/app/repository/projection/ProjectionProxy.java @@ -12,12 +12,14 @@ import com.ttbmp.cinehub.domain.Projection; import com.ttbmp.cinehub.domain.employee.Projectionist; import com.ttbmp.cinehub.domain.ticket.Ticket; +import lombok.EqualsAndHashCode; import java.util.List; /** * @author Fabio Buracchi */ +@EqualsAndHashCode(callSuper = true) public class ProjectionProxy extends Projection { private final MovieRepository movieRepository; @@ -110,14 +112,4 @@ public void setTicketList(List ticketList) { super.setTicketList(ticketList); } - @Override - public int hashCode() { - return super.hashCode(); - } - - @Override - public boolean equals(Object obj) { - return super.equals(obj); - } - } diff --git a/app/src/main/java/com/ttbmp/cinehub/app/repository/seat/SeatProxy.java b/app/src/main/java/com/ttbmp/cinehub/app/repository/seat/SeatProxy.java index df0e0484..79eaed7f 100644 --- a/app/src/main/java/com/ttbmp/cinehub/app/repository/seat/SeatProxy.java +++ b/app/src/main/java/com/ttbmp/cinehub/app/repository/seat/SeatProxy.java @@ -2,10 +2,12 @@ import com.ttbmp.cinehub.app.di.ServiceLocator; import com.ttbmp.cinehub.domain.Seat; +import lombok.EqualsAndHashCode; /** * @author Fabio Buracchi */ +@EqualsAndHashCode(callSuper = true) public class SeatProxy extends Seat { @SuppressWarnings("unused") diff --git a/app/src/main/java/com/ttbmp/cinehub/app/repository/shift/projectionist/ProjectionistShiftProxy.java b/app/src/main/java/com/ttbmp/cinehub/app/repository/shift/projectionist/ProjectionistShiftProxy.java index 891b179d..8eabef19 100644 --- a/app/src/main/java/com/ttbmp/cinehub/app/repository/shift/projectionist/ProjectionistShiftProxy.java +++ b/app/src/main/java/com/ttbmp/cinehub/app/repository/shift/projectionist/ProjectionistShiftProxy.java @@ -10,12 +10,14 @@ import com.ttbmp.cinehub.domain.Projection; import com.ttbmp.cinehub.domain.employee.Employee; import com.ttbmp.cinehub.domain.shift.ProjectionistShift; +import lombok.EqualsAndHashCode; import java.util.List; /** * @author Fabio Buracchi */ +@EqualsAndHashCode(callSuper = true) public class ProjectionistShiftProxy extends ProjectionistShift { private final ProjectionistRepository projectionistRepository; @@ -88,14 +90,4 @@ public void setProjectionList(List projectionList) { super.setProjectionList(projectionList); } - @Override - public boolean equals(Object obj) { - return super.equals(obj); - } - - @Override - public int hashCode() { - return super.hashCode(); - } - } diff --git a/app/src/main/java/com/ttbmp/cinehub/app/repository/shift/usher/UsherShiftProxy.java b/app/src/main/java/com/ttbmp/cinehub/app/repository/shift/usher/UsherShiftProxy.java index d2912fa8..9be0aeec 100644 --- a/app/src/main/java/com/ttbmp/cinehub/app/repository/shift/usher/UsherShiftProxy.java +++ b/app/src/main/java/com/ttbmp/cinehub/app/repository/shift/usher/UsherShiftProxy.java @@ -6,10 +6,12 @@ import com.ttbmp.cinehub.app.repository.employee.usher.UsherRepository; import com.ttbmp.cinehub.domain.employee.Employee; import com.ttbmp.cinehub.domain.shift.UsherShift; +import lombok.EqualsAndHashCode; /** * @author Fabio Buracchi */ +@EqualsAndHashCode(callSuper = true) public class UsherShiftProxy extends UsherShift { private final UsherRepository usherRepository; @@ -40,14 +42,4 @@ public void setEmployee(Employee employee) { super.setEmployee(employee); } - @Override - public boolean equals(Object obj) { - return super.equals(obj); - } - - @Override - public int hashCode() { - return super.hashCode(); - } - } diff --git a/app/src/main/java/com/ttbmp/cinehub/app/repository/user/UserProxy.java b/app/src/main/java/com/ttbmp/cinehub/app/repository/user/UserProxy.java index cf373528..ae8ccd2c 100644 --- a/app/src/main/java/com/ttbmp/cinehub/app/repository/user/UserProxy.java +++ b/app/src/main/java/com/ttbmp/cinehub/app/repository/user/UserProxy.java @@ -3,12 +3,14 @@ import com.ttbmp.cinehub.app.di.ServiceLocator; import com.ttbmp.cinehub.domain.User; import com.ttbmp.cinehub.domain.security.Role; +import lombok.EqualsAndHashCode; import java.util.List; /** * @author Fabio Buracchi */ +@EqualsAndHashCode(callSuper = true) public class UserProxy extends User { @SuppressWarnings("unused") From 8349730bbe6c2a463c416dfb0588c0e50f30221f Mon Sep 17 00:00:00 2001 From: Fabio Buracchi <45599613+buracchi@users.noreply.github.com> Date: Sun, 4 Jul 2021 17:31:32 +0200 Subject: [PATCH 2/4] Refactory #100 --- .../java/com/ttbmp/cinehub/app/dto/ShiftDto.java | 12 ++++++------ .../ManageEmployeesShiftController.java | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/ttbmp/cinehub/app/dto/ShiftDto.java b/app/src/main/java/com/ttbmp/cinehub/app/dto/ShiftDto.java index 4e40440d..3ebcd27e 100644 --- a/app/src/main/java/com/ttbmp/cinehub/app/dto/ShiftDto.java +++ b/app/src/main/java/com/ttbmp/cinehub/app/dto/ShiftDto.java @@ -36,13 +36,13 @@ public ShiftDto(Shift shift) { this.date = LocalDate.parse(shift.getDate()); this.start = LocalTime.parse(shift.getStart()); this.end = LocalTime.parse(shift.getEnd()); - if(shift instanceof ProjectionistShift){ - this.type=ShiftType.PROJECTIONIST_SHIFT; - this.hall = new HallDto (((ProjectionistShift) shift).getHall()); - }else if(shift instanceof UsherShift){ - this.type=ShiftType.USHER_SHIFT; + if (shift instanceof ProjectionistShift) { + this.type = ShiftType.PROJECTIONIST_SHIFT; + this.hall = new HallDto(((ProjectionistShift) shift).getHall()); + } else if (shift instanceof UsherShift) { + this.type = ShiftType.USHER_SHIFT; this.hall = null; - }else{ + } else { throw new IllegalStateException("Unexpected value: " + shift); } } diff --git a/app/src/main/java/com/ttbmp/cinehub/app/usecase/manageemployeesshift/ManageEmployeesShiftController.java b/app/src/main/java/com/ttbmp/cinehub/app/usecase/manageemployeesshift/ManageEmployeesShiftController.java index b28dec40..fb481b2c 100644 --- a/app/src/main/java/com/ttbmp/cinehub/app/usecase/manageemployeesshift/ManageEmployeesShiftController.java +++ b/app/src/main/java/com/ttbmp/cinehub/app/usecase/manageemployeesshift/ManageEmployeesShiftController.java @@ -277,7 +277,7 @@ private void modifyProjectionistShift(ShiftModifyRequest request, ProjectionistS } private void modifyUsherShift(ShiftModifyRequest request, UsherShift shift) throws ModifyShiftException { - shift.modifyShift( request.getDate(), request.getStart(), request.getEnd()); + shift.modifyShift(request.getDate(), request.getStart(), request.getEnd()); } } From 47a6d824fa2eab7fbec30d06dd626ba94c124682 Mon Sep 17 00:00:00 2001 From: sonMassimo1 <56676941+sonMassimo1@users.noreply.github.com> Date: Sun, 4 Jul 2021 18:34:12 +0200 Subject: [PATCH 3/4] Refactory #100 --- .../view_personal_schedule/schedule_projectionist_detail.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/web/src/main/resources/templates/view_personal_schedule/schedule_projectionist_detail.html b/ui/web/src/main/resources/templates/view_personal_schedule/schedule_projectionist_detail.html index 7f59f5a2..910a88da 100644 --- a/ui/web/src/main/resources/templates/view_personal_schedule/schedule_projectionist_detail.html +++ b/ui/web/src/main/resources/templates/view_personal_schedule/schedule_projectionist_detail.html @@ -71,8 +71,8 @@
- - + +
From 77b2b896c456968b6dc2f91ce9db9db3b1994519 Mon Sep 17 00:00:00 2001 From: Ivan <55716224+Ivan-Palm@users.noreply.github.com> Date: Sun, 4 Jul 2021 18:37:23 +0200 Subject: [PATCH 4/4] Refactory #100 --- .../cinehub/app/usecase/buyticket/request/PaymentRequest.java | 2 +- .../viewpersonalschedule/ViewPersonalScheduleViewModel.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/ttbmp/cinehub/app/usecase/buyticket/request/PaymentRequest.java b/app/src/main/java/com/ttbmp/cinehub/app/usecase/buyticket/request/PaymentRequest.java index 7d5eb722..b0da7284 100644 --- a/app/src/main/java/com/ttbmp/cinehub/app/usecase/buyticket/request/PaymentRequest.java +++ b/app/src/main/java/com/ttbmp/cinehub/app/usecase/buyticket/request/PaymentRequest.java @@ -61,7 +61,7 @@ public void onValidate() { if (creditCard.creditCardNumber.length() < 12 || creditCard.creditCardNumber.length() > 16) { addError(CREDIT_CARD_LENGTH_ERROR); } - if (!email.contains("@")) { + if (!email.matches("\\w+@\\w+\\.\\w+")) { addError(EMAIL_ERROR); } if (ticketOption.magicBoxOption == null) { diff --git a/ui/desktop/src/main/java/com/ttbmp/cinehub/ui/desktop/viewpersonalschedule/ViewPersonalScheduleViewModel.java b/ui/desktop/src/main/java/com/ttbmp/cinehub/ui/desktop/viewpersonalschedule/ViewPersonalScheduleViewModel.java index b18ddcdc..28e8a293 100644 --- a/ui/desktop/src/main/java/com/ttbmp/cinehub/ui/desktop/viewpersonalschedule/ViewPersonalScheduleViewModel.java +++ b/ui/desktop/src/main/java/com/ttbmp/cinehub/ui/desktop/viewpersonalschedule/ViewPersonalScheduleViewModel.java @@ -61,7 +61,7 @@ public ViewPersonalScheduleViewModel() { selectedShiftDateProperty.bind(ObjectBindings.map(selectedShiftProperty, shiftDto -> shiftDto.getDate().toString())); selectedShiftStartProperty.bind(ObjectBindings.map(selectedShiftProperty, shiftDto -> shiftDto.getStart().toString())); selectedShiftEndProperty.bind(ObjectBindings.map(selectedShiftProperty, shiftDto -> shiftDto.getEnd().toString())); - selectedProjectionistShiftHallProperty.bind(ObjectBindings.map(selectedShiftProperty, shiftDto -> shiftDto.getHall().getName())); + selectedProjectionistShiftHallProperty.bind(ObjectBindings.map(selectedShiftProperty, shiftDto -> shiftDto.getHall().getName())); projectionsDetailButtonVisibleProperty.bind(ObjectBindings.map(selectedShiftEmployeeRoleProperty, e -> e.equals(EmployeeDto.EmployeeRole.PROJECTIONIST.toString()))); }