updates cleanup.
This commit is contained in:
@@ -11,19 +11,21 @@ public class AccountReservationList extends ArrayList<Reservation> {
|
||||
@Override
|
||||
public boolean add(final Reservation reservation) {
|
||||
boolean result = true;
|
||||
Reservation rsrv = this.find(reservation.getReservation_number());
|
||||
if( rsrv != null ){
|
||||
result = false;
|
||||
throw new DuplicateObjectException(String.format("Error Duplicate: Reservation %s", rsrv.getReservation_number()));
|
||||
}
|
||||
try {
|
||||
result = reservation.checkValid();
|
||||
} catch (Exception e) {
|
||||
} catch (ReservationException ex) {
|
||||
return false;
|
||||
}
|
||||
for (Reservation rsrv : this) {
|
||||
result = reservation.getReservation_number().compareTo(rsrv.getReservation_number()) == 0;
|
||||
if (result) {
|
||||
return false;
|
||||
}
|
||||
if(result){
|
||||
reservation.setReservation_number(AccountReservationList.reservationSerial(reservation));
|
||||
result = super.add(reservation);
|
||||
}
|
||||
reservation.setReservation_number(AccountReservationList.reservationSerial(reservation));
|
||||
return super.add(reservation);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -212,7 +212,7 @@ public abstract class Reservation {
|
||||
throw new IllegalOperationException ("Invalid Change, reservation has completed.");
|
||||
}
|
||||
if (ZonedDateTime.now().compareTo(this.reservation_start_date) > -1) {
|
||||
throw new IllegalOperationException ("Invalid Change, reservation started.");
|
||||
throw new IllegalOperationException ("Invalid Change, reservation time started.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user