Java Reference
In-Depth Information
state. As you can see, in order to define
the
POJO
façade you must have some
understanding of the presentation tier.
Consider the following example.
The
UI
for the Place Order use case
consists of several web pages. Two of
these pages are shown in figure 7.3 and
figure 7.4. Figure 7.3 shows the Restau-
rant List page, which displays the list of
available restaurants for the delivery
information entered by the user. This
page displays information obtained by a
previous request to the façade. Each res-
taurant name is a link whose
URL
has
the restaurant
ID
as a parameter.
Figure 7.4 shows the Order page,
which is displayed when the user selects
a restaurant. This page displays the
selected restaurant's menu items and
lets the user enter quantities for each
one.
When the user selects a restaurant,
their browser sends an
HTTP
request
containing a parameter that specifies
the
ID
of the selected restaurant. The
application must update the
Pending-
Order
with the selected restaurant,
retrieve the restaurant's menu items,
and display the Order page. Figure 7.5 shows how the various components handle
the request.
In order for the presentation tier to handle this request, the
PlaceOrderFacade
must provide an
updateRestaurant()
method:
Select Restaurant
Type
Name
Description
Fine Indian dining
Ajanta
Indian
XYZ Pizza
Pizza
Excellent Pizza
...
Back
Cancel
Figure 7.3
Restaurant List page
Order
Delivering to:
100 Some Street
When:
8.30pm
From:
Ajanta
Name
Quantity
Price
1
Meat Samosas
Kima Curry
$3.75
1
$9.75
Ginger Chicken
1
$10.75
Naan Bread
1
$3.75
Chapati
1
$2.75
Mango Lassi
1
$1.75
$32.50
Total
Update
Checkout
Figure 7.4
Order page
public interface PlaceOrderFacade {
public PlaceOrderFacadeResult updateRestaurant(
String pendingOrderId, String restaurantId);
…
Search WWH ::
Custom Search