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