📄 shoppingcart.java
字号:
/*
* @author : Neelesh
* @Version : 1.0
*
* Development Environment : Oracle9i JDeveloper
* Name of the File : ShoppingCart.java
* Creation/Modification History :
*
* Neelesh 04-Oct-2002 Created
*
*/
package oracle.otnsamples.vsm.services;
//EJB
import java.rmi.RemoteException;
import java.util.Locale;
import javax.ejb.EJBObject;
import oracle.otnsamples.vsm.services.data.Address;
import oracle.otnsamples.vsm.services.data.CartItem;
/**
* This is the interface for Shopping Cart Services.
* The interface provides method signatures for Cart Services like adding items to cart,
* updating cart, changing shipping address and checkout
*/
public interface ShoppingCart extends EJBObject {
/**
* The business methods updates the cart with new items/quantities
* @param <b>itemIDs</b> - ids of the items to be added/updated
* @param <b>newQties</b> quantities to be added/updated
* @throws <b>CartException</b> if the item cannot be updated
*/
public void updateCart( String[] itemIDs, int[] newQties ) throws RemoteException, CartException;
/**
* The business methods changes the shipping address
* @param <b>address</b> - the new shipping address
* @throws <b>CartException</b> if the shipping address cannot be changed
*/
public void changeShippingAddress( Address address ) throws CartException,RemoteException;
/**
* The business methods returns the current shipping address
* @return <b>Address</b> - the current shipping address
* If the user has not been identified yet, returns null.
* @throws <b>CartException</b> if the shipping address cannot be found
*/
public Address getShippingAddress() throws CartException,RemoteException;
/**
* The business methods adds an item to the cart
* @param <b>itemID</b> - id of the item to be added
* @param <b>qty</b> quantity to be added
* @throws <b>CartException</b> if the item cannot be added
*/
public void addToCart( String itemID, int qty ) throws RemoteException, CartException;
/**
* The business methods removes an item from the cart
* @param <b>itemID</b> - id of the item to be removed
* @throws <b>CartException</b> if the item cannot be removed
*/
public void removeFromCart( String itemID ) throws RemoteException, CartException;
/**
* Sets the username for the cart
* @param <b>userName</b> String username
*/
public void setUserName( String userName ) throws RemoteException;
/**
* Gets the username for the cart
* @return <b>String </b> username
*/
public String getUserName() throws RemoteException;
/**
* Gets the cart contents
* @return <b>CartItem[]</b> array of cart item objects
*/
public CartItem[] getCart() throws RemoteException;
/**
* The business methods checks out the cart
* @return <b>String</b> - the checkout status
* @throws <b>CartException</b> if checkout fails
*/
public String checkout() throws CartException,RemoteException;
/**
* Sets the locale of the user. The locale is used to determine language of
* item names and currency
* @param <b>String locale</b> user's locale
*/
void setUserLocale(Locale locale) throws RemoteException;
/**
* Returns the locale of the user.
* @return <b>String</b> user's locale
*/
Locale getUserLocale() throws RemoteException;
/**
* Get the tax amount for the purchase done
* @return <b>double</b> The tax amount
*/
public double getTaxAmount()throws RemoteException;
/**
* Get the shipping charges for the purchase
* @return <b>double</b> The shipping charges
*/
public double getShippingCharges()throws RemoteException;
/**
* Get the total amount of purchase, before tax and shipping charges
* @return <b>double</b> The total amount
*/
public double getTotalAmountBeforeTax()throws RemoteException;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -