diff --git a/uml/classdiagram.svg b/uml/classdiagram.svg index e648e68..97aa79f 100644 --- a/uml/classdiagram.svg +++ b/uml/classdiagram.svg @@ -1,438 +1,462 @@ - - + + - + - -InventoryPiece -(abstract) - -+ id: String -+ price: float -+ created: ZonedDateTime -+ title: String -+ description: String -+ Author: String -- iventoryType: InventoryType - -+ getId(): String -+ setId(String): void -+ getPrice(): float -+ setPrice(float): void -+ getCreated(): ZonedDateTime -+ setCreated(ZonedDateTime): void -+ getTitle(): String -+ setTitle(String): void -+ getDescription(): String -+ setDescription(String): void -+ getAuthor(): String -+ setAuthor(String): void -+ isArt(InventoryPiece): Boolean -+ getType(): String + +InventoryPiece +«abstract» + ++ id : String ++ price : float ++ created : ZonedDateTime ++ title : String ++ description : String ++ Author : String + ++ getType() : String ++ computePrice() : float - - + + - -InventoryType + +DataRepository + +- INSTANCE : DataRepository + ++ getInstance() : DataRepository ++ generateRandomID(int) : String ++ generateRandom10DigitID() : String ++ write(InventoryManager) : void ++ write(CustomerManager) : void ++ write(TransactionManager) : void ++ WalkFileSystemTree(...) : void - - + + - - -uses + + +uses - -Drawing - -+ style: String -+ technique: String -+ category: String - -+ Drawing() + +Drawing + ++ style : String ++ technique : String ++ category : String + ++ computePrice() : float - - -extends + + +extends - -Painting - -+ height: int -+ width: int -+ style: String -+ technique: String -+ category: String - -+ Painting() + +Painting + +- height : int +- width : int +- style : String +- technique : String +- category : String + ++ computePrice() : float - - -extends + + +extends - -Print - -+ openEditionType: String -+ category: String - -+ Print() -+ Print(String, String) -+ getOpenEditionType(): String -+ setOpenEditionType(String): void -+ getCategory(): String -+ setCategory(String): void + +Print + +- openEditionType : String +- category : String + ++ computePrice() : float - - -extends + + +extends - -Sculpture - -+ material: String -+ weight: float - -+ Sculpture() + +Sculpture + +- material : String +- weight : float + ++ computePrice() : float - - -extends - - - - - -TransactionOperationEnum + + +extends - + - -Customer - -# id: String -# updated: ZonedDateTime -- phone: String -- mailing: Address -- email: String -- nameFirst: String -- nameLast: String - -+ Customer() -+ Customer(String, String, String, String) -+ getEmail(): String -+ getId(): String -+ setId(String): void -+ getPhone(): String -+ setPhone(String): void -+ getMailing(): Address -+ setMailing(Address): void -+ setEmail(String): void -+ getNameFirst(): String -+ setNameFirst(String): void -+ getNameLast(): String -+ setNameLast(String): void + +Customer + +# id : String +# updated : ZonedDateTime +- phone : String +- mailing : Address +- email : String +- nameFirst : String +- nameLast : String + ++ Customer(nameFirst, nameLast, phone, email) ++ getId() : String ++ getEmail() : String - + - -Address - -- street: String -- city: String -- state: String -- zip: String - -+ Address() -+ Address(String, String, String, String) -+ getStreet(): String -+ setStreet(String): void -+ getCity(): String -+ setCity(String): void -+ getState(): String -+ setState(String): void -+ getZip(): String -+ setZip(String): void -+ hashCode(): int -+ equals(Object): boolean -+ toString(): String + +Address + +- street : String +- city : String +- state : String +- zip : String + ++ Address(street, city, state, zip) ++ toString() : String ++ equals(Object) : boolean ++ hashCode() : int - + - - -has + + +mailing + + + + + + +uses - + - -Transaction - -- id: String -- created: ZonedDateTime -- completed: ZonedDateTime -- customerId: String -- shipToAddress: Address -- customerInventoryList: InventoryList -- attributes: JsonArray - -+ Transaction() -+ getId(): String -+ setId(String): void -+ getCreated(): ZonedDateTime -+ setCreated(ZonedDateTime): void -+ getCompleted(): ZonedDateTime -+ setCompleted(ZonedDateTime): void + +Transaction + +- id : String +- created : ZonedDateTime +- completed : ZonedDateTime +- customerId : String +- shipToAddress : Address +- customerInventoryList : InventoryList +- totalPrice : float +- attributes : JsonArray + +# Transaction(customer, cart) ++ check() : void ++ toString() : String + + + + + +customerId - + - - -shipToAddress + + +shipToAddress - + - -InventoryList + +InventoryList + ++ InventoryList() ++ add(InventoryPiece) : boolean - + - - -customerInventoryList + + +customerInventoryList + + + + + + +uses - + - - -contains + + +contains + + + + + +ArrayList +«Java Util» + + + + + + +extends - + - -CustomerList + +CustomerList + ++ CustomerList() - + - - -contains + + +contains + + + + + + +extends - + - -TransactionList + +TransactionList + ++ TransactionList() ++ add(Transaction) : boolean - + - - -contains + + +contains + + + + + + +extends - + - -InventoryManager - -+ INVENTORY: InventoryList -- INSTANCE: InventoryManager - + +InventoryManager + ++ INVENTORY : InventoryList +- INSTANCE : InventoryManager + ++ getInstance() : InventoryManager ++ add(InventoryPiece) : void ++ find(String) : InventoryPiece ++ Remove(InventoryPiece) : InventoryPiece ++ save() : void ++ load() : void - + - - -INVENTORY + + +INVENTORY + + + + + + +uses - + - -CustomerManager - -+ CUSTOMERS: CustomerList -- INSTANCE: CustomerManager - -+ getInstance(): CustomerManager -+ add(Customer): boolean -- check(Customer): void -+ findById(String): Customer -+ findByEmail(String): Customer + +CustomerManager + ++ CUSTOMERS : CustomerList +- INSTANCE : CustomerManager + ++ getInstance() : CustomerManager ++ add(Customer) : boolean ++ findByEmail(String) : Customer ++ save() : void ++ load() : void - + - - -CUSTOMERS + + +CUSTOMERS - - + + - -InvalidRecordDataException - - -+ InvalidRecordDataException(String) -+ InvalidRecordDataException(String, Throwable) -+ InvalidRecordDataException(Throwable) - - - - - - -throws + + +uses - + - -TransactionManager - -+ TRANSACTIONS: TransactionList -- INSTANCE: TransactionManager - -+ getInstance(): TransactionManager -+ TransactRequest(Customer, InventoryList, Transaction): Transaction -+ compute(Transaction, TransactionOperationEnum): void -+ compute(Transaction): void -+ complete(Transaction): void -+ findByCustomerEmail(String): TransactionList -+ findByTransactionId(String): TransactionList -+ findByTransactionDate(ZonedDateTime): TransactionList -+ remove(Transaction): void -+ save(): void - - - - - - -uses + +TransactionManager + ++ TRANSACTIONS : TransactionList +- INSTANCE : TransactionManager + ++ getInstance() : TransactionManager ++ TransactRequest(Customer, InventoryList) : Transaction ++ complete(Transaction) : void ++ compute(Transaction) : void ++ save() : void ++ load() : void - + - - -uses + + +uses - + - - -uses + + +uses - + - - -TRANSACTIONS + + +TRANSACTIONS - - + + - -DataRepository - - - - - - -uses - - - - - - -uses - - - - - - -uses + + +uses - + - -InvalidArtOperationException - - -+ InvalidArtOperationException(String) -+ InvalidArtOperationException(String, Throwable) -+ InvalidArtOperationException(Throwable) + +InvalidArtOperationException + ++ InvalidArtOperationException(String) + + + + + +RuntimeException +«Java Lang» + + + + + + +extends + + + + + +InvalidRecordDataException + ++ InvalidRecordDataException(String) + + + + + + +extends - + - -InvalidTransactionException - - -+ InvalidTransactionException(String) -+ InvalidTransactionException(String, Throwable) -+ InvalidTransactionException(Throwable) + +InvalidTransactionException + ++ InvalidTransactionException(String) + + + + + + +extends - + - -InvalidTransOperationException - - -+ InvalidTransOperationException(String) -+ InvalidTransOperationException(String, Throwable) -+ InvalidTransOperationException(Throwable) + +InvalidTransOperationException + ++ InvalidTransOperationException(String) + + + + + + +extends \ No newline at end of file diff --git a/uml/classdiagram3.dot b/uml/classdiagram3.dot index 31b868f..f683ef9 100644 --- a/uml/classdiagram3.dot +++ b/uml/classdiagram3.dot @@ -1,87 +1,84 @@ digraph InventoryMClassDiagram { rankdir=TB; - node [shape=record, fontname="Arial", fontsize=10]; - edge [fontname="Arial", fontsize=9]; - - // Core Model Classes - Address [label="{Address|+ street : String\l+ city : String\l+ state : String\l+ zip : String\l|+ getStreet() : String\l+ setStreet(String)\l+ getCity() : String\l+ setCity(String)\l+ getState() : String\l+ setState(String)\l+ getZip() : String\l+ setZip(String)\l+ hashCode() : int\l+ equals(Object) : boolean\l+ toString() : String\l}"]; - - Customer [label="{Customer|# id : String\l# updated : ZonedDateTime\l- phone : String\l- mailing : Address\l- email : String\l- nameFirst : String\l- nameLast : String\l|+ Customer(String, String, String, String)\l+ getId() : String\l+ setId(String)\l+ getPhone() : String\l+ setPhone(String)\l+ getMailing() : Address\l+ setMailing(Address)\l+ getEmail() : String\l+ setEmail(String)\l+ getNameFirst() : String\l+ setNameFirst(String)\l+ getNameLast() : String\l+ setNameLast(String)\l}"]; - - // Inventory Hierarchy - InventoryPiece [label="{«abstract»\lInventoryPiece|+ id : String\l+ price : float\l+ created : ZonedDateTime\l+ title : String\l+ description : String\l+ Author : String\l|+ InventoryPiece()\l+ getType() : String\l+ getId() : String\l+ setId(String)\l+ getPrice() : float\l+ setPrice(float)\l+ getCreated() : ZonedDateTime\l+ setCreated(ZonedDateTime)\l+ getTitle() : String\l+ setTitle(String)\l+ getDescription() : String\l+ setDescription(String)\l+ getAuthor() : String\l+ setAuthor(String)\l+ computePrice() : float\l}" style=filled, fillcolor=lightblue]; - - Drawing [label="{Drawing|+ style : String\l+ technique : String\l+ category : String\l|+ Drawing()\l+ computePrice() : float\l}"]; - - Painting [label="{Painting|- height : int\l- width : int\l- style : String\l- technique : String\l- category : String\l|+ Painting()\l+ Painting(int, int)\l+ getHeight() : int\l+ setHeight(int)\l+ getWidth() : int\l+ setWidth(int)\l+ getStyle() : String\l+ setStyle(String)\l+ getTechnique() : String\l+ setTechnique(String)\l+ getCategory() : String\l+ setCategory(String)\l+ computePrice() : float\l}"]; - - Print [label="{Print|- openEditionType : String\l- category : String\l|+ Print()\l+ Print(String, String)\l+ getOpenEditionType() : String\l+ setOpenEditionType(String)\l+ getCategory() : String\l+ setCategory(String)\l+ computePrice() : float\l}"]; - - Sculpture [label="{Sculpture|- material : String\l- weight : float\l|+ Sculpture()\l+ Sculpture(float)\l+ getMaterial() : String\l+ setMaterial(String)\l+ getWeight() : float\l+ setWeight(float)\l+ computePrice() : float\l}"]; - - Transaction [label="{Transaction|- id : String\l- created : ZonedDateTime\l- completed : ZonedDateTime\l- customerId : String\l- shipToAddress : Address\l- customerInventoryList : InventoryList\l- totalPrice : float\l- attributes : JsonArray\l|# Transaction(Customer, InventoryList)\l+ getId() : String\l+ setId(String)\l+ getCreated() : ZonedDateTime\l+ setCreated(ZonedDateTime)\l+ getCompleted() : ZonedDateTime\l+ setCompleted(ZonedDateTime)\l+ getCustomerId() : String\l+ setCustomerId(String)\l+ getShipToAddress() : Address\l+ setShipToAddress(Address)\l+ getCustomerInventoryList() : InventoryList\l+ setCustomerInventoryList(InventoryList)\l+ getTotalPrice() : float\l+ setTotalPrice(float)\l+ getAttributes() : JsonArray\l+ setAttributes(JsonArray)\l+ toString() : String\l}"]; - - // List Classes (extend ArrayList) - CustomerList [label="{CustomerList|+ CustomerList()\l}" style=filled, fillcolor=lightyellow]; - InventoryList [label="{InventoryList|+ InventoryList()\l+ add(InventoryPiece) : boolean\l}" style=filled, fillcolor=lightyellow]; - TransactionList [label="{TransactionList|+ TransactionList()\l+ add(Transaction) : boolean\l}" style=filled, fillcolor=lightyellow]; - + node [shape=record, style=filled, fillcolor=lightblue]; + + // Abstract Classes + InventoryPiece [label="{InventoryPiece\n«abstract»|+ id : String\l+ price : float\l+ created : ZonedDateTime\l+ title : String\l+ description : String\l+ Author : String\l|+ getType() : String\l+ computePrice() : float\l}", fillcolor=lightyellow]; + + // Concrete Classes - Inventory Items + Drawing [label="{Drawing|+ style : String\l+ technique : String\l+ category : String\l|+ computePrice() : float\l}"]; + Painting [label="{Painting|- height : int\l- width : int\l- style : String\l- technique : String\l- category : String\l|+ computePrice() : float\l}"]; + Print [label="{Print|- openEditionType : String\l- category : String\l|+ computePrice() : float\l}"]; + Sculpture [label="{Sculpture|- material : String\l- weight : float\l|+ computePrice() : float\l}"]; + + // Customer and Address + Customer [label="{Customer|# id : String\l# updated : ZonedDateTime\l- phone : String\l- mailing : Address\l- email : String\l- nameFirst : String\l- nameLast : String\l|+ Customer(nameFirst, nameLast, phone, email)\l+ getId() : String\l+ getEmail() : String\l}"]; + Address [label="{Address|- street : String\l- city : String\l- state : String\l- zip : String\l|+ Address(street, city, state, zip)\l+ toString() : String\l+ equals(Object) : boolean\l+ hashCode() : int\l}"]; + + // Transaction + Transaction [label="{Transaction|- id : String\l- created : ZonedDateTime\l- completed : ZonedDateTime\l- customerId : String\l- shipToAddress : Address\l- customerInventoryList : InventoryList\l- totalPrice : float\l- attributes : JsonArray\l|# Transaction(customer, cart)\l+ check() : void\l+ toString() : String\l}"]; + + // List Classes + InventoryList [label="{InventoryList|+ InventoryList()\l+ add(InventoryPiece) : boolean\l}"]; + CustomerList [label="{CustomerList|+ CustomerList()\l}"]; + TransactionList [label="{TransactionList|+ TransactionList()\l+ add(Transaction) : boolean\l}"]; + // Manager Classes (Singletons) - CustomerManager [label="{CustomerManager|- INSTANCE : CustomerManager\l+ CUSTOMERS : CustomerList\l|+ getInstance() : CustomerManager\l+ add(Customer) : boolean\l- check(Customer)\l+ findById(String) : Customer\l+ findByEmail(String) : Customer\l+ save()\l+ load()\l}" style=filled, fillcolor=lightgreen]; - - InventoryManager [label="{InventoryManager|- INSTANCE : InventoryManager\l+ INVENTORY : InventoryList\l|+ getInstance() : InventoryManager\l+ add(InventoryPiece)\l+ find(String) : InventoryPiece\l+ update(InventoryPiece) : InventoryPiece\l+ Remove(InventoryPiece) : InventoryPiece\l+ save()\l+ load()\l}" style=filled, fillcolor=lightgreen]; - - TransactionManager [label="{TransactionManager|- INSTANCE : TransactionManager\l+ TRANSACTIONS : TransactionList\l|+ getInstance() : TransactionManager\l+ TransactRequest(Customer, InventoryList) : Transaction\l+ complete(Transaction)\l+ compute(Transaction)\l+ findByCustomerEmail(String) : TransactionList\l+ findByTransactionId(String) : TransactionList\l+ findByTransactionDate(ZonedDateTime) : TransactionList\l+ remove(Transaction)\l+ save()\l}" style=filled, fillcolor=lightgreen]; - - DataRepository [label="{DataRepository|- INSTANCE : DataRepository\l|+ getInstance() : DataRepository\l+ generateRandomID(int) : String\l+ generateRandom10DigitID() : String\l+ WalkFileSystemTree(InventoryManager)\l+ WalkFileSystemTree(CustomerManager)\l+ WalkFileSystemTree(TransactionManager)\l+ mapJsonToObjectList(String, Class) : List\l- write(CustomerManager)\l- write(InventoryManager)\l- read(CustomerManager, Path)\l- read(InventoryManager, Path)\l}" style=filled, fillcolor=lightcoral]; - + InventoryManager [label="{InventoryManager|+ INVENTORY : InventoryList\l- INSTANCE : InventoryManager\l|+ getInstance() : InventoryManager\l+ add(InventoryPiece) : void\l+ find(String) : InventoryPiece\l+ Remove(InventoryPiece) : InventoryPiece\l+ save() : void\l+ load() : void\l}"]; + CustomerManager [label="{CustomerManager|+ CUSTOMERS : CustomerList\l- INSTANCE : CustomerManager\l|+ getInstance() : CustomerManager\l+ add(Customer) : boolean\l+ findByEmail(String) : Customer\l+ save() : void\l+ load() : void\l}"]; + TransactionManager [label="{TransactionManager|+ TRANSACTIONS : TransactionList\l- INSTANCE : TransactionManager\l|+ getInstance() : TransactionManager\l+ TransactRequest(Customer, InventoryList) : Transaction\l+ complete(Transaction) : void\l+ compute(Transaction) : void\l+ save() : void\l+ load() : void\l}"]; + + // Repository + DataRepository [label="{DataRepository|- INSTANCE : DataRepository\l|+ getInstance() : DataRepository\l+ generateRandomID(int) : String\l+ generateRandom10DigitID() : String\l+ write(InventoryManager) : void\l+ write(CustomerManager) : void\l+ write(TransactionManager) : void\l+ WalkFileSystemTree(...) : void\l}"]; + // Exception Classes - InvalidArtOperationException [label="{InvalidArtOperationException|+ InvalidArtOperationException(String)\l+ InvalidArtOperationException(String, Throwable)\l+ InvalidArtOperationException(Throwable)\l}" style=filled, fillcolor=pink]; - - InvalidRecordDataException [label="{InvalidRecordDataException|+ InvalidRecordDataException(String)\l+ InvalidRecordDataException(String, Throwable)\l+ InvalidRecordDataException(Throwable)\l}" style=filled, fillcolor=pink]; - - InvalidTransactionException [label="{InvalidTransactionException|+ InvalidTransactionException(String)\l+ InvalidTransactionException(String, Throwable)\l+ InvalidTransactionException(Throwable)\l}" style=filled, fillcolor=pink]; - - InvalidTransOperationException [label="{InvalidTransOperationException|+ InvalidTransOperationException(String)\l+ InvalidTransOperationException(String, Throwable)\l+ InvalidTransOperationException(Throwable)\l}" style=filled, fillcolor=pink]; - - // Inheritance relationships + InvalidArtOperationException [label="{InvalidArtOperationException|+ InvalidArtOperationException(String)\l}", fillcolor=lightcoral]; + InvalidRecordDataException [label="{InvalidRecordDataException|+ InvalidRecordDataException(String)\l}", fillcolor=lightcoral]; + InvalidTransactionException [label="{InvalidTransactionException|+ InvalidTransactionException(String)\l}", fillcolor=lightcoral]; + InvalidTransOperationException [label="{InvalidTransOperationException|+ InvalidTransOperationException(String)\l}", fillcolor=lightcoral]; + + // Inheritance Relationships Drawing -> InventoryPiece [arrowhead=empty, label="extends"]; Painting -> InventoryPiece [arrowhead=empty, label="extends"]; Print -> InventoryPiece [arrowhead=empty, label="extends"]; Sculpture -> InventoryPiece [arrowhead=empty, label="extends"]; - - CustomerList -> Customer [arrowhead=diamond, label="contains"]; - InventoryList -> InventoryPiece [arrowhead=diamond, label="contains"]; - TransactionList -> Transaction [arrowhead=diamond, label="contains"]; - - // Associations - Customer -> Address [arrowhead=open, label="has"]; - Transaction -> Address [arrowhead=open, label="shipTo"]; - Transaction -> InventoryList [arrowhead=open, label="has"]; - Transaction -> Customer [arrowhead=open, style=dashed, label="references"]; - - // Manager relationships - CustomerManager -> CustomerList [arrowhead=diamond]; - InventoryManager -> InventoryList [arrowhead=diamond]; - TransactionManager -> TransactionList [arrowhead=diamond]; - - // DataRepository relationships - DataRepository -> CustomerManager [arrowhead=open, style=dashed, label="persists"]; - DataRepository -> InventoryManager [arrowhead=open, style=dashed, label="persists"]; - DataRepository -> TransactionManager [arrowhead=open, style=dashed, label="persists"]; - - // Exception usage - CustomerManager -> InvalidRecordDataException [arrowhead=open, style=dashed, label="throws"]; - - // Legend - subgraph cluster_legend { - label="Legend"; - style=dashed; - - legend1 [label="Abstract Class" style=filled, fillcolor=lightblue, shape=box]; - legend2 [label="Manager (Singleton)" style=filled, fillcolor=lightgreen, shape=box]; - legend3 [label="Collection" style=filled, fillcolor=lightyellow, shape=box]; - legend4 [label="Repository" style=filled, fillcolor=lightcoral, shape=box]; - legend5 [label="Exception" style=filled, fillcolor=pink, shape=box]; - } + + InventoryList -> ArrayList [arrowhead=empty, label="extends", style=dashed]; + CustomerList -> ArrayList [arrowhead=empty, label="extends", style=dashed]; + TransactionList -> ArrayList [arrowhead=empty, label="extends", style=dashed]; + + InvalidArtOperationException -> RuntimeException [arrowhead=empty, label="extends", style=dashed]; + InvalidRecordDataException -> RuntimeException [arrowhead=empty, label="extends", style=dashed]; + InvalidTransactionException -> RuntimeException [arrowhead=empty, label="extends", style=dashed]; + InvalidTransOperationException -> RuntimeException [arrowhead=empty, label="extends", style=dashed]; + + // Composition/Aggregation Relationships + Customer -> Address [arrowhead=diamond, label="mailing"]; + Transaction -> Address [arrowhead=diamond, label="shipToAddress"]; + Transaction -> InventoryList [arrowhead=diamond, label="customerInventoryList"]; + Transaction -> Customer [arrowhead=none, style=dashed, label="customerId"]; + + InventoryManager -> InventoryList [arrowhead=diamond, label="INVENTORY"]; + CustomerManager -> CustomerList [arrowhead=diamond, label="CUSTOMERS"]; + TransactionManager -> TransactionList [arrowhead=diamond, label="TRANSACTIONS"]; + + InventoryList -> InventoryPiece [arrowhead=odiamond, label="contains"]; + CustomerList -> Customer [arrowhead=odiamond, label="contains"]; + TransactionList -> Transaction [arrowhead=odiamond, label="contains"]; + + // Dependencies + InventoryManager -> DataRepository [arrowhead=vee, style=dashed, label="uses"]; + CustomerManager -> DataRepository [arrowhead=vee, style=dashed, label="uses"]; + TransactionManager -> DataRepository [arrowhead=vee, style=dashed, label="uses"]; + + Customer -> DataRepository [arrowhead=vee, style=dashed, label="uses"]; + InventoryPiece -> DataRepository [arrowhead=vee, style=dashed, label="uses"]; + Transaction -> DataRepository [arrowhead=vee, style=dashed, label="uses"]; + + TransactionManager -> Customer [arrowhead=vee, style=dashed, label="uses"]; + TransactionManager -> InventoryList [arrowhead=vee, style=dashed, label="uses"]; + + // External Classes (referenced but not defined) + ArrayList [label="{ArrayList\n«Java Util»}", fillcolor=lightgray, style="filled,dashed"]; + RuntimeException [label="{RuntimeException\n«Java Lang»}", fillcolor=lightgray, style="filled,dashed"]; } \ No newline at end of file