## de.ix.jspTutorial.model
Class PizzaAccessor

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

public class PizzaAccessor
extends java.lang.Object

ne Class declaration

Version:
  $Id:$
Author:
  Peter Rossbach (pr@webapp.de)

Field Summary
`private javax.servlet.ServletContext` `myApplication` The ServletContext
`private DatabaseConnection` `myConnection` Connection to DB
`private DatabaseGenericModifier` `myModifier` Connection to the DB modifier
`private DatabaseRetriever` `myRetriever` Connection to the DB retriver object
`static java.lang.String` `vcid` version of the source

Constructor Summary
`PizzaAccessor(DatabaseConnection aConnection)` Create an access to a specified DB
`PizzaAccessor(javax.servlet.ServletContext aApplication)` Create a connection to the Instant DB Test DB.

Method Summary
`boolean` `checkCustomer(Customer aCustomer)` Check if a given customer is part of the DB
`Customer` `generateCustomer(javax.servlet.http.HttpServletRequest request)` Generate a `Customer` object with the help * of a HttpServletRequest
`DatabaseConnection` `getConnection()` Getter method for the attribute `myConnection`
`void` `log(java.lang.String msg)` Output of a message to the servlet log of the container
`void` `log(java.lang.String message, java.lang.Throwable throwable)` Output of a message and an exception to the servlet log of the container
`boolean` `newCustomer(Customer aCustomer)` Create a new customer inside the DB *
`Order` `newOrder(Customer aCustomer, PersonalPizza aPersonalPizza)` Create a new order record inside the db and change the depending customer record if necessary.
`java.util.TreeMap` `readIngredientList(javax.servlet.ServletContext aApplication)` Read all possible ingreddients from the DB
`java.util.TreeMap` `readPizzaList(javax.servlet.ServletContext aApplication)` Read list of all possible pizza types from the DB
`void` `setConnection(DatabaseConnection aConnection)` setter method for the attribute `myConnection`

Methods inherited from class java.lang.Object
`<clinit>, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait`

Field Detail

### vcid

    public static java.lang.String vcid

  version of the source

### myConnection

    private DatabaseConnection myConnection

  Connection to DB

### myRetriever

    private DatabaseRetriever myRetriever

  Connection to the DB retriver object

### myModifier

    private DatabaseGenericModifier myModifier

  Connection to the DB modifier

### myApplication

    private javax.servlet.ServletContext myApplication

  The ServletContext

Constructor Detail

### PizzaAccessor

    public PizzaAccessor(javax.servlet.ServletContext aApplication)

  Create a connection to the Instant DB Test DB. The connection will be create once per application inside the PizzaServiceFC.jsp and then released again.
  Parameters:
    `aAppliation` - current ServletContext
  See Also:
    `JspTutorialStartServlet`

### PizzaAccessor

    public PizzaAccessor(DatabaseConnection aConnection)

  Create an access to a specified DB
  Parameters:
    `aConnection` - database connection

Method Detail

### setConnection

    public void setConnection(DatabaseConnection aConnection)

  setter method for the attribute `myConnection`
  Parameters:
    `aConnection` - database connectionDatenbankverbindung

### getConnection

    public DatabaseConnection getConnection()

  Getter method for the attribute `myConnection`
  Returns:
    a database connection

### readPizzaList

    public java.util.TreeMap readPizzaList(javax.servlet.ServletContext aApplication)

  Read list of all possible pizza types from the DB
  Parameters:
    `aApplication` - current servlet context
  Returns:
    list of all possible pizza types

### readIngredientList

    public java.util.TreeMap readIngredientList(javax.servlet.ServletContext aApplication)

  Read all possible ingreddients from the DB
  Parameters:
    `aApplication` - current servlet context
  Returns:
    list of all possible ingredient tyesListe der Zutaten

### checkCustomer

    public boolean checkCustomer(Customer aCustomer)

  Check if a given customer is part of the DB
  Parameters:
    `aCustomerID` - unique id of the Pizza Service customer
  Returns:
    true, if customer exist with the given customer id * false else

### generateCustomer

    public Customer generateCustomer(javax.servlet.http.HttpServletRequest request)

  Generate a `Customer` object with the help * of a HttpServletRequest
  Parameters:
    `request` - a http request * * @return generated customer object

### newCustomer

    public boolean newCustomer(Customer aCustomer)

  Create a new customer inside the DB *
  Parameters:
    `aCustomer` - customers data * * @return true, if it was possible to create the new customer * false else

### newOrder

    public Order newOrder(Customer aCustomer,
                          PersonalPizza aPersonalPizza)

  Create a new order record inside the db and change the depending customer record if necessary.
  Parameters:
    `aCustomer` - customer, who orderd the pizza
    `aPersonalPizza` - base pizza plus additional ingredients
  Returns:
    Order, if it was possible to create a new order inside the DB null else

### log

    public void log(java.lang.String msg)

  Output of a message to the servlet log of the container
  Parameters:
    `msg` - the message e Nachrichten

### log

    public void log(java.lang.String message,
                    java.lang.Throwable throwable)

  Output of a message and an exception to the servlet log of the container
  Parameters:
    `msg` - the message e Nachrichten
    `throwable` - the exception

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