de.ix.jspTutorial.model
Class Order

java.lang.Object
  |
  +--de.ix.jspTutorial.model.Order

public class Order
extends java.lang.Object
implements XMLConstants, XMLModelInterface

This class represents a full pizza order including the base pizza, additional ingredients and the delivery address

Version:
$Id:$
Author:
Peter Rossbach (pr@webapp.de), Lars Röwekamp ( lars.roewekamp@openKnowledge.de)

Field Summary
private  Customer customer
          delivery address
private  long id
          unique id of the order
private  PersonalPizza pizza
          ordered pizza including additional ingredients
private  double price
          total cost of the order
static java.lang.String vcid
          version of the source
 
Fields inherited from interface de.ix.jspTutorial.constants.XMLConstants
XML_ADDRESS1_TAG, XML_ADDRESS2_TAG, XML_CUSTOMER_TAG, XML_DESCRIPTION_TAG, XML_EMAIL_TAG, XML_FIRSTNAME_TAG, XML_INGREDIENT_LIST_TAG, XML_INGREDIENT_TAG, XML_LASTNAME_TAG, XML_NAME_TAG, XML_ORDER_TAG, XML_PERSONAL_PIZZA_TAG, XML_PRICE_TAG, XML_ROOT_TAG, XML_SIZE_TAG, XML_TOWN_TAG, XML_ZIP_TAG
 
Constructor Summary
Order()
          Constructor for an empty order.
Order(long id, Customer customer, PersonalPizza pizza, double price)
          Constructor for a real order
 
Method Summary
 org.w3c.dom.Element generateXML(org.w3c.dom.Document document)
          method to generate XML Element containing all important Order information
 Customer getCustomer()
          Getter method for the attribute customer
 DatabaseGenericObject getGenericObject()
          Method to create a generic object
 long getId()
          Getter method for the attribute id
 java.util.List getIngredientGenericObjects()
          Create a list of ingredients out of the current order for database storage.
 PersonalPizza getPersonalPizza()
          Getter method for the attribute pizza
 DatabaseGenericObject getPizzaGenericObject()
          Create the pizza out of the current order for database storage.
 double getPrice()
          Getter method for the attribute price
 void setCustomer(Customer aCustomer)
          Setter method for the attribute customer
 void setId(long aId)
          Setter method for the attribute id
 void setPizza(PersonalPizza aPizza)
          Setter method for the attribute pizza
 void setPrice(double aPrice)
          Setter method for the attribute price
 java.lang.String toString()
          Build a string out of the order attributes.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

vcid

public static java.lang.String vcid
version of the source

id

private long id
unique id of the order

price

private double price
total cost of the order

customer

private Customer customer
delivery address

pizza

private PersonalPizza pizza
ordered pizza including additional ingredients
Constructor Detail

Order

public Order()
Constructor for an empty order. All strings are set to null, all numeric values to -1 or -1.0

Order

public Order(long id,
             Customer customer,
             PersonalPizza pizza,
             double price)
Constructor for a real order
Parameters:
id - unique id
customer - delivery address
pizza - pizza, including additional ingredients
price - total cost
Method Detail

getGenericObject

public DatabaseGenericObject getGenericObject()
Method to create a generic object
Returns:
a DatabaseGenericObject
See Also:
DatabaseGenericModifier.create(I_DatabaseGenericObject,String)

getPizzaGenericObject

public DatabaseGenericObject getPizzaGenericObject()
Create the pizza out of the current order for database storage.
Returns:
a DatabaseGenericObject
See Also:
DatabaseGenericModifier.create(I_DatabaseGenericObject,String)

getIngredientGenericObjects

public java.util.List getIngredientGenericObjects()
Create a list of ingredients out of the current order for database storage.
Returns:
a list of ingredients
See Also:
DatabaseGenericModifier.create(I_DatabaseGenericObject,String)

setPizza

public void setPizza(PersonalPizza aPizza)
Setter method for the attribute pizza
Parameters:
aPizza - new value for the attribute pizza
See Also:
getPersonalPizza()

getPersonalPizza

public PersonalPizza getPersonalPizza()
Getter method for the attribute pizza
Returns:
current value of the attribute pizza
See Also:
setPizza(PersonalPizza)

setCustomer

public void setCustomer(Customer aCustomer)
Setter method for the attribute customer
Parameters:
aCustomer - new value for the attribute customer
See Also:
getCustomer()

getCustomer

public Customer getCustomer()
Getter method for the attribute customer
Returns:
current value of the attribute customer
See Also:
setCustomer(Customer)

setPrice

public void setPrice(double aPrice)
Setter method for the attribute price
Parameters:
aPrice - new value for the attribute price
See Also:
getPrice()

getPrice

public double getPrice()
Getter method for the attribute price
Returns:
current value of the attribute price
See Also:
setPrice(double)

setId

public void setId(long aId)
Setter method for the attribute id
Parameters:
aId - new value for the attribute id
See Also:
getId()

getId

public long getId()
Getter method for the attribute id
Returns:
current value of the attribute id
See Also:
setId(long)

generateXML

public org.w3c.dom.Element generateXML(org.w3c.dom.Document document)
method to generate XML Element containing all important Order information
Specified by:
generateXML in interface XMLModelInterface
Parameters:
document - XML Document, to create xml element
Returns:
xml element containing XML representation of PersonalPizza

toString

public java.lang.String toString()
Build a string out of the order attributes.
Overrides:
toString in class java.lang.Object
Returns:
String representation of the order


~ Das iX JSP Tutorial III - © 2000 by Peter Roßbach ~