orderMngmntWebapp\src\orderMngr\web\submitOrder\OrderEntryPage.java
 
/* * Copyright (c) 2006 Rogério Liesenfeld * This file is subject to the terms of the MIT license (see LICENSE.txt). */
/*...*/
5 
package orderMngr.web.submitOrder;
 
 
import java.math.*; import java.util.*; import orderMngr.domain.order.*;
import ...
 
121
public final class OrderEntryPage
  1. orderMngr.web.submitOrder.OrderEntryPageTest#submitOrder: 21
13 
{
14 
   // Data accumulated before submitting the order:
15 
   private String customerId;
16 
   private List<OrderItem> orderItems;
 
18 
   // Parameters for adding an order item:
19 
   private String productId;
20 
   private String productDescription;
21 
   private int quantity;
22 
   private BigDecimal unitPrice;
 
24 
   // Item index for removing an item:
25 
   private int itemToRemove;
 
27 
   // Resulting data when the order is submitted:
28 
   private int orderNo;
 
30 
   public void load()
31 
   {
321
      orderItems = new ArrayList<>(5);
  1. orderMngr.web.submitOrder.OrderEntryPageTest#submitOrder: 22
33 
      // use some web MVC framework service to retrieve item data, either from request parameters
34 
      // or from the HTTPSession
351
   }
  1. orderMngr.web.submitOrder.OrderEntryPageTest#submitOrder: 22
 
371
   public void setCustomerId(String customerId) { this.customerId = customerId; }
  1. orderMngr.web.submitOrder.OrderEntryPageTest#submitOrder: 25
 
392
   public List<OrderItem> getOrderItems() { return orderItems; }
  1. orderMngr.web.submitOrder.OrderEntryPageTest#submitOrder: 26, 31
 
410
   public void setProductId(String productId) { this.productId = productId; }
     
    430
       public void setProductDescription(String productDescription) { this.productDescription = productDescription; }
       
      450
         public void setQuantity(int quantity) { this.quantity = quantity; }
         
        470
           public void setUnitPrice(BigDecimal unitPrice) { this.unitPrice = unitPrice; }
           
          490
             public void setItemToRemove(int itemToRemove) { this.itemToRemove = itemToRemove; }
             
            512
               public int getOrderNo() { return orderNo; }
            1. orderMngr.web.submitOrder.OrderEntryPageTest#submitOrder: 27, 38
             
            53 
               public void addItem()
            54 
               {
            550
                  OrderItem item = new OrderItem(productId, productDescription, quantity, unitPrice);
              560
                    orderItems.add(item);
                570
                   }
                   
                  59 
                     public void removeItem()
                  60 
                     {
                  610
                        orderItems.remove(itemToRemove);
                    620
                       }
                       
                      64 
                         public void submitOrder() throws Exception
                      65 
                         {
                      661
                            Order order = new OrderFactory().createOrder(customerId, orderItems);
                      1. orderMngr.web.submitOrder.OrderEntryPageTest#submitOrder: 36
                      671
                            orderNo = order.getNumber();
                      1. orderMngr.web.submitOrder.OrderEntryPageTest#submitOrder: 36
                      681
                         }
                      1. orderMngr.web.submitOrder.OrderEntryPageTest#submitOrder: 36
                      69 
                      }