Java Reference
In-Depth Information
:Presentation
Tier
:PlaceOrder
Facade
:Browser
selectRestaurant(restaurantId)
updateRestaurant(pendingOrderId, restaurantId)
PendingOrder+Restaurant+MenuItems
HTML page
Figure 7.5
Handling the request that selects a restaurant
This method takes as parameters the pendingOrderId , which is stored in the
HttpSession , and the restaurant ID from the HTTP request. It returns a PlaceOr-
derFacadeResult , which consists of a status code, and the PendingOrder , which con-
tains the delivery information and a reference to the selected restaurant and its
menu items:
public class PlaceOrderFacadeResult {
private int statusCode;
private PendingOrderDetail pendingOrder;
public PlaceOrderFacadeResult(
int statusCode,
PendingOrderDetail pendingOrder) {
this.statusCode = statusCode;
this.pendingOrder = pendingOrder;
}
The status code indicates the outcome of calling the method. A façade method
can often have several expected outcomes, and a status code is a good way to com-
municate the outcome along with the data to display to the caller. PendingOrder-
Detail , which we first saw in section 7.2.1, is a view interface that provides a read-
only view of pending orders and is implemented by the PendingOrder class.
 
Search WWH ::




Custom Search