diff --git a/sdd/Software_Detail_Design.docx b/sdd/Software_Detail_Design.docx index e329f7a..fa1b86a 100644 Binary files a/sdd/Software_Detail_Design.docx and b/sdd/Software_Detail_Design.docx differ diff --git a/src/java/lodge/data/Account.java b/src/java/lodge/data/Account.java index 4fd6ea9..bed4424 100644 --- a/src/java/lodge/data/Account.java +++ b/src/java/lodge/data/Account.java @@ -10,13 +10,15 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; - import java.util.ListIterator; +import lodge.reservation.IReservation; import lodge.reservation.Reservation; import lodge.reservationsystem.DataRepository; -import lodge.reservation.IReservation; - +/** + * Concrete account data class for account json storage record. + * Collects account attributes, and hash instance to enforce uniqueness. + */ public class Account { private String account_number = "-99"; private String phone_number; diff --git a/src/java/lodge/reservationsystem/AccomodationManager.java b/src/java/lodge/reservationsystem/AccomodationManager.java index 5029af6..76b7fe3 100644 --- a/src/java/lodge/reservationsystem/AccomodationManager.java +++ b/src/java/lodge/reservationsystem/AccomodationManager.java @@ -13,8 +13,8 @@ import lodge.data.Account; import lodge.data.AccountList; import lodge.data.Address; import lodge.data.EmailAddress; -import lodge.reservation.Reservation; import lodge.reservation.IReservation; +import lodge.reservation.Reservation; public final class AccomodationManager { @@ -42,7 +42,7 @@ public final class AccomodationManager { } // Load / Deserialize Account - public void load(Path file) throws Exception { + protected void load(Path file) throws Exception { Account account = DataRepository.LoadAccount(file); if (account == null) { diff --git a/src/java/lodge/reservationsystem/CabinReservation.java b/src/java/lodge/reservationsystem/CabinReservation.java index 54be01e..40867aa 100644 --- a/src/java/lodge/reservationsystem/CabinReservation.java +++ b/src/java/lodge/reservationsystem/CabinReservation.java @@ -11,6 +11,9 @@ import lodge.data.Address; import lodge.data.KitchenTypeEnum; import lodge.reservation.Reservation; +/** + * Concrete reservation data class for reservation storage record + */ public final class CabinReservation extends Reservation { public CabinReservation() { @@ -19,7 +22,7 @@ public final class CabinReservation extends Reservation { this.setNumberOfBeds(1); this.setKitchen(KitchenTypeEnum.Kitchenette); } - + public CabinReservation(final Address physical_address) { super(); this.setType('C'); diff --git a/src/java/lodge/reservationsystem/HotelReservation.java b/src/java/lodge/reservationsystem/HotelReservation.java index 4e2141a..b438188 100644 --- a/src/java/lodge/reservationsystem/HotelReservation.java +++ b/src/java/lodge/reservationsystem/HotelReservation.java @@ -12,7 +12,10 @@ import lodge.data.Address; import lodge.data.KitchenTypeEnum; import lodge.reservation.Reservation; -public final class HotelReservation extends Reservation{ +/** + * Concrete reservation data class for reservation storage record + */ +public final class HotelReservation extends Reservation { public HotelReservation() { super(); @@ -24,9 +27,9 @@ public final class HotelReservation extends Reservation{ this.setNumberOfFloors(1); this.setKitchen(KitchenTypeEnum.Kitchenette); } - + public static Reservation copy(String reservationType) { - return new HotelReservation(); + return new HotelReservation(); } public HotelReservation(final Address physical_address) { diff --git a/src/java/lodge/reservationsystem/HouseReservation.java b/src/java/lodge/reservationsystem/HouseReservation.java index 5779c22..95e652f 100644 --- a/src/java/lodge/reservationsystem/HouseReservation.java +++ b/src/java/lodge/reservationsystem/HouseReservation.java @@ -11,6 +11,9 @@ import lodge.data.Address; import lodge.data.KitchenTypeEnum; import lodge.reservation.Reservation; +/** + * Concrete reservation data class for reservation storage record + */ public final class HouseReservation extends Reservation { public HouseReservation() { @@ -24,7 +27,7 @@ public final class HouseReservation extends Reservation { } public static Reservation copy(String reservationType) { - return new HouseReservation(); + return new HouseReservation(); } public HouseReservation(final Address physical_address) { diff --git a/src/resources/acc-A1450981765.json b/src/resources/acc-A1450981765.json index 20e76a9..e9fcb96 100755 --- a/src/resources/acc-A1450981765.json +++ b/src/resources/acc-A1450981765.json @@ -1 +1 @@ -{ "Account":{"account_number": "A1450981765","phone_number": "701-456-7890","mailing_address": { "Address":{"street": "10 wilco ave","city": "wilco","state": "WY","zip": "82801"}},"email_address": { "EmailAddress":{"email": "wilco@wyommin.net"}},"reservations":[{"CabinReservation":{"reservation_number":"R0535276622"}},{"HouseReservation":{"reservation_number":"R0499811708"}},{"CabinReservation":{"reservation_number":"R0535276622"}},{"HouseReservation":{"reservation_number":"R0499811708"}}]}} \ No newline at end of file +{ "Account":{"account_number": "A1450981765","phone_number": "701-456-7890","mailing_address": { "Address":{"street": "10 wilco ave","city": "wilco","state": "WY","zip": "82801"}},"email_address": { "EmailAddress":{"email": "wilco@wyommin.net"}},"reservations":[{"CabinReservation":{"reservation_number":"R0535276622"}},{"HouseReservation":{"reservation_number":"R0499811708"}}]}} \ No newline at end of file diff --git a/src/resources/acc-A2074212339.json b/src/resources/acc-A2074212339.json index 49ede8e..db89428 100755 --- a/src/resources/acc-A2074212339.json +++ b/src/resources/acc-A2074212339.json @@ -1 +1 @@ -{ "Account":{"account_number": "A2074212339","phone_number": "301-356-3890","mailing_address": { "Address":{"street": "30 Amstadam ave","city": "New York","state": "NY","zip": "12010"}},"email_address": { "EmailAddress":{"email": "newbee952@aol.com"}},"reservations":[{"HotelReservation":{"reservation_number":"R0123087344"}},{"CabinReservation":{"reservation_number":"R2042828431"}},{"HotelReservation":{"reservation_number":"R0123087344"}},{"CabinReservation":{"reservation_number":"R2042828431"}}]}} \ No newline at end of file +{ "Account":{"account_number": "A2074212339","phone_number": "301-356-3890","mailing_address": { "Address":{"street": "30 Amstadam ave","city": "New York","state": "NY","zip": "12010"}},"email_address": { "EmailAddress":{"email": "newbee952@aol.com"}},"reservations":[{"HotelReservation":{"reservation_number":"R0123087344"}},{"CabinReservation":{"reservation_number":"R2042828431"}}]}} \ No newline at end of file diff --git a/src/resources/rsv-R0123087344.json b/src/resources/rsv-R0123087344.json index e0097f5..48af0e9 100755 --- a/src/resources/rsv-R0123087344.json +++ b/src/resources/rsv-R0123087344.json @@ -1 +1,33 @@ -{ "HotelReservation":{"reservation_type": "HotelReservation","reservation_number": "R0123087344","reservation_status": "Draft","reservation_start_date": "2025-09-05T10:00Z[UTC]","reservation_end_date": "2025-09-09T10:00Z[UTC]","account_number": "A2074212339","physical_address": { "Address":{"street": "400 hotel ave","city": "Maryland City","state": "MD","zip": "20723"}},"mailing_address": { "Address":{"street": "400 hotel ave","city": "Maryland City","state": "MD","zip": "20723"}},"kitchen": "Kitchenette","numberOfBeds": "2","numberOfBedRooms": "1","numberOfBathRooms": "1","numberOfFloors": "1","squareFeet": "450","price": "410.0"}} \ No newline at end of file +{ + "HotelReservation": { + "reservation_type": "HotelReservation", + "reservation_number": "R0123087344", + "reservation_status": "Canceled", + "reservation_start_date": "2025-09-05T10:00Z[UTC]", + "reservation_end_date": "2025-09-09T10:00Z[UTC]", + "account_number": "A2074212339", + "physical_address": { + "Address": { + "street": "400 hotel ave", + "city": "Maryland City", + "state": "MD", + "zip": "20723" + } + }, + "mailing_address": { + "Address": { + "street": "400 hotel ave", + "city": "Maryland City", + "state": "MD", + "zip": "20723" + } + }, + "kitchen": "Kitchenette", + "numberOfBeds": "2", + "numberOfBedRooms": "1", + "numberOfBathRooms": "1", + "numberOfFloors": "1", + "squareFeet": "450", + "price": "410.0" + } +} \ No newline at end of file diff --git a/src/resources/rsv-R0499811708.json b/src/resources/rsv-R0499811708.json index d09837e..5aecfb4 100755 --- a/src/resources/rsv-R0499811708.json +++ b/src/resources/rsv-R0499811708.json @@ -1 +1,33 @@ -{ "HouseReservation":{"reservation_type": "HouseReservation","reservation_number": "R0499811708","reservation_status": "Draft","reservation_start_date": "2025-09-05T10:00Z[UTC]","reservation_end_date": "2025-09-09T10:00Z[UTC]","account_number": "A1450981765","physical_address": { "Address":{"street": "3000 Osage ave","city": "GreenBelt","state": "MD","zip": "20740"}},"mailing_address": { "Address":{"street": "40012 College ave","city": "College Park","state": "MD","zip": "20740"}},"kitchen": "Kitchenette","numberOfBeds": "2","numberOfBedRooms": "1","numberOfBathRooms": "1","numberOfFloors": "1","squareFeet": "450","price": "360.0"}} \ No newline at end of file +{ + "HouseReservation": { + "reservation_type": "HouseReservation", + "reservation_number": "R0499811708", + "reservation_status": "Draft", + "reservation_start_date": "2025-09-05T10:00Z[UTC]", + "reservation_end_date": "2025-09-09T10:00Z[UTC]", + "account_number": "A1450981765", + "physical_address": { + "Address": { + "street": "3000 Osage ave", + "city": "GreenBelt", + "state": "MD", + "zip": "20740" + } + }, + "mailing_address": { + "Address": { + "street": "40012 College ave", + "city": "College Park", + "state": "MD", + "zip": "20740" + } + }, + "kitchen": "Kitchenette", + "numberOfBeds": "2", + "numberOfBedRooms": "1", + "numberOfBathRooms": "1", + "numberOfFloors": "1", + "squareFeet": "450", + "price": "360.0" + } +} \ No newline at end of file diff --git a/src/resources/rsv-R0535276622.json b/src/resources/rsv-R0535276622.json index 42a2f8c..9172b49 100755 --- a/src/resources/rsv-R0535276622.json +++ b/src/resources/rsv-R0535276622.json @@ -1 +1 @@ -{ "CabinReservation":{"reservation_type": "CabinReservation","reservation_number": "R0535276622","reservation_status": "Draft","reservation_start_date": "2025-09-05T10:00Z[UTC]","reservation_end_date": "2025-09-09T10:00Z[UTC]","account_number": "A1450981765","physical_address": { "Address":{"street": "40 cabin ave","city": "Carnelian","state": "CA","zip": "96140"}},"mailing_address": { "Address":{"street": "40 cabin ave","city": "Carnelian Bay","state": "CA","zip": "96140"}},"kitchen": "Kitchenette","numberOfBeds": "2","numberOfBedRooms": "1","numberOfBathRooms": "1","numberOfFloors": "1","squareFeet": "450","price": "360.0"}} \ No newline at end of file +{ "CabinReservation":{"reservation_type": "CabinReservation","reservation_number": "R0535276622","reservation_status": "Completed","reservation_start_date": "2025-09-05T10:00Z[UTC]","reservation_end_date": "2025-09-09T10:00Z[UTC]","account_number": "A1450981765","physical_address": { "Address":{"street": "40 cabin ave","city": "Carnelian","state": "CA","zip": "96140"}},"mailing_address": { "Address":{"street": "40 cabin ave","city": "Carnelian Bay","state": "CA","zip": "96140"}},"kitchen": "Kitchenette","numberOfBeds": "2","numberOfBedRooms": "1","numberOfBathRooms": "1","numberOfFloors": "1","squareFeet": "450","price": "360.0"}} \ No newline at end of file diff --git a/uml/classdiagram1.svg b/uml/classdiagram1.svg new file mode 100755 index 0000000..404bebb --- /dev/null +++ b/uml/classdiagram1.svg @@ -0,0 +1,323 @@ + + + + + + +ClassDiagram + + + +IReservation + +interface +IReservation + ++ ReservationType(): String ++ checkValid(): boolean ++ calculatePrice(): float ++ getReservation_number(): String ++ getPhysical_address(): Address ++ getAccountNumber(): String + + + +Reservation + +Reservation + + + +Reservation->IReservation + + +implements + + + +DataRepository + +DataRepository + + + +Reservation->DataRepository + + +uses for Write() + + + +Address + +Address + ++ Address(String, String, String, String) + + + +Reservation->Address + + +physical/mailing + + + +ReservationStatusEnum + +enum +ReservationStatusEnum + + + +Reservation->ReservationStatusEnum + + +uses + + + +AccomodationManager + +AccomodationManager + ++ AccomodationManager(String) ++ loadAll(): void ++ retrieveAccount(String): Account ++ retrieveLoadedAccounts(): AccountList ++ newAccount(String, Address, EmailAddress): Account ++ AddAccount(Account): void ++ UpdateAccount(Account): void ++ addReservation(Account, Reservation): boolean ++ showReservationList(): void + + + +AccomodationManager->DataRepository + + +uses + + + +Account + +Account + + + +AccomodationManager->Account + + +manages + + + +AccountList + +AccountList + ++ add(Account): boolean ++ find(String): Account ++ save(Account): void + + + +AccomodationManager->AccountList + + +has a + + + +Account->DataRepository + + +uses for Write() + + + +AccountReservationList + +AccountReservationList + ++ add(IReservation): boolean ++ find(String): Reservation + + + +Account->AccountReservationList + + +has a + + + +Account->Address + + +mailing + + + +EmailAddress + +EmailAddress + ++ EmailAddress(String) + + + +Account->EmailAddress + + + + + +AccountList->Account + + +0..* + + + +AccountReservationList->IReservation + + +0..* + + + +HotelReservation + +HotelReservation + ++ HotelReservation(Address) ++ calculatePrice(): float + + + +HotelReservation->Reservation + + +extends + + + +CabinReservation + +CabinReservation + ++ CabinReservation(Address) ++ calculatePrice(): float + + + +CabinReservation->Reservation + + +extends + + + +HouseReservation + +HouseReservation + ++ HouseReservation(Address) ++ calculatePrice(): float + + + +HouseReservation->Reservation + + +extends + + + +TestReservations + +TestReservations + + + +TestReservations->AccomodationManager + + +uses + + + +TestReservations->Account + + +uses + + + +TestReservations->HotelReservation + + +creates + + + +TestReservations->CabinReservation + + +creates + + + +TestReservations->HouseReservation + + +creates + + + +TestReservations.getRepositoryConfig + +TestReservations.getRepositoryConfig + + + +TestReservations->TestReservations.getRepositoryConfig + + +uses + + + +TestReservations->Address + + +creates + + + +TestReservations->EmailAddress + + +creates + + + +DuplicateObjectException + +exception +DuplicateObjectException + + + +TestReservations->DuplicateObjectException + + +catches + + + diff --git a/uml/classdiagram3.svg b/uml/classdiagram3.svg new file mode 100755 index 0000000..3897d84 --- /dev/null +++ b/uml/classdiagram3.svg @@ -0,0 +1,262 @@ + + + + + + +G + + + +IReservation + +IReservation + + + +Reservation + +Abstract +Reservation + +- type: char +- reservation_number: String +- physical_address: Address +- mailing_address: Address +- reservation_start_date: ZonedDateTime +- reservation_end_date: ZonedDateTime +- reservation_status: ReservationStatusEnum +- kitchen: KitchenTypeEnum +- numberOfBeds: Integer +- price: Float +# accountNumber: String + ++ setReservation_number(String): void ++ getReservation_number(): String ++ setAccountNumber(String): void ++ getAccountNumber(): String ++ Write(Reservation): void ++ Change(Reservation, ReservationStatusEnum): void ++ update(Reservation): void ++ calculatePrice(): float ++ ReservationType(): String + + + +Reservation->IReservation + + + + + +Address + +Address + +- street: String +- city: String +- state: String +- zip: String + + + +Reservation->Address + + +2 + + + +ReservationStatusEnum + +ReservationStatusEnum + + + +Reservation->ReservationStatusEnum + + +1 + + + +KitchenTypeEnum + +KitchenTypeEnum + + + +Reservation->KitchenTypeEnum + + +1 + + + +HotelReservation + +HotelReservation + ++ ReservationType(): String ++ checkValid(): boolean ++ calculatePrice(): float + + + +HotelReservation->Reservation + + + + + +HouseReservation + +HouseReservation + ++ ReservationType(): String ++ checkValid(): boolean ++ calculatePrice(): float + + + +HouseReservation->Reservation + + + + + +CabinReservation + +CabinReservation + ++ ReservationType(): String ++ checkValid(): boolean ++ calculatePrice(): float + + + +CabinReservation->Reservation + + + + + +Account + +Account + +- account_number: String +- phone_number: String +- mailing_address: Address +- email_address: EmailAddress +- reservations: AccountReservationList + + + + +AccountReservationList + +AccountReservationList + ++ add(IReservation): boolean ++ find(String): Reservation ++ update(AccountReservationList): void + + + +Account->AccountReservationList + + +1 + + + +Account->Address + + +1..2 + + + +EmailAddress + +EmailAddress + +- email_address: String + + + +Account->EmailAddress + + +1 + + + +AccountList + +AccountList + + + + +AccountList->Account + + +0..* + + + +AccountReservationList->IReservation + + +0..* + + + +AccomodationManager + +AccomodationManager + +- accounts: AccountList + ++ loadAll(): void ++ retrieveAccount(String): Account ++ AddAccount(Account): void ++ UpdateAccount(Account): void ++ addReservation(Account, Reservation): boolean ++ findReservation(String): Reservation + + + +AccomodationManager->AccountList + + +1 + + + +DataRepository + +DataRepository + + + +AccomodationManager->DataRepository + + +uses + + + +TestReservations + +TestReservations + ++ main(String[]): void + + +