Пример #1
0
  /**
   * Get an order to put in the database
   *
   * @param id for the order
   * @param warehouse for the order
   * @param station for the order
   * @param customer for the the order
   * @return order
   */
  public Order getOrder(int id, Warehouse warehouse, Station station, Customer customer) {
    Order order = new Order();

    order.setOrderID(id);
    order.setCustomerID(customer.getCustomerID());
    order.setWarehouseID(warehouse.getWarehouseID());
    order.setStationID(station.getStationID());
    order.setDateOrdered(randDate());
    order.setCompleted(1); // set as completed by default
    order.setNumLineItems(randInt(3, 10)); // number of line items per order

    customer.setDeliveriesReceived(customer.getDeliveriesReceived() + 1);
    customer.setNumPayments(customer.getNumPayments() + 1);

    return order;
  }