Overview | Package | Class | Use | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## JavaBeans
Class Customer_Interface

    java.lang.Object
      JavaBeans.Customer_Interface

public class Customer_Interface
extends java.lang.Object

Author:
  student This class is being used as an engine that processes all incoming requests from the java server pages.

Field Summary
`private Address_Data` | `address`
`private CreditCard_Data` | `card`
`private Coffee_Data` | `coffee`
`private CoffeeManager` | `coffeemanager`
`private Customer_Data` | `customer`
`private CustomerManager` | `customermanager`
`(package private) java.lang.String` | `message` Class variables
`private CoffeePreference_Data` | `preference`
`private ServletConnection` | `servletconn`
`(package private) boolean` | `successful`
`private Coffee_Data[]` | `totalcoffees`
`private XmlGenerator` | `xmlgenerator`
`private XmlUnmarshal` | `xmlunmarshal`

Constructor Summary
`Customer_Interface()`

Method Summary
`void` | `addCustomer()` This method is being used for validating and adding new customer to TMS as well as the application database.
`void` | `clearMessage()` This method is being used for clearing up all the concatenated messages.
`private void` | `debugDataClasses()` This method is being used for debugging purposes.
`void` | `doLogin()` This method is being used for authentication of a customer using the LDAP server and retrieving all the customer information if the authentication is successful.
`Address_Data` | `getAddress()` This method is being used for getting the address data.
`Coffee_Data` | `getCoffee()` This method is being used for getting the coffee data.
`private Coffee_Data` | `getCoffeeByDescription(java.lang.String desc)` This utility method is being used for getting the Coffee_Data given a coffee description.
`private Coffee_Data` | `getCoffeeByItemCode(java.lang.String itemCode)` This utility method is being used for getting the Coffee_Data given an itemcode.
`CreditCard_Data` | `getCreditCard()` Method: getCreditCard This method is being used for getting the credit card data.
`Customer_Data` | `getCustomer()` This method is being used for getting the customer.
`java.lang.String` | `getMessage()` This method is being used for getting the message to be displayed on the java server pages.
`CoffeePreference_Data` | `getPreference()` This method is being used for getting the coffee preference data.
`boolean` | `getSuccessful()` This method is being used for getting and checking the success - if the validation was successful or not.
`void` | `orderCoffee()` This method is being used for ordering a coffee.
`void` | `processRequest(java.lang.String action, Customer_Data customer, CreditCard_Data creditCard, Address_Data address, CoffeePreference_Data coffee)` This method is being used for directing all incoming requests to appropriate methods.
`double` | `round(double x, int dec)` This utility method is being used for rounding a double to the given number of decimal places.
`void` | `setMessage(java.lang.String s)` This method is being used for setting messages that are displayed on the java server pages
`void` | `setSuccessful(boolean b)` This method is being used for setting the success boolean - defining whether the validation was successful.
`void` | `updateAccount()` This method is being used for updating only the user account, unlike updateCustomer method, this method does not update other details of the customer.
`void` | `updateCustomer()` This method is being used for update a customer's details.

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

Field Detail

### address

    private Address_Data address

### card

    private CreditCard_Data card

### coffee

    private Coffee_Data coffee

### coffeemanager

    private CoffeeManager coffeemanager

### customer

    private Customer_Data customer

### customermanager

    private CustomerManager customermanager

### message

    java.lang.String message

  Class variables

### preference

    private CoffeePreference_Data preference

### servletconn

    private ServletConnection servletconn

### successful

    boolean successful

### totalcoffees

    private Coffee_Data[] totalcoffees

### xmlgenerator

    private XmlGenerator xmlgenerator

### xmlunmarshal

    private XmlUnmarshal xmlunmarshal

Constructor Detail

### Customer_Interface

    public Customer_Interface()

Method Detail

### addCustomer

    public void addCustomer()

  This method is being used for validating and adding new customer to TMS as well as the application database.

  Returns:
    void

