edu.uci.ics.inf111.dvdvendor.gui
Class Actions

java.lang.Object
  extended by edu.uci.ics.inf111.dvdvendor.gui.Actions

public class Actions
extends java.lang.Object

This class contains the actions that can be called from the Graphical User Interface of the DVD Vendor System. It also includes an internal action to print the contents of the shopping cart


Constructor Summary
Actions()
           
 
Method Summary
protected  Product addDVD(DVDVendor dvdVendor, java.lang.String barCodeNumber)
          Method that creates a new BarCode object with the barCodeNumber given as parameter, then it adds the BarCode to the DVDVendor object.
protected  java.lang.String calculateCharges(DVDVendor dvdVendor, java.lang.String barCode)
          Method that calculates the charges for the returned product
protected  java.lang.String dispenseItems(DVDVendor dvdVendor)
          Method that dispense the items in the transaction using the dvdDispenser object from the dvdVendor object
protected  DVDVendor initiateRent()
          Method that initiates the Rent Transaction
protected  DVDVendor initiateReturn()
          Method that initiates the Return Transaction
protected  void payItems(DVDVendor dvdVendor, java.lang.String cardNumber)
          Method that collects the payment for all the products in the cart
protected  java.lang.String printShoppingCart(java.util.Enumeration<Product> listItemsInCart)
          Method that prints the contents of the shopping cart This method is called internally for the GUI class and does not correspond to any external GUI action
protected  void receiveItem(DVDVendor dvdVendor, java.lang.String barCode)
          Method that receives the returned item using the dvdDispenser object from the dvdVendor object
protected  DVDVendor start()
          Method that creates a new DVD Vendor object that includes dvdDispenser, paymentCollector, productDB, and transactionDB objects
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Actions

public Actions()
Method Detail

start

protected DVDVendor start()
                   throws java.lang.Exception
Method that creates a new DVD Vendor object that includes dvdDispenser, paymentCollector, productDB, and transactionDB objects

Returns:
new dvdVendor object
Throws:
java.lang.Exception

initiateRent

protected DVDVendor initiateRent()
                          throws java.lang.Exception
Method that initiates the Rent Transaction

Throws:
java.lang.Exception

initiateReturn

protected DVDVendor initiateReturn()
                            throws java.lang.Exception
Method that initiates the Return Transaction

Throws:
java.lang.Exception

addDVD

protected Product addDVD(DVDVendor dvdVendor,
                         java.lang.String barCodeNumber)
                  throws java.lang.Exception
Method that creates a new BarCode object with the barCodeNumber given as parameter, then it adds the BarCode to the DVDVendor object. It returns the product that was added to the shopping cart

Parameters:
dvdVendor - DVDVendor object where the product will be added
barCodeNumber - String that contains the bar code
Returns:
product that was added to the shopping cart
Throws:
java.lang.Exception

dispenseItems

protected java.lang.String dispenseItems(DVDVendor dvdVendor)
                                  throws java.lang.Exception
Method that dispense the items in the transaction using the dvdDispenser object from the dvdVendor object

Parameters:
dvdVendor - DVDVendor object for the transaction
Throws:
java.lang.Exception

receiveItem

protected void receiveItem(DVDVendor dvdVendor,
                           java.lang.String barCode)
                    throws java.lang.Exception
Method that receives the returned item using the dvdDispenser object from the dvdVendor object

Parameters:
dvdVendor - DVDVendor object for the transaction
barCode - String with the bar code of the returned item
Throws:
java.lang.Exception

payItems

protected void payItems(DVDVendor dvdVendor,
                        java.lang.String cardNumber)
                 throws java.lang.Exception
Method that collects the payment for all the products in the cart

Parameters:
dvdVendor - DVDVendor object for the transaction
cardNumber - String with the credit/debit card Number that will be used to charge the cost of the transaction
Throws:
java.lang.Exception

calculateCharges

protected java.lang.String calculateCharges(DVDVendor dvdVendor,
                                            java.lang.String barCode)
                                     throws java.lang.Exception
Method that calculates the charges for the returned product

Parameters:
dvdVendor - DVDVendor object for the transaction
barCode - String with the bar code of the returned item
Throws:
java.lang.Exception

printShoppingCart

protected java.lang.String printShoppingCart(java.util.Enumeration<Product> listItemsInCart)
                                      throws java.lang.Exception
Method that prints the contents of the shopping cart This method is called internally for the GUI class and does not correspond to any external GUI action

Parameters:
listItemsInCart - Enumeration of Products that are in the shopping cart
Throws:
java.lang.Exception