BEA Systems, Inc.

examples.businesspolicy
Class AprilFoolsDiscountPolicy

java.lang.Object
  |
  +--examples.businesspolicy.AprilFoolsDiscountPolicy

public class AprilFoolsDiscountPolicy
extends java.lang.Object
implements ItemPriceCalculationPolicy, java.io.Serializable

This class is a custom item pricing calculation policy. When applied to an item's price, the price is discounted by APRIL_DISCOUNT_RATE but the limit for this pricing is QUANTITY_LIMIT. If the request for price is under QUANTITY_LIMIT no discount will be applied. This policy takes into account the quantity of items being priced.

See Also:
Item, ItemPriceCalculationPolicy, BusinessPolicy, AprilFoolsDiscountPolicy, Quantity, Price, Serialized Form

Field Summary
static double APRIL_DISCOUNT_RATE
           
static int QUANTITY_LIMIT
           
 
Constructor Summary
AprilFoolsDiscountPolicy()
           
 
Method Summary
 Price calculatePrice(Item item, Quantity qty, Customer customer)
          1.- The price is obtained from the item (It could be obtained from an alternate DB) 2.- If the quantity is smaller than QUANTITY_LIMIT return price 2.- The price is discounted by APRIL DISCOUNT RATE 3.- The price is returned
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUANTITY_LIMIT

public static final int QUANTITY_LIMIT

APRIL_DISCOUNT_RATE

public static final double APRIL_DISCOUNT_RATE
Constructor Detail

AprilFoolsDiscountPolicy

public AprilFoolsDiscountPolicy()
Method Detail

calculatePrice

public Price calculatePrice(Item item,
                            Quantity qty,
                            Customer customer)
                     throws java.rmi.RemoteException
1.- The price is obtained from the item (It could be obtained from an alternate DB) 2.- If the quantity is smaller than QUANTITY_LIMIT return price 2.- The price is discounted by APRIL DISCOUNT RATE 3.- The price is returned
Specified by:
calculatePrice in interface ItemPriceCalculationPolicy
Parameters:
item - The item being priced
qty - The quantity being priced
Throws:
java.rmi.RemoteException -  

BEA Systems, Inc.

Copyright © 2000 BEA Systems, Inc. All Rights Reserved