### clearMessage

    public void clearMessage()

  This method is being used for clearing up all the concatenated messages.

  Returns:
    void

### debugDataClasses

    private void debugDataClasses()

  This method is being used for debugging purposes. A note of caution - be careful when you call this method as this method can throw a nullpointer exception if either customer, address,

  Returns:
    void

### doLogin

    public void doLogin()

  This method is being used for authentication of a customer using the LDAP server and retrieving all the customer information if the authentication is successful.

  Returns:
    void

### getAddress

    public Address_Data getAddress()

  This method is being used for getting the address data.

  Returns:
    Address_Data Address details.

### getCoffee

    public Coffee_Data getCoffee()

  This method is being used for getting the coffee data.

  Returns:
    Coffee_Data Coffee details.

### getCoffeeByDescription

    private Coffee_Data getCoffeeByDescription(java.lang.String desc)

  This utility method is being used for getting the Coffee_Data given a coffee description.

  Parameters:
    `desc` - Coffee description.
  Returns:
    Coffee_Data Coffee details.

### getCoffeeByItemCode

    private Coffee_Data getCoffeeByItemCode(java.lang.String itemCode)

  This utility method is being used for getting the Coffee_Data given an itemcode.

  Parameters:
    `itemCode` - Coffee item code.
  Returns:
    Coffee_Data Coffee details.

### getCreditCard

    public CreditCard_Data getCreditCard()

  Method: getCreditCard This method is being used for getting the credit card data.

  Returns:
    CreditCard_Data Credit card details.

### getCustomer

    public Customer_Data getCustomer()

  This method is being used for getting the customer.

  Returns:
    Customer_Data Customer details.

### getMessage

    public java.lang.String getMessage()

  This method is being used for getting the message to be displayed on the java server pages.

  Returns:
    String The message to be displayed.

### getPreference

    public CoffeePreference_Data getPreference()

  This method is being used for getting the coffee preference data.

  Returns:
    CoffeePreference_Data Coffee preference details.

### getSuccessful

    public boolean getSuccessful()

  This method is being used for getting and checking the success - if the validation was successful or not.

  Returns:
    boolean Defines whether the validation was successful.

### orderCoffee

    public void orderCoffee()

  This method is being used for ordering a coffee. This involves validation of the requested coffee, sending messages to TMS in order to carry out the transaction.

  Returns:
    void

### processRequest

    public void processRequest(java.lang.String action,
                               Customer_Data customer,
                               CreditCard_Data creditCard,
                               Address_Data address,
                               CoffeePreference_Data coffee)

  This method is being used for directing all incoming requests to appropriate methods.

  Parameters:
    `action` - The action to be taken - identifies which method can be used to process the request.
    `customer` - Customer details sent from the jsp.
    `creditCard` - Credit card details sent from the jsp.
    `address` - Address details sent from the jsp.
    `coffee` - Coffee details sent from the jsp.
  Returns:
    void

### round

    public double round(double x,
                        int dec)

  This utility method is being used for rounding a double to the given number of decimal places.

  Parameters:
    `x` - The original double that is to be rounded.
    `dec` - The number of decimal places the double has to be rounded to.
  Returns:
    double The resulting rounded double.

### setMessage

    public void setMessage(java.lang.String s)

  This method is being used for setting messages that are displayed on the java server pages

  Parameters:
    `s` - The message to be displayed.
  Returns:
    void

### setSuccessful

    public void setSuccessful(boolean b)

  This method is being used for setting the success boolean - defining whether the validation was successful.

  Parameters:
    `b` - Defines whether validation was successful.
  Returns:
    void

### updateAccount

    public void updateAccount()

  This method is being used for updating only the user account, unlike updateCustomer method, this method does not update other details of the customer.

  Returns:
    void

### updateCustomer

    public void updateCustomer()

  This method is being used for update a customer's details. This involves validation of the new details, updating the details by sending updateXml to TMS, and update the application database.

  Returns:
    void

Overview | Package | Class | Use | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD