com.ibm.commerce.couponredemption.commands
Class CouponUtilities

java.lang.Object
  |
  +--com.ibm.commerce.couponredemption.commands.CouponUtilities

public class CouponUtilities
extends java.lang.Object

A utility class with common functions called repeatedly from different classes. It uses the following access beans: CatalogEntryRelationAccessBean StoreAccessBean OrderItemAccessBean CatalogGroupRelationAccessBean CatalogGroupCatalogEntryRelationAccessBean


Field Summary
static java.lang.String COPYRIGHT
          IBM copyright notice field.
 
Constructor Summary
CouponUtilities()
           
 
Method Summary
static int belongsToItemOrProduct(java.lang.Long catalogProductId, java.lang.Long catalogEntryId)
          This method checkes whether the given catalog entry is the same as or belongs to the given product or catalog entry.
static java.math.BigDecimal calculateTotalOrderAmt(java.util.Vector vecoiAB, StoreAccessBean sAB, CurrencyManager cm, java.lang.String curCurrency)
          This method calculates the total order amount.
static int catEntBelongsToCatGrp(java.lang.Long catalogEntryId, java.lang.Long catalogGroupId, java.lang.Long catalogId)
          This method checkes whether the given catalog entry belongs to the given catalog group in a given catalog.
static int groupBelongsTo(java.lang.String catalogId, java.lang.String parentGroupId, java.lang.String childGroupId)
          This method checkes whether a given catalog group belongs to another given catalog group in a given catalog.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail
public static final java.lang.String COPYRIGHT
IBM copyright notice field.
See Also:
Constant Field Values
Constructor Detail

CouponUtilities

public CouponUtilities()
Method Detail

belongsToItemOrProduct

public static int belongsToItemOrProduct(java.lang.Long catalogProductId,
                                         java.lang.Long catalogEntryId)
This method checkes whether the given catalog entry is the same as or belongs to the given product or catalog entry.
Parameters:
catalogProductId - the target parent product or catalog entry
catalogEntryId - the target child catalog entry
Returns:
1 if the relationship exists, -1 otherwise.

calculateTotalOrderAmt

public static java.math.BigDecimal calculateTotalOrderAmt(java.util.Vector vecoiAB,
StoreAccessBean sAB,
CurrencyManager cm,
                                                          java.lang.String curCurrency)
                                                   throws ECSystemException
This method calculates the total order amount.
Parameters:
vecoiAB - the orderitems
sAB - access bean for the store
cm - the currency manager to be used
curCurrency - the currency to compute the total order amount in
Returns:
the total order amount
Throws:
ECSystemException

catEntBelongsToCatGrp

public static int catEntBelongsToCatGrp(java.lang.Long catalogEntryId,
                                        java.lang.Long catalogGroupId,
                                        java.lang.Long catalogId)
This method checkes whether the given catalog entry belongs to the given catalog group in a given catalog.
Parameters:
catalogEntryId - the target child catalog entry
catalogGroupId - the target parent catalog group
catalogId - the catalog ID
Returns:
the depth (1 + the number of intermediate category nodes) in the catalog tree if the relationship exists, -1 otherwise.

groupBelongsTo

public static int groupBelongsTo(java.lang.String catalogId,
                                 java.lang.String parentGroupId,
                                 java.lang.String childGroupId)
This method checkes whether a given catalog group belongs to another given catalog group in a given catalog.
Parameters:
catalogId - the catalog ID
parentGroupId - the target parent catalog group
childGroupId - the target child catalog group
Returns:
the depth (1 + the number of intermediate category nodes) in the catalog tree if the relationship exists, -1 otherwise.