updates.
This commit is contained in:
@@ -16,8 +16,7 @@ import lodge.reservationsystem.ReservationStatusEnum;
|
||||
public final class TestReservations {
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
AccomodationManager mgr = new AccomodationManager();
|
||||
mgr.setDataStoreRoot(getRepositoryConfig.getPath());
|
||||
AccomodationManager mgr = new AccomodationManager(getRepositoryConfig.getPath());
|
||||
// 1. Get the list of loaded accounts from Manager
|
||||
|
||||
mgr.loadAll();
|
||||
|
||||
@@ -7,6 +7,15 @@ public final class AccomodationManager {
|
||||
|
||||
private final AccountList account_list = new AccountList();
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
AccomodationManager(){
|
||||
};
|
||||
|
||||
public AccomodationManager(String home){
|
||||
|
||||
setDataStoreRoot(home);
|
||||
};
|
||||
|
||||
public final void setDataStoreRoot(String home) {
|
||||
DataRepository.setDataStoreRoot(home);
|
||||
}
|
||||
|
||||
@@ -9,13 +9,14 @@ public class AccountReservationList extends ArrayList<Reservation> {
|
||||
}
|
||||
|
||||
public boolean add(final Reservation reservation) {
|
||||
boolean result = true;
|
||||
for(Reservation rsrv: this){
|
||||
result = rsrv.getReservation_number() == reservation.getReservation_number();
|
||||
if(result) return result;
|
||||
boolean result = reservation.getReservation_number().compareTo(rsrv.getReservation_number()) == 0;
|
||||
if(result){
|
||||
return result;
|
||||
}
|
||||
}
|
||||
reservation.reservation_number = AccountReservationList.reservationSerial(reservation);
|
||||
return result = super.add(reservation);
|
||||
return super.add(reservation);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user