|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorderprocessing.Order
This class represents a single order from a single customer.
Additionally, this class maintains a collection of all Orders.
Constructor Summary | |
Order(Customer customer,
Address shipAddress,
java.util.ArrayList orderedItems,
CalculationCalendar orderDate)
Create an Order for a particular customer and a sequence of items ordered |
|
Order(Customer customer,
Address shipAddress,
BillingTerms billingTerms,
java.util.ArrayList orderedItems,
CalculationCalendar orderDate,
CalculationCalendar requestedShippingDate,
CalculationCalendar cancelDate)
Create an Order for a particular customer and a sequence of items ordered |
Method Summary | |
Address |
billingAddress()
Retrieve the billing address for this order's customer |
BillingTerms |
billingTerms()
Retrieve the billing terms for this order |
void |
billingTerms(BillingTerms billingTerms)
Assign new billing terms to this order |
CalculationCalendar |
cancelDate()
Retrieve the last date on which the customer may cancel the order |
void |
cancelOrder()
Cancel this order |
static void |
close(java.io.ObjectOutputStream out)
Write out all the orders at the end of a run to the saved database |
Customer |
customer()
Retrieve the customer for this order |
void |
display()
Display this order on standard output (mostly for debugging) |
static void |
dump()
Show all of the orders on standard output |
boolean |
equals(java.lang.Object other)
|
void |
format(java.io.BufferedWriter file)
Format this order in a readable way and write on a stream |
static void |
formatAll(java.io.BufferedWriter file)
Format all known orders (not just outstanding ones) and print to a file |
static Order |
get(java.lang.String key)
Retrieve an order from its system assigned order number |
int |
hashcode()
|
boolean |
isCancelled()
Return whether this order has been cancelled or not |
java.lang.String |
key()
Retrieve the order number for this order |
static java.util.Iterator |
keys()
Provide an iteration service over the order numbers that have been created |
static void |
open(java.io.ObjectInputStream in)
Read in all the orders at the beginning of a run from the saved database |
CalculationCalendar |
orderDate()
Retrieve the date this order was created |
java.util.Iterator |
orderedItems()
Provide an iteration service for the items ordered on this order |
static java.util.Iterator |
orders()
Provide an iteration service over all orders |
CalculationCalendar |
requestedShippingDate()
Retrieve the date the customer would like the order shipped |
Address |
shippingAddress()
Retrieve the shipping address for this order |
void |
shippingAddress(Address address)
Give this order a new ship address |
int |
size()
Retrieve the number of order items on this order |
java.lang.String |
toString()
|
double |
total()
return the extended total dollar value of this order |
boolean |
valid()
Return whether this is a valid order or not |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Order(Customer customer, Address shipAddress, java.util.ArrayList orderedItems, CalculationCalendar orderDate)
customer
- The customer ordering these itemsshipAddress
- The address the order should be shipped to.orderedItems
- A ArrayList of OrderItems representing the items orderedorderDate
- The date that this order was placedpublic Order(Customer customer, Address shipAddress, BillingTerms billingTerms, java.util.ArrayList orderedItems, CalculationCalendar orderDate, CalculationCalendar requestedShippingDate, CalculationCalendar cancelDate)
customer
- The customer ordering these itemsshipAddress
- The Shipping Address if different from the customer's defaultbillingTerms
- The billing terms for order if not the customer's default.orderedItems
- A ArrayList of OrderItems representing the items orderedorderDate
- The date that this order was placedrequestedShippingDate
- Requested shipping date by customercancelDate
- Requested cancelation date for this order.Method Detail |
public Customer customer()
public Address billingAddress()
public Address shippingAddress()
public java.util.Iterator orderedItems()
public int size()
public CalculationCalendar orderDate()
public CalculationCalendar requestedShippingDate()
public CalculationCalendar cancelDate()
public boolean valid()
public java.lang.String key()
public BillingTerms billingTerms()
public boolean isCancelled()
public double total()
public void cancelOrder()
public void billingTerms(BillingTerms billingTerms)
billingTerms
- the new termspublic static void formatAll(java.io.BufferedWriter file)
file
- the stream to write ontopublic void format(java.io.BufferedWriter file) throws java.io.IOException
file
- the stream to write to
java.io.IOException
public void shippingAddress(Address address)
address
- the new ship addresspublic void display()
public boolean equals(java.lang.Object other)
public int hashcode()
public java.lang.String toString()
public static Order get(java.lang.String key)
key
- the order number of the desired order
public static final void close(java.io.ObjectOutputStream out) throws java.io.IOException
out
- the Object stream to write to
java.io.IOException
public static final void open(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
in
- the stream to read from
java.io.IOException
java.lang.ClassNotFoundException
public static java.util.Iterator orders()
public static java.util.Iterator keys()
public static void dump()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |