public static Customer addOrdersFromDB(Customer c) {
   Customer newCustomer = new Customer(c.getID());
   List<Order> orders = orderDAO.retrieveOrders(c);
   for (Order o : orders) {
     newCustomer.addOrder(o);
   }
   return newCustomer;
 }
Exemple #2
0
  public void abort(int transactionId) throws RemoteException, InvalidTransactionException {
    int indx = logContains(transactionId);

    Log temp;

    if (indx > -1) {

      temp = (Log) logArray.elementAt(indx);

    } else {
      System.out.println("nothing in array");
      return;
    }

    for (Enumeration e = temp.getKeys(); e.hasMoreElements(); ) {
      System.out.println("For loop");
      String key = (String) (e.nextElement());
      RMItem obj = temp.get(key);
      if (obj.getType() == 0) {
        Flight flight = (Flight) obj;
        if (flight.getCount() == -1) {
          System.out.println("entering count=-1 block");
          removeData(transactionId, key);
        } else {
          System.out.println("entering other block");
          writeData(transactionId, key, flight);
        }
      } else if (obj.getType() == 1) {
        Customer cust = (Customer) obj;
        if (cust.getID() == -1) {
          System.out.println("entering remove data for customer");
          removeData(transactionId, key);
        } else {
          System.out.println("entering write data for customer");
          writeData(transactionId, key, obj);
        }
      }
    }
  }
 public static List<Order> retrieveUnpaidOrders(Customer customer) {
   List<Order> orders = orderDAO.retrieveUnpaidOrders(customer.getID());
   return orders;
 }
Exemple #4
0
 public Order(Customer payerID, int orderNumber) {
   this.orderNumber = orderNumber;
   this.payerID = payerID.getID();
   date.clear(Calendar.MILLISECOND); // The milliseconds variable makes one unit test fail
 }
Exemple #5
0
 public Order(Customer payerID) {
   orderNumber = 0 + increment;
   increment++;
   this.payerID = payerID.getID();
   date.clear(Calendar.MILLISECOND); // The milliseconds variable makes one unit test fail
 }