diff --git a/README.md b/README.md index fc9d582..e066eae 100644 --- a/README.md +++ b/README.md @@ -16,19 +16,12 @@ ### Run and Debug Java manually -cd to: out - -: java [mainClass] [jar] - -java TestReservations ./*.jar - -### create jar archive: - -cd to: out - -jar --create --verbose --file *.jar --manifest ..\META-INF\MANIFEST.MF * +cd to: libs +java -cp .\libs\gson-2.13.1.jar;.\libs\reservationsystem.jar lodge.TestReservations ### compile - build: +### create jar archive: +gradle clean build jar + + -1. cd: src/lodge.reservationsystem -1. javac -g -d ../../out * \ No newline at end of file diff --git a/reservationsystem_0915.png b/reservationsystem_0915.png deleted file mode 100644 index 2312798..0000000 Binary files a/reservationsystem_0915.png and /dev/null differ diff --git a/src/META-INF/MANIFEST.MF b/src/META-INF/MANIFEST.MF index 3a5fea9..b934161 100644 --- a/src/META-INF/MANIFEST.MF +++ b/src/META-INF/MANIFEST.MF @@ -1,3 +1,5 @@ Manifest-Version: 1.0 Main-Class: lodge.TestReservations +Implementation-Title: lodge.reservationsystem +Implementation-Version: 1.0 Class-Path: lodge.reservationsystem com.google.gson . \ No newline at end of file diff --git a/src/java/lodge/TestReservations.java b/src/java/lodge/TestReservations.java index c58b35b..16faf82 100644 --- a/src/java/lodge/TestReservations.java +++ b/src/java/lodge/TestReservations.java @@ -12,13 +12,14 @@ import lodge.data.Account; import lodge.data.Address; import lodge.data.DuplicateObjectException; import lodge.data.EmailAddress; -import lodge.data.Reservation; + import lodge.data.ReservationStatusEnum; import lodge.reservationsystem.AccomodationManager; import lodge.reservationsystem.CabinReservation; import lodge.reservationsystem.HotelReservation; import lodge.reservationsystem.HouseReservation; -import lodge.reservationsystem.IReservation; +import lodge.reservation.Reservation; +import lodge.reservation.IReservation; public final class TestReservations { public static void main(String[] args) throws Exception { diff --git a/src/java/lodge/data/Account.java b/src/java/lodge/data/Account.java index 6cbbbd6..633d0b5 100644 --- a/src/java/lodge/data/Account.java +++ b/src/java/lodge/data/Account.java @@ -10,9 +10,11 @@ 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.reservationsystem.IReservation; +import lodge.reservation.Reservation; +import lodge.reservation.IReservation; public class Account { private String account_number = "-99"; diff --git a/src/java/lodge/data/AccountList.java b/src/java/lodge/data/AccountList.java index 2a49606..b033173 100644 --- a/src/java/lodge/data/AccountList.java +++ b/src/java/lodge/data/AccountList.java @@ -10,7 +10,7 @@ import java.util.Collections; import java.util.List; import java.util.ListIterator; -import lodge.reservationsystem.IReservation; +import lodge.reservation.IReservation; public class AccountList extends ArrayList { @@ -37,8 +37,8 @@ public class AccountList extends ArrayList { // save accounts in edit status public void save(final Account acct) throws IOException { - if( acct == null ){ - return; + if (acct == null) { + return; } Account.Write(acct); } @@ -55,12 +55,19 @@ public class AccountList extends ArrayList { public List getListOfReservations() { ArrayList readList = new ArrayList<>(); - for (Account acct: this){ + for (Account acct : this) { ListIterator itr = acct.getAllReservations(); - while( itr.hasNext() ){ + while (itr.hasNext()) { readList.add(itr.next()); } } return Collections.unmodifiableList(readList); } + + public void showReservationList() { + for (IReservation irsrv : this.getListOfReservations()) { + System.out.println(String.format("Account %s: %s, %s", irsrv.getAccountNumber(), + irsrv.getReservation_number(), irsrv.getPhysical_address().getStreet())); + } + } } diff --git a/src/java/lodge/data/AccountReservationList.java b/src/java/lodge/data/AccountReservationList.java index 2318718..1b6c393 100644 --- a/src/java/lodge/data/AccountReservationList.java +++ b/src/java/lodge/data/AccountReservationList.java @@ -6,7 +6,8 @@ package lodge.data; import java.util.ArrayList; -import lodge.reservationsystem.IReservation; +import lodge.reservation.Reservation; +import lodge.reservation.IReservation; class AccountReservationList extends ArrayList { diff --git a/src/java/lodge/data/DataRepository.java b/src/java/lodge/data/DataRepository.java index 778cd49..31ed85e 100644 --- a/src/java/lodge/data/DataRepository.java +++ b/src/java/lodge/data/DataRepository.java @@ -17,6 +17,7 @@ import java.nio.file.attribute.BasicFileAttributes; import java.time.ZonedDateTime; import com.google.gson.stream.JsonReader; +import lodge.reservation.Reservation; import lodge.reservationsystem.AccomodationManager; import lodge.reservationsystem.CabinReservation; @@ -45,11 +46,11 @@ public final class DataRepository { public final static Reservation Reservation(String type) { switch (type) { case "HotelReservation": - return HotelReservation.copy(type); + return new HotelReservation(); case "HouseReservation": - return HouseReservation.copy(type); + return new HouseReservation(); case "CabinReservation": - return CabinReservation.copy(type); + return new CabinReservation(); } return null; } diff --git a/src/java/lodge/reservationsystem/IllegalOperationException.java b/src/java/lodge/data/IllegalOperationException.java similarity index 89% rename from src/java/lodge/reservationsystem/IllegalOperationException.java rename to src/java/lodge/data/IllegalOperationException.java index 2905001..a455ad2 100644 --- a/src/java/lodge/reservationsystem/IllegalOperationException.java +++ b/src/java/lodge/data/IllegalOperationException.java @@ -2,7 +2,7 @@ * license: GPLv3 * lodge.reservationsystem */ -package lodge.reservationsystem; +package lodge.data; public class IllegalOperationException extends RuntimeException { public IllegalOperationException () { diff --git a/src/java/lodge/reservationsystem/IReservation.java b/src/java/lodge/reservation/IReservation.java similarity index 86% rename from src/java/lodge/reservationsystem/IReservation.java rename to src/java/lodge/reservation/IReservation.java index 5a37c97..7cbdf6d 100644 --- a/src/java/lodge/reservationsystem/IReservation.java +++ b/src/java/lodge/reservation/IReservation.java @@ -1,7 +1,6 @@ -package lodge.reservationsystem; +package lodge.reservation; import lodge.data.Address; -import lodge.data.Reservation; public interface IReservation { diff --git a/src/java/lodge/data/Reservation.java b/src/java/lodge/reservation/Reservation.java similarity index 96% rename from src/java/lodge/data/Reservation.java rename to src/java/lodge/reservation/Reservation.java index a081cdf..0bec625 100644 --- a/src/java/lodge/data/Reservation.java +++ b/src/java/lodge/reservation/Reservation.java @@ -2,7 +2,7 @@ * license: GPLv3 * lodge.reservationsystem */ -package lodge.data; +package lodge.reservation; import java.io.BufferedWriter; import java.io.IOException; @@ -12,10 +12,13 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.time.ZonedDateTime; -import lodge.reservationsystem.IReservation; -import lodge.reservationsystem.IllegalOperationException; +import lodge.data.Address; +import lodge.data.DataRepository; +import lodge.data.IllegalOperationException; +import lodge.data.KitchenTypeEnum; +import lodge.data.ReservationStatusEnum; -public abstract class Reservation { +public abstract class Reservation implements IReservation{ private char type; private String reservation_number = "-99"; private Address physical_address; diff --git a/src/java/lodge/reservationsystem/AccomodationManager.java b/src/java/lodge/reservationsystem/AccomodationManager.java index b60dfe8..5dfb3dc 100644 --- a/src/java/lodge/reservationsystem/AccomodationManager.java +++ b/src/java/lodge/reservationsystem/AccomodationManager.java @@ -6,7 +6,6 @@ package lodge.reservationsystem; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -15,7 +14,8 @@ import lodge.data.AccountList; import lodge.data.Address; import lodge.data.DataRepository; import lodge.data.EmailAddress; -import lodge.data.Reservation; +import lodge.reservation.Reservation; +import lodge.reservation.IReservation; public final class AccomodationManager { @@ -102,9 +102,7 @@ public final class AccomodationManager { } public void showReservationList() { - for (IReservation irsrv : this.getReservationList()) { - System.out.println(String.format("Account %s: %s, %s", irsrv.getAccountNumber(), irsrv.getReservation_number(), irsrv.getPhysical_address().getStreet())); - } + accounts.showReservationList(); } } \ No newline at end of file diff --git a/src/java/lodge/reservationsystem/CabinReservation.java b/src/java/lodge/reservationsystem/CabinReservation.java index 8989b06..63e442c 100644 --- a/src/java/lodge/reservationsystem/CabinReservation.java +++ b/src/java/lodge/reservationsystem/CabinReservation.java @@ -9,9 +9,9 @@ import java.time.temporal.ChronoUnit; import lodge.data.Address; import lodge.data.KitchenTypeEnum; -import lodge.data.Reservation; +import lodge.reservation.Reservation; -public final class CabinReservation extends Reservation implements IReservation { +public final class CabinReservation extends Reservation { public CabinReservation() { this.setType('C'); @@ -19,10 +19,6 @@ public final class CabinReservation extends Reservation implements IReservation this.setKitchen(KitchenTypeEnum.Kitchenette); } - public static Reservation copy(String reservationType) { - return new CabinReservation(); - } - public CabinReservation(final Address physical_address) { this(); this.setPhysical_address( diff --git a/src/java/lodge/reservationsystem/HotelReservation.java b/src/java/lodge/reservationsystem/HotelReservation.java index 6bb0015..aea80fb 100644 --- a/src/java/lodge/reservationsystem/HotelReservation.java +++ b/src/java/lodge/reservationsystem/HotelReservation.java @@ -10,9 +10,9 @@ import java.time.temporal.ChronoUnit; import lodge.data.Address; import lodge.data.KitchenTypeEnum; -import lodge.data.Reservation; +import lodge.reservation.Reservation; -public final class HotelReservation extends Reservation implements IReservation{ +public final class HotelReservation extends Reservation{ public HotelReservation() { this.setType('H'); diff --git a/src/java/lodge/reservationsystem/HouseReservation.java b/src/java/lodge/reservationsystem/HouseReservation.java index 485e931..3eb906f 100644 --- a/src/java/lodge/reservationsystem/HouseReservation.java +++ b/src/java/lodge/reservationsystem/HouseReservation.java @@ -9,9 +9,9 @@ import java.time.temporal.ChronoUnit; import lodge.data.Address; import lodge.data.KitchenTypeEnum; -import lodge.data.Reservation; +import lodge.reservation.Reservation; -public final class HouseReservation extends Reservation implements IReservation { +public final class HouseReservation extends Reservation { public HouseReservation() { this.setType('Z'); diff --git a/uml/classdiagram.dot b/uml/classdiagram.dot index 19d7e69..c113ea9 100644 --- a/uml/classdiagram.dot +++ b/uml/classdiagram.dot @@ -1,101 +1,102 @@ digraph LodgeReservationSystem { - // Graph settings + // Graph attributes rankdir=TB; node [shape=record, fontname="Arial", fontsize=10]; edge [fontname="Arial", fontsize=8]; - // Define clusters for packages + // Package: lodge.data subgraph cluster_data { label="lodge.data"; style=filled; color=lightgrey; - // Data classes - Account [label="{Account|+ account_number: String\l+ phone_number: String\l+ mailing_address: Address\l+ email_address: EmailAddress\l- reservation_list: AccountReservationList\l|+ add(Reservation): boolean\l+ findReservation(String): Reservation\l+ getAllReservations(): ListIterator\\l+ update(Account): void\l+ Write(Account): void\l}"]; + // Core data classes + Account [label="{Account|+ account_number: String\l+ phone_number: String\l+ mailing_address: Address\l+ email_address: EmailAddress\l+ reservations: AccountReservationList\l|+ add(Reservation): boolean\l+ findReservation(String): Reservation\l+ getAllReservations(): ListIterator\\l+ update(Account): void\l+ Write(Account): void\l}"]; - AccountList [label="{AccountList|extends ArrayList\|+ accountSerial(...): String\l+ add(Account): boolean\l+ find(String): Account\l+ save(Account): void\l+ getListOfReservations(): List\\l}"]; + AccountList [label="{AccountList|extends ArrayList\|+ accountSerial(String, Address, EmailAddress): String\l+ add(Account): boolean\l+ find(String): Account\l+ save(Account): void\l+ getListOfReservations(): List\\l+ showReservationList(): void\l}"]; - AccountReservationList [label="{AccountReservationList|extends ArrayList\|- reservationSerial(Reservation): String\l+ add(IReservation): boolean\l+ find(String): Reservation\l+ update(AccountReservationList): void\l}"]; + AccountReservationList [label="{AccountReservationList|extends ArrayList\|+ add(IReservation): boolean\l+ find(String): Reservation\l+ update(AccountReservationList): void\l+ toString(): String\l}"]; - Address [label="{Address|+ street: String\l+ city: String\l+ state: String\l+ zip: String\l|+ getters/setters\l+ hashCode(): int\l+ equals(Object): boolean\l}"]; + Address [label="{Address|+ street: String\l+ city: String\l+ state: String\l+ zip: String\l|+ getStreet(): String\l+ setStreet(String): void\l+ getCity(): String\l+ setCity(String): void\l+ getState(): String\l+ setState(String): void\l+ getZip(): String\l+ setZip(String): void\l+ equals(Object): boolean\l+ hashCode(): int\l+ toString(): String\l}"]; - EmailAddress [label="{EmailAddress|+ email_address: String\l|+ getters/setters\l+ hashCode(): int\l+ equals(Object): boolean\l}"]; + EmailAddress [label="{EmailAddress|+ email_address: String\l|+ getEmail_address(): String\l+ setEmail_address(String): void\l+ equals(Object): boolean\l+ hashCode(): int\l+ toString(): String\l}"]; - Reservation [label="{Reservation|\<\\>|# type: char\l- reservation_number: String\l- physical_address: Address\l- mailing_address: Address\l- reservation_start_date: ZonedDateTime\l- reservation_end_date: ZonedDateTime\l- reservation_status: ReservationStatusEnum\l- kitchen: KitchenTypeEnum\l- numberOfBeds: Integer\l- numberOfBedRooms: Integer\l- numberOfBathRooms: Integer\l- numberOfFloors: Integer\l- squareFeet: Integer\l- price: Float\l# accountNumber: String\l|+ getters/setters\l+ Write(Reservation): void\l+ Change(Reservation, ReservationStatusEnum): void\l+ update(Reservation): void\l+ \<\\> ReservationType(): String\l}"]; - - DataRepository [label="{DataRepository|\<\\>|- directoryPath: String\l- instance: DataRepository\l|+ setDataStoreRoot(String): void\l+ getPath(): String\l+ Reservation(String): Reservation\l+ WalkFileSystemTree(...): void\l+ LoadAccount(Path): Account\l- loadReservation(...): void\l}"]; - - DuplicateObjectException [label="{DuplicateObjectException|extends RuntimeException||+ DuplicateObjectException()\l+ DuplicateObjectException(String)\l}"]; + DataRepository [label="{DataRepository|- directoryPath: String\l- instance: DataRepository\l|+ setDataStoreRoot(String): void\l+ getPath(): String\l+ Reservation(String): Reservation\l+ WalkFileSystemTree(AccomodationManager, Path): void\l+ LoadAccount(Path): Account\l}"]; // Enums - KitchenTypeEnum [label="{KitchenTypeEnum|\<\\>|None\lKitchenette\lFullKitchen\l}"]; + KitchenTypeEnum [label="{«enumeration»\lKitchenTypeEnum|None\lKitchenette\lFullKitchen\l}"]; - ReservationStatusEnum [label="{ReservationStatusEnum|\<\\>|Draft\lCanceled\lCompleted\l}"]; + ReservationStatusEnum [label="{«enumeration»\lReservationStatusEnum|Draft\lCanceled\lCompleted\l}"]; + + // Exceptions + DuplicateObjectException [label="{DuplicateObjectException|+ DuplicateObjectException()\l+ DuplicateObjectException(String)\l}"]; + + IllegalOperationException [label="{IllegalOperationException|+ IllegalOperationException()\l+ IllegalOperationException(String)\l}"]; } - subgraph cluster_reservationsystem { - label="lodge.reservationsystem"; + // Package: lodge.reservation + subgraph cluster_reservation { + label="lodge.reservation"; style=filled; color=lightblue; - AccomodationManager [label="{AccomodationManager|- accounts: AccountList\l|+ AccomodationManager(String)\l+ loadAll(): void\l+ load(Path): void\l+ retrieveLoadedAccounts(): List\\l+ retrieveAccount(String): Account\l+ AddAccount(Account): void\l+ UpdateAccount(Account): void\l+ newAccount(...): Account\l+ addReservation(...): boolean\l+ findReservation(String): Reservation\l+ getReservationList(): List\\l+ showReservationList(): void\l}"]; + IReservation [label="{«interface»\lIReservation|+ ReservationType(): String\l+ getReservation_number(): String\l+ getAccountNumber(): String\l+ getPhysical_address(): Address\l+ getPricePerNight(): float\l+ calculatePrice(): float\l+ checkValid(): boolean\l}"]; - IReservation [label="{IReservation|\<\\>||+ ReservationType(): String\l+ getReservation_number(): String\l+ getAccountNumber(): String\l+ getPhysical_address(): Address\l+ getPricePerNight(): float\l+ calculatePrice(): float\l+ checkValid(): boolean\l}"]; - - HotelReservation [label="{HotelReservation|extends Reservation\limplements IReservation|# type: 'H'\l|+ HotelReservation(Address)\l+ ReservationType(): String\l+ checkValid(): boolean\l+ getPricePerNight(): float\l+ calculatePrice(): float\l+ Reservation(String): Reservation\l}"]; - - CabinReservation [label="{CabinReservation|extends Reservation\limplements IReservation|# type: 'C'\l|+ CabinReservation(Address)\l+ ReservationType(): String\l+ checkValid(): boolean\l+ getPricePerNight(): float\l+ calculatePrice(): float\l+ Reservation(String): Reservation\l}"]; - - HouseReservation [label="{HouseReservation|extends Reservation\limplements IReservation|# type: 'Z'\l|+ HouseReservation(Address)\l+ ReservationType(): String\l+ checkValid(): boolean\l+ getPricePerNight(): float\l+ calculatePrice(): float\l+ Reservation(String): Reservation\l}"]; - - IllegalOperationException [label="{IllegalOperationException|extends RuntimeException||+ IllegalOperationException()\l+ IllegalOperationException(String)\l}"]; + Reservation [label="{«abstract»\lReservation|# type: char\l# reservation_number: String\l# physical_address: Address\l# mailing_address: Address\l# reservation_start_date: ZonedDateTime\l# reservation_end_date: ZonedDateTime\l# reservation_status: ReservationStatusEnum\l# kitchen: KitchenTypeEnum\l# numberOfBeds: Integer\l# numberOfBedRooms: Integer\l# numberOfBathRooms: Integer\l# numberOfFloors: Integer\l# squareFeet: Integer\l# price: Float\l# accountNumber: String\l|+ getReservation_number(): String\l+ setReservation_number(String): void\l+ getAccountNumber(): String\l+ setAccountNumber(String): void\l+ getPhysical_address(): Address\l+ setPhysical_address(Address): void\l+ Write(Reservation): void\l+ Change(Reservation, ReservationStatusEnum): void\l+ update(Reservation): void\l+ ReservationType(): String\l}"]; } - subgraph cluster_main { - label="lodge"; + // Package: lodge.reservationsystem + subgraph cluster_reservationsystem { + label="lodge.reservationsystem"; style=filled; color=lightyellow; - TestReservations [label="{TestReservations||+ main(String[]): void\l}"]; + AccomodationManager [label="{AccomodationManager|- accounts: AccountList\l|+ loadAll(): void\l+ load(Path): void\l+ retrieveLoadedAccounts(): List\\l+ retrieveAccount(String): Account\l+ AddAccount(Account): void\l+ UpdateAccount(Account): void\l+ newAccount(String, Address, EmailAddress): Account\l+ addReservation(Account, Reservation): boolean\l+ findReservation(String): Reservation\l+ getReservationList(): List\\l+ showReservationList(): void\l}"]; + + HotelReservation [label="{HotelReservation|extends Reservation|+ HotelReservation()\l+ HotelReservation(Address)\l+ copy(String): Reservation\l+ ReservationType(): String\l+ checkValid(): boolean\l+ getPricePerNight(): float\l+ calculatePrice(): float\l}"]; + + CabinReservation [label="{CabinReservation|extends Reservation|+ CabinReservation()\l+ CabinReservation(Address)\l+ ReservationType(): String\l+ checkValid(): boolean\l+ getPricePerNight(): float\l+ calculatePrice(): float\l}"]; + + HouseReservation [label="{HouseReservation|extends Reservation|+ HouseReservation()\l+ HouseReservation(Address)\l+ copy(String): Reservation\l+ ReservationType(): String\l+ checkValid(): boolean\l+ getPricePerNight(): float\l+ calculatePrice(): float\l}"]; } + // Test class + TestReservations [label="{TestReservations|+ main(String[]): void\l}"]; + // Relationships + // Composition relationships + Account -> AccountReservationList [label="1" arrowhead=diamond]; + Account -> Address [label="1" arrowhead=diamond]; + Account -> EmailAddress [label="1" arrowhead=diamond]; + AccountList -> Account [label="0...*" arrowhead=odiamond]; + AccountReservationList -> IReservation [label="0...*" arrowhead=odiamond]; + AccomodationManager -> AccountList [label="1" arrowhead=diamond]; + // Inheritance relationships - AccountList -> Account [arrowhead=diamond, label="contains"]; - AccountReservationList -> IReservation [arrowhead=diamond, label="contains"]; + Reservation -> IReservation [arrowhead=empty, style=dashed, label="implements"]; + HotelReservation -> Reservation [arrowhead=empty, label="extends"]; + CabinReservation -> Reservation [arrowhead=empty, label="extends"]; + HouseReservation -> Reservation [arrowhead=empty, label="extends"]; - HotelReservation -> Reservation [arrowhead=empty]; - CabinReservation -> Reservation [arrowhead=empty]; - HouseReservation -> Reservation [arrowhead=empty]; - HotelReservation -> IReservation [arrowhead=empty, style=dashed]; - CabinReservation -> IReservation [arrowhead=empty, style=dashed]; - HouseReservation -> IReservation [arrowhead=empty, style=dashed]; - // Composition/Aggregation relationships - Account -> Address [arrowhead=diamond, label="mailing_address"]; - Account -> EmailAddress [arrowhead=diamond, label="email_address"]; - Account -> AccountReservationList [arrowhead=diamond, label="reservation_list"]; + // Dependencies and associations + Reservation -> Address [label="1", arrowhead=diamond]; + Reservation -> KitchenTypeEnum [arrowhead=open, style=dashed]; + Reservation -> ReservationStatusEnum [arrowhead=open, style=dashed]; + DataRepository -> AccomodationManager [arrowhead=open, style=dashed]; - Reservation -> Address [arrowhead=diamond, label="physical_address\nmailing_address"]; - Reservation -> KitchenTypeEnum [arrowhead=open, label="kitchen"]; - Reservation -> ReservationStatusEnum [arrowhead=open, label="reservation_status"]; - - AccomodationManager -> AccountList [arrowhead=diamond, label="accounts"]; - AccomodationManager -> DataRepository [arrowhead=open, label="uses"]; - - // Usage relationships - TestReservations -> AccomodationManager [arrowhead=open, label="uses"]; - TestReservations -> HotelReservation [arrowhead=open, label="creates"]; - TestReservations -> CabinReservation [arrowhead=open, label="creates"]; - TestReservations -> HouseReservation [arrowhead=open, label="creates"]; - - DataRepository -> Account [arrowhead=open, label="loads"]; - DataRepository -> Reservation [arrowhead=open, label="creates"]; + AccomodationManager -> Reservation [arrowhead=open, style=dashed]; + AccomodationManager -> DataRepository [arrowhead=open, style=dashed]; + TestReservations -> AccomodationManager [arrowhead=open, style=dashed]; + TestReservations -> HotelReservation [arrowhead=open, style=dashed]; + TestReservations -> CabinReservation [arrowhead=open, style=dashed]; + TestReservations -> HouseReservation [arrowhead=open, style=dashed]; // Exception relationships - AccountList -> DuplicateObjectException [arrowhead=open, style=dashed, label="throws"]; - AccountReservationList -> DuplicateObjectException [arrowhead=open, style=dashed, label="throws"]; - Reservation -> IllegalOperationException [arrowhead=open, style=dashed, label="throws"]; + AccountList -> DuplicateObjectException [arrowhead=open, style=dashed]; + AccountReservationList -> DuplicateObjectException [arrowhead=open, style=dashed]; + Reservation -> IllegalOperationException [arrowhead=open, style=dashed]; + Reservation -> ZonedDateTime [arrowhead=open, style=dashed]; } \ No newline at end of file diff --git a/uml/classdiagram.svg b/uml/classdiagram.svg index 77d99eb..51646be 100644 --- a/uml/classdiagram.svg +++ b/uml/classdiagram.svg @@ -1,465 +1,451 @@ - - - - - - - - -lodge.data + + + + + + +LodgeReservationSystem + + +cluster_reservationsystem + +lodge.reservationsystem - - - -lodge.reservationsystem + +cluster_data + +lodge.data - - - -lodge + +cluster_reservation + +lodge.reservation - - - -Account - -+ account_number: String -+ phone_number: String -+ mailing_address: Address -+ email_address: EmailAddress -- reservation_list: AccountReservationList - -+ add(Reservation): boolean -+ findReservation(String): Reservation -+ getAllReservations(): ListIterator<IReservation> -+ update(Account): void -+ Write(Account): void + +Account + +Account + ++ account_number: String ++ phone_number: String ++ mailing_address: Address ++ email_address: EmailAddress ++ reservations: AccountReservationList + ++ add(Reservation): boolean ++ findReservation(String): Reservation ++ getAllReservations(): ListIterator<IReservation> ++ update(Account): void ++ Write(Account): void - - - - -reservation_list - - - - -AccountReservationList - -extends ArrayList<IReservation> - -- reservationSerial(Reservation): String -+ add(IReservation): boolean -+ find(String): Reservation -+ update(AccountReservationList): void + + +AccountReservationList + +AccountReservationList + +extends ArrayList<IReservation> + ++ add(IReservation): boolean ++ find(String): Reservation ++ update(AccountReservationList): void ++ toString(): String - - - - - -mailing_address + +Account->AccountReservationList + + +1 - - - -Address - -+ street: String -+ city: String -+ state: String -+ zip: String - -+ getters/setters -+ hashCode(): int -+ equals(Object): boolean + + +Address + +Address + ++ street: String ++ city: String ++ state: String ++ zip: String + ++ getStreet(): String ++ setStreet(String): void ++ getCity(): String ++ setCity(String): void ++ getState(): String ++ setState(String): void ++ getZip(): String ++ setZip(String): void ++ equals(Object): boolean ++ hashCode(): int ++ toString(): String - - - - - -email_address + +Account->Address + + +1 - - - -EmailAddress - -+ email_address: String - -+ getters/setters -+ hashCode(): int -+ equals(Object): boolean + + +EmailAddress + +EmailAddress + ++ email_address: String + ++ getEmail_address(): String ++ setEmail_address(String): void ++ equals(Object): boolean ++ hashCode(): int ++ toString(): String - - - - - -contains + +Account->EmailAddress + + +1 - - - -AccountList - -extends ArrayList<Account> - -+ accountSerial(...): String -+ add(Account): boolean -+ find(String): Account -+ save(Account): void -+ getListOfReservations(): List<IReservation> + + +AccountList + +AccountList + +extends ArrayList<Account> + ++ accountSerial(String, Address, EmailAddress): String ++ add(Account): boolean ++ find(String): Account ++ save(Account): void ++ getListOfReservations(): List<? extends IReservation> ++ showReservationList(): void - - - - - -throws + +AccountList->Account + + +0...* - - - -DuplicateObjectException - -extends RuntimeException - - - -+ DuplicateObjectException() -+ DuplicateObjectException(String) + + +DuplicateObjectException + +DuplicateObjectException + ++ DuplicateObjectException() ++ DuplicateObjectException(String) - - - - -throws + + +AccountList->DuplicateObjectException + + - - - - - - -contains + +AccountReservationList->DuplicateObjectException + + - - - -IReservation - -<<interface>> - - - -+ ReservationType(): String -+ getReservation_number(): String -+ getAccountNumber(): String -+ getPhysical_address(): Address -+ getPricePerNight(): float -+ calculatePrice(): float -+ checkValid(): boolean + + +IReservation + +«interface» +IReservation + ++ ReservationType(): String ++ getReservation_number(): String ++ getAccountNumber(): String ++ getPhysical_address(): Address ++ getPricePerNight(): float ++ calculatePrice(): float ++ checkValid(): boolean - - - - - -physical_address -mailing_address - - - - -Reservation - -<<abstract>> - -# 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 -- numberOfBedRooms: Integer -- numberOfBathRooms: Integer -- numberOfFloors: Integer -- squareFeet: Integer -- price: Float -# accountNumber: String - -+ getters/setters -+ Write(Reservation): void -+ Change(Reservation, ReservationStatusEnum): void -+ update(Reservation): void -+ <<abstract>> ReservationType(): String - - - - - - - -kitchen - - - - -KitchenTypeEnum - -<<enumeration>> - -None -Kitchenette -FullKitchen - - - - -ReservationStatusEnum - -<<enumeration>> - -Draft -Canceled -Completed - - - - - - -reservation_status - - - - - -IllegalOperationException - -extends RuntimeException - - - -+ IllegalOperationException() -+ IllegalOperationException(String) - - - - - - -throws + +AccountReservationList->IReservation + + +0...* - - - -DataRepository - -<<singleton>> - -- directoryPath: String -- instance: DataRepository - -+ setDataStoreRoot(String): void -+ getPath(): String -+ Reservation(String): Reservation -+ WalkFileSystemTree(...): void -+ LoadAccount(Path): Account -- loadReservation(...): void - - - - - - -loads - - - - - - -creates + +DataRepository + +DataRepository + +- directoryPath: String +- instance: DataRepository + ++ setDataStoreRoot(String): void ++ getPath(): String ++ Reservation(String): Reservation ++ WalkFileSystemTree(AccomodationManager, Path): void ++ LoadAccount(Path): Account - - - -AccomodationManager - -- accounts: AccountList - -+ AccomodationManager(String) -+ loadAll(): void -+ load(Path): void -+ retrieveLoadedAccounts(): List<Account> -+ retrieveAccount(String): Account -+ AddAccount(Account): void -+ UpdateAccount(Account): void -+ newAccount(...): Account -+ addReservation(...): boolean -+ findReservation(String): Reservation -+ getReservationList(): List<IReservation> -+ showReservationList(): void + +AccomodationManager + +AccomodationManager + +- accounts: AccountList + ++ loadAll(): void ++ load(Path): void ++ retrieveLoadedAccounts(): List<Account> ++ retrieveAccount(String): Account ++ AddAccount(Account): void ++ UpdateAccount(Account): void ++ newAccount(String, Address, EmailAddress): Account ++ addReservation(Account, Reservation): boolean ++ findReservation(String): Reservation ++ getReservationList(): List<? extends IReservation> ++ showReservationList(): void + + + +DataRepository->AccomodationManager + + + + + +KitchenTypeEnum + +«enumeration» +KitchenTypeEnum + +None +Kitchenette +FullKitchen + + + +ReservationStatusEnum + +«enumeration» +ReservationStatusEnum + +Draft +Canceled +Completed + + + +IllegalOperationException + +IllegalOperationException + ++ IllegalOperationException() ++ IllegalOperationException(String) + + + +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 +# numberOfBedRooms: Integer +# numberOfBathRooms: Integer +# numberOfFloors: Integer +# squareFeet: Integer +# price: Float +# accountNumber: String + ++ getReservation_number(): String ++ setReservation_number(String): void ++ getAccountNumber(): String ++ setAccountNumber(String): void ++ getPhysical_address(): Address ++ setPhysical_address(Address): void ++ Write(Reservation): void ++ Change(Reservation, ReservationStatusEnum): void ++ update(Reservation): void ++ ReservationType(): String + + + +Reservation->Address + + +1 + + + +Reservation->KitchenTypeEnum + + + + + +Reservation->ReservationStatusEnum + + + + + +Reservation->IllegalOperationException + + + + + +Reservation->IReservation + + +implements + + + +ZonedDateTime + +ZonedDateTime + + + +Reservation->ZonedDateTime + + - - - - -accounts + +AccomodationManager->AccountList + + +1 - - - - -uses + +AccomodationManager->DataRepository + + + + + +AccomodationManager->Reservation + + - - - -HotelReservation - -extends Reservation -implements IReservation - -# type: 'H' - -+ HotelReservation(Address) -+ ReservationType(): String -+ checkValid(): boolean -+ getPricePerNight(): float -+ calculatePrice(): float -+ Reservation(String): Reservation + +HotelReservation + +HotelReservation + +extends Reservation + ++ HotelReservation() ++ HotelReservation(Address) ++ copy(String): Reservation ++ ReservationType(): String ++ checkValid(): boolean ++ getPricePerNight(): float ++ calculatePrice(): float - - - - - - - - - - + +HotelReservation->Reservation + + +extends - - - -CabinReservation - -extends Reservation -implements IReservation - -# type: 'C' - -+ CabinReservation(Address) -+ ReservationType(): String -+ checkValid(): boolean -+ getPricePerNight(): float -+ calculatePrice(): float -+ Reservation(String): Reservation + +CabinReservation + +CabinReservation + +extends Reservation + ++ CabinReservation() ++ CabinReservation(Address) ++ ReservationType(): String ++ checkValid(): boolean ++ getPricePerNight(): float ++ calculatePrice(): float - - - - - - - - - - + +CabinReservation->Reservation + + +extends - - - -HouseReservation - -extends Reservation -implements IReservation - -# type: 'Z' - -+ HouseReservation(Address) -+ ReservationType(): String -+ checkValid(): boolean -+ getPricePerNight(): float -+ calculatePrice(): float -+ Reservation(String): Reservation + +HouseReservation + +HouseReservation + +extends Reservation + ++ HouseReservation() ++ HouseReservation(Address) ++ copy(String): Reservation ++ ReservationType(): String ++ checkValid(): boolean ++ getPricePerNight(): float ++ calculatePrice(): float - - - - - - - - - - + +HouseReservation->Reservation + + +extends - - - -TestReservations - - - -+ main(String[]): void + +TestReservations + +TestReservations + ++ main(String[]): void - - - - -uses + +TestReservations->AccomodationManager + + - - - - -creates + +TestReservations->HotelReservation + + - - - - -creates + +TestReservations->CabinReservation + + - - - - - - -creates + +TestReservations->HouseReservation + + - - \ No newline at end of file +