Expand the Order Domain Model
Continue the previous class diagram by describing Order Item and Product data, then connect the concepts with a directed association.
Starting Model
Open Order Domain Model. Order already has attributes and a method, and its
composition shows that an order owns one or more items.
Order Item Data
Select Order Item and open Class Attributes in the properties panel.
Add two attributes:
quantity— number of product units, typeInteger;price— unit price in the order, typeDecimal.
Select Apply to display both attributes inside the class on the diagram.
Product Data
Select Product and add two attributes:
productId— unique identifier, typeString;name— product name in the catalog, typeString.
Apply the changes and verify that both attributes appear inside the class.
Connect Order Item to Product
Select New: Relationship. Choose Order Item as the source and Product as
the target. Name it Refers to Product and add a brief description.
After saving, select the relationship and set its type to Association, source
multiplicity to 0..*, and target multiplicity to 1. A product may occur in
many order items, while each item refers to exactly one product.
Result
Clear the selection and review the complete model. It now describes an order, its items, and the catalog product referenced by each item.
Chapters
00:00— lesson objective;00:06— selecting Order Item;00:08— item attributes;00:25— applying changes;00:31— selecting Product;00:33— product attributes;00:52— applying changes;00:58— creating the relationship;01:02— selecting the source;01:05— selecting the target;01:11— saving the relationship;01:17— relationship type;01:24— item multiplicity;01:31— product multiplicity;01:40— final model.
Previous lesson: Class Attributes, Methods, and Relationships.
Next lesson: Basic Order Lifecycle.