Skip to main content

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.

Full lesson walkthrough in the selected color theme.

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.

Loading image...
Order owns its items through composition, while Product remains separate

Order Item Data​

Select Order Item and open Class Attributes in the properties panel.

Loading image...
The attribute editor opens from the selected class properties

Add two attributes:

  • quantity — number of product units, type Integer;
  • price — unit price in the order, type Decimal.
Loading image...
Each row contains a name, description, and data type

Select Apply to display both attributes inside the class on the diagram.

Loading image...
The diagram shows the Order Item data structure

Product Data​

Select Product and add two attributes:

  • productId — unique identifier, type String;
  • name — product name in the catalog, type String.
Loading image...
The minimal data set identifies a product and presents it to the user

Apply the changes and verify that both attributes appear inside the class.

Loading image...
Product now contains its core catalog data

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.

Loading image...
The source, target, name, and description establish the relationship's meaning

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.

Loading image...
The association connects zero or more order items to 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.

Loading image...
Orders, items, and products form a connected model with attributes and multiplicities

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.