Java Reference
In-Depth Information
PlaceOrderService
updateDeliveryInfo ()
updateRestaurant ()
...
<<
interface
>>
PendingOrderRepository
<<
interface
>>
OrderRepository
create()
find()
findOrCreatePendingOrder()
<<
interface
>>
Restaurant Repository
findRestaurant()
findAvailableRestaurants()
...
Address
Address
Order
street1
city
state
...
updateDeliveryInfo()
updateRestaurant()
getTotal()
...
PendingOrder
Payment
Information
deliveryTime
updateDeliveryInfo ()
updateRestaurant()
getTotal()
...
Restaurant
Payment
Information
Name
serviceArea
<<
interface
>>
Coupon
opening hours
PendingOrder
LineItem
<<
interface
>>
Coupon
TimeRange
OrderLineItem
quantity
calculateDiscount()
MenuItem
get
ExtendedPrice()
quantity
name
price
getExtendedPric
e ()
Figure 3.2
Domain model-based business logic for the Food to Go application
There are lots of details on this diagram, but let's focus on the important classes.
The key classes are as follows:
■
PlaceOrderService
: Defines methods that correspond to steps of the Place
Order use case and update domain model objects.
■
PendingOrder
: This application's shopping cart.
PendingOrder
has a delivery
time attribute and a delivery address, a collection of line items, an associ-
ated restaurant, and a coupon. Each line item has a quantity attribute and
an associated
MenuItem
.
■
Restaurant
: Represents a restaurant that prepares food for delivery. A res-
taurant has a name attribute and one or more menu items available for
delivery, a geographic service area (which consists of a set of ZIP codes),
and opening hours.
■
MenuItem
: Describes a menu item and has a name, a description, and a price.
Search WWH ::
Custom Search