UML Weekend Crash Course™ - To Parent Directory

UML Weekend Crash Course™ - To Parent Directory UML Weekend Crash Course™ - To Parent Directory

crnarupa.singidunum.ac.rs
from crnarupa.singidunum.ac.rs More from this publisher
01.01.2015 Views

Session 21—Applying the Basic Statechart to the Case Study 221 Applying the Basic Statechart Diagram Notation to the Case Study Now it’s time to bring all these concepts together to construct the Statechart for one of the case study objects. This time I use the Product. The problem statement below adds a little more information so that you can exercise the Statechart notation you’ve learned so far. Inventory control: Problem statement Products are first entered into our system when they are ordered using a purchase order (P.O.). Each product keeps a record of the originating P.O. When the product is received, it is placed into inventory by recording the location where it is placed. When the product is received, you have to update the P.O. to indicate that you have received the product. When a product is sold, the product tracks the order to which it belongs. When a product is sold, it is also packed for shipping and the associated shipment is recorded. When the product is shipped, you need to record the shipper and the date it was picked up. Occasionally, a product is returned. In that case, you put the product back into inventory and record the location. Constructing the Statechart diagram for the product object “Products are first entered into our system when they are ordered using a purchase order (P.O.). Each product keeps a record of the originating P.O.” The initial state is On Order. The action is to record the purchase order. Notice in Figure 21-5 that an action may be associated with the creation of the object. / setPO(PO) On Order Figure 21-5 Model the initial state of the product.

222 Sunday Morning “When the product is received, it is placed into inventory by recording the location where it is placed. When the product is received, you have to update the P.O. to indicate that you have received the product.” Figure 21-6 shows that the transition from On Order to Inventoried is triggered by the receive event. The associated actions are to update the purchase order object with the product and quantity received and update the product with the inventory location. On Order entry:setPO(PO) receive / PO.receiveProduct(Product, qty) inventory(location). Inventoried Figure 21-6 Inventory the product and update the P.O. “When a product is sold, the product tracks the order to which it belongs.” Figure 21-7 shows the sell event triggering the transition to the sold state and the action to record the Order that now holds the product. Inventoried sell/ setOrder(Order) Sold Figure 21-7 Sell the product and record the order.

222<br />

Sunday Morning<br />

“When the product is received, it is placed into inventory by recording the location<br />

where it is placed. When the product is received, you have to update the P.O. to indicate<br />

that you have received the product.” Figure 21-6 shows that the transition from On Order to<br />

Inventoried is triggered by the receive event. The associated actions are to update the purchase<br />

order object with the product and quantity received and update the product with the<br />

inventory location.<br />

On Order<br />

entry:setPO(PO)<br />

receive /<br />

PO.receiveProduct(Product, qty)<br />

inventory(location).<br />

Inventoried<br />

Figure 21-6 Inventory the product and update the P.O.<br />

“When a product is sold, the product tracks the order to which it belongs.” Figure 21-7<br />

shows the sell event triggering the transition to the sold state and the action to record the<br />

Order that now holds the product.<br />

Inventoried<br />

sell/<br />

setOrder(Order)<br />

Sold<br />

Figure 21-7<br />

Sell the product and record the order.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!