com.konakartadmin.bl
Class AdminPromotionMgr

java.lang.Object
  extended by com.konakartadmin.bl.AdminBaseMgr
      extended by com.konakartadmin.bl.AdminPromotionMgr
All Implemented Interfaces:
AdminPromotionMgrIf

public class AdminPromotionMgr
extends AdminBaseMgr
implements AdminPromotionMgrIf

The AdminPromotionMgr - for Managing Promotions for the Admin Application


Nested Class Summary
 
Nested classes/interfaces inherited from class com.konakartadmin.bl.AdminBaseMgr
AdminBaseMgr.StaticData
 
Field Summary
static int ALL
          Constant for Promotion Rule
static int EXCLUDE
          Constant for Promotion Rule
protected static int GIFT_CERTIFICATE_RELATION_TYPE
          Constant for Promotion To Product Relation
static int INCLUDE
          Constant for Promotion Rule
protected static org.apache.commons.logging.Log log
          the log
protected static java.lang.String mutex
           
protected static int PROMOTION_RELATION_TYPE
          Constant for Promotion To Product Relation
 
Fields inherited from class com.konakartadmin.bl.AdminBaseMgr
adminEng, baseMgrMutex, baseStaticDataHM, cDataEnd, cDataStart, kkConf, kkInstanceId, mgrFactory, STORE_ID, templateBaseDir
 
Constructor Summary
AdminPromotionMgr(KKAdminIf eng)
          Constructor
 
Method Summary
 void addCategoriesToPromotion(AdminCategory[] categories, int promotionId, int rule)
          Add the array of categories to the promotion
protected  void addCouponOrderBy(org.apache.torque.util.Criteria c, AdminCouponSearch search)
          Add order by constraints to query
protected  int addCouponSearchCriteria(org.apache.torque.util.Criteria c, AdminCouponSearch couponSearch)
          Add search criteria to query
 void addCouponsToPromotion(AdminCoupon[] coupons, int promotionId)
          Add the array of coupons to the promotion.
 void addCustomerGroupsToPromotion(int[] groupIds, int promotionId, int rule)
          Add customers to the promotion belonging to the groups in the array of group ids.
 void addCustomersToPromotion(AdminCustomer[] customers, int promotionId, int rule, int maxUse)
          Add the array of customers to the promotion
 void addCustomersToPromotion(java.util.Calendar lastOrderDate, boolean havePlacedOrder, int promotionId, int rule, int maxUse)
          Add to the promotion identified by promotionId, the customers who have or haven't placed an order since the lastOrderDate passed in as a parameter.
 void addExpressionsToPromotion(AdminExpression[] expressions, int promotionId)
          Add the array of expressions to the promotion
 void addGiftCertificatesToPromotion(AdminProduct[] giftCertificates, int promotionId)
          Associates the gift certificate products with the promotion.
 void addManufacturersToPromotion(AdminManufacturer[] manufacturers, int promotionId, int rule)
          Add the array of manufacturers to the promotion
 void addProductsToPromotion(AdminProduct[] products, int promotionId, int rule)
          Add the array of products to the promotion.
protected  void addProductsToPromotion(AdminProduct[] products, int promotionId, int rule, boolean giftCertificate)
          Add the array of products to the promotion.
protected  void addPromotionOrderBy(org.apache.torque.util.Criteria c, AdminPromotionSearch search)
          Add order by constraints to query
protected  int addPromotionSearchCriteria(org.apache.torque.util.Criteria c, AdminPromotionSearch promSearch)
          Add search criteria to query
 void addPromotionsToCoupon(AdminPromotion[] promotions, int couponId)
          Add the array of promotions to the coupon.
 void deleteCoupon(int couponId)
          The coupon is deleted along with any entries in the promotion to coupon table.
protected  void deleteCouponsPerPromotion(int promotionId)
          If a coupon belongs to only this promotion it is deleted, otherwise just the entry in the promotion to products table is deleted
 void deletePromotion(int promotionId)
          Delete the promotion referenced to by promotionId.
 void editCoupon(AdminCoupon coupon)
          Edits the coupon
 void editPromotion(AdminPromotion promotion)
          Edits the promotion
protected  int getCount(org.apache.torque.util.Criteria c)
          This method is mainly used for paging.
 AdminCouponSearchResult getCoupons(AdminCouponSearch search, int offset, int size)
          This returns an AdminCouponSearchResult object.
 int getCouponsCount(AdminCouponSearch search)
          Returns a count of the number of Coupons
 AdminCoupon[] getCouponsPerPromotion(int promotionId)
          Get an array of Admin coupon objects for a promotion
 int getCustomersCountWhoHaventPlacedAnOrderSince(java.util.Calendar lastOrderDate)
          Return the count of the number of customers who haven't placed an order since the lastOrderDate passed in as a parameter.
 int getCustomersCountWhoHavePlacedAnOrderSince(java.util.Calendar lastOrderDate)
          Return the count of the number of customers who have placed an order since the lastOrderDate passed in as a parameter.
 AdminProducts getGiftCertificatesPerPromotion(AdminProductSearch search, int offset, int size)
          Get an array of Admin product gift certificate objects for a promotion.
protected  AdminOption[] getProductOptionsPerProductAndPromotion(int promotionId, int productId, boolean giftCertificate)
          We return an array of AminOption objects for every product option and value in the promotion.
 AdminProducts getProductsPerPromotion(AdminProductSearch search, int offset, int size)
          Get an array of Admin product objects for a promotion.
protected  AdminProducts getProductsPerPromotion(AdminProductSearch search, int offset, int size, boolean giftCertificate)
          Get an array of Admin product objects for a promotion.
 AdminPromotion getPromotion(int id, boolean includeCoupons, boolean includeStats)
          Get a promotion object and an array of associated coupon objects
 int getPromotionIdForGiftCertificate(AdminOrderProduct op)
          Get the promotion id for an order product object containing a gift certificate.
protected  int getPromotionIdForGiftCertificate(int productId, int productOptionId, int productOptionValueId)
          Protected method for common code to get the promotion id of a promotion connected to a gift certificate.
 AdminPromotionSearchResult getPromotions(AdminPromotionSearch search, int offset, int size)
          This returns an AdminPromotionSearchResult object.
 int getPromotionsCount(AdminPromotionSearch search)
          Returns a count of the number of Promotions
 AdminPromotion[] getPromotionsPerCoupon(int couponId)
          Get an array of Admin promotion objects for a coupon
 int insertCoupon(AdminCoupon coupon)
          Inserts a coupon
 int insertCoupon(AdminCoupon coupon, int promotionId)
          Inserts a coupon and also a record in the promotion_to_coupon table to associate the coupon to a promotion
protected  int insertCoupon(AdminCoupon coupon, int promotionId, java.sql.Connection connection)
          Inserts a coupon and also a record in the promotion_to_coupon table to associate the coupon to a promotion
 int insertPromotion(AdminPromotion prom)
          Insert the promotion passed in as a parameter.
 void refreshConfigs()
          Refresh the configuration of the Admin Currency Manager
 void removeCategoriesFromPromotion(AdminCategory[] categories, int promotionId)
          Remove an array of categories from the promotion
 void removeCouponsFromPromotion(AdminCoupon[] coupons, int promotionId)
          Remove an array of coupons from the promotion
 void removeCustomerGroupsFromPromotion(int[] groupIds, int promotionId)
          Remove an array of groupIds from the promotion
 void removeCustomersFromPromotion(AdminCustomer[] customers, int promotionId)
          Remove an array of customers from the promotion
 void removeExpressionsFromPromotion(AdminExpression[] expressions, int promotionId)
          Remove an array of expressions from the promotion
 void removeGiftCertificatesFromPromotion(AdminProduct[] giftCertificates, int promotionId)
          Remove an array of gift certificates from the promotion.
 void removeManufacturersFromPromotion(AdminManufacturer[] manufacturers, int promotionId)
          Remove an array of manufacturers from the promotion
 void removeProductsFromPromotion(AdminProduct[] products, int promotionId)
          Remove an array of products from the promotion.
protected  void removeProductsFromPromotion(AdminProduct[] products, int promotionId, boolean giftCertificate)
          Remove an array of products from the promotion
 void removePromotionsFromCoupon(AdminPromotion[] promotions, int couponId)
          Remove an array of promotions from the coupon
protected  org.apache.torque.util.Criteria setAllCouponAttrs(org.apache.torque.util.Criteria c)
           
protected  org.apache.torque.util.Criteria setAllPromotionAttrs(org.apache.torque.util.Criteria c)
           
protected  void validateCoupon(AdminCoupon coupon)
          Used to validate a coupon before editing or inserting
protected  void validatePromotion(AdminPromotion prom)
          Used to validate a promotion before editing or inserting
 
Methods inherited from class com.konakartadmin.bl.AdminBaseMgr
addInsertAttr, addInsertAttr, checkIntIsSet, checkRequired, getAdminAddressMgr, getAdminAuditMgr, getAdminBillingMgr, getAdminBookableProductMgr, getAdminCatMgr, getAdminConfigMgr, getAdminCurrMgr, getAdminCustMgr, getAdminCustTagMgr, getAdminEmailMgr, getAdminEng, getAdminHtmlMgr, getAdminLanguageMgr, getAdminManuMgr, getAdminMessageMgr, getAdminMiscItemMgr, getAdminModulesMgr, getAdminMultiStoreMgr, getAdminOrderMgr, getAdminPdfMgr, getAdminProdAttrMgr, getAdminProdMgr, getAdminPromMgr, getAdminPublishProdMgr, getAdminReviewMgr, getAdminSearchRuleMgr, getAdminSecMgr, getAdminSolrMgr, getAdminStoreMgr, getAdminTagMgr, getAdminTaxMgr, getAdminValidationMgr, getAdminVelocityContextMgr, getAdminWishListMgr, getBooleanFromString, getExportXMLData, getIntFromString, getKkConfig, getKkInstanceId, getMode, getModeString, getMqMgr, getNewCriteria, getNewCriteria, getPostSearchText, getPreSearchText, getPropertyValue, getRecordCount, getRewardPointMgr, getSingleIntResult, getStoreId, getTemplate, getTemplateBase, getXml_io, init, isConfigSet, isEnterprise, isMultiStoreLanguagesShared, isMultiStoreMode, isMultiStoreShareCategories, isMultiStoreShareCustomers, isMultiStoreShareProducts, isMultiStoreSingleDBCSMode, isMultiStoreSingleDBMode, isMultiStoreSingleDBNonCSMode, manageException, removeCData, setAdminEng, setupWildCardRules, setWildCardAfter, setWildCardBefore, shutdownGracefully, shutdownGracefully, timestampStr
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log
the log


ALL

public static final int ALL
Constant for Promotion Rule

See Also:
Constant Field Values

EXCLUDE

public static final int EXCLUDE
Constant for Promotion Rule

See Also:
Constant Field Values

INCLUDE

public static final int INCLUDE
Constant for Promotion Rule

See Also:
Constant Field Values

PROMOTION_RELATION_TYPE

protected static final int PROMOTION_RELATION_TYPE
Constant for Promotion To Product Relation

See Also:
Constant Field Values

GIFT_CERTIFICATE_RELATION_TYPE

protected static final int GIFT_CERTIFICATE_RELATION_TYPE
Constant for Promotion To Product Relation

See Also:
Constant Field Values

mutex

protected static java.lang.String mutex
Constructor Detail

AdminPromotionMgr

public AdminPromotionMgr(KKAdminIf eng)
                  throws java.lang.Exception
Constructor

Parameters:
eng -
Throws:
java.lang.Exception
Method Detail

getCustomersCountWhoHaventPlacedAnOrderSince

public int getCustomersCountWhoHaventPlacedAnOrderSince(java.util.Calendar lastOrderDate)
                                                 throws KKAdminException,
                                                        org.apache.torque.TorqueException,
                                                        com.workingdogs.village.DataSetException
Return the count of the number of customers who haven't placed an order since the lastOrderDate passed in as a parameter.

Specified by:
getCustomersCountWhoHaventPlacedAnOrderSince in interface AdminPromotionMgrIf
Parameters:
lastOrderDate -
Returns:
The customer count
Throws:
KKAdminException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

getCustomersCountWhoHavePlacedAnOrderSince

public int getCustomersCountWhoHavePlacedAnOrderSince(java.util.Calendar lastOrderDate)
                                               throws KKAdminException,
                                                      org.apache.torque.TorqueException,
                                                      com.workingdogs.village.DataSetException
Return the count of the number of customers who have placed an order since the lastOrderDate passed in as a parameter.

Specified by:
getCustomersCountWhoHavePlacedAnOrderSince in interface AdminPromotionMgrIf
Parameters:
lastOrderDate -
Returns:
The customer count
Throws:
KKAdminException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

addCustomersToPromotion

public void addCustomersToPromotion(java.util.Calendar lastOrderDate,
                                    boolean havePlacedOrder,
                                    int promotionId,
                                    int rule,
                                    int maxUse)
                             throws KKAdminException,
                                    org.apache.torque.TorqueException,
                                    com.workingdogs.village.DataSetException
Add to the promotion identified by promotionId, the customers who have or haven't placed an order since the lastOrderDate passed in as a parameter.

Specified by:
addCustomersToPromotion in interface AdminPromotionMgrIf
Parameters:
lastOrderDate -
havePlacedOrder - If true we add customers who have placed an order
promotionId -
rule -
maxUse -
Throws:
KKAdminException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

insertPromotion

public int insertPromotion(AdminPromotion prom)
                    throws java.lang.Exception
Description copied from interface: AdminPromotionMgrIf
Insert the promotion passed in as a parameter.

Specified by:
insertPromotion in interface AdminPromotionMgrIf
Parameters:
prom -
Returns:
Returns the id of the inserted promotion
Throws:
java.lang.Exception

insertCoupon

public int insertCoupon(AdminCoupon coupon)
                 throws java.lang.Exception
Inserts a coupon

Specified by:
insertCoupon in interface AdminPromotionMgrIf
Parameters:
coupon -
Returns:
Returns the id of the inserted coupon
Throws:
java.lang.Exception

insertCoupon

public int insertCoupon(AdminCoupon coupon,
                        int promotionId)
                 throws java.lang.Exception
Inserts a coupon and also a record in the promotion_to_coupon table to associate the coupon to a promotion

Specified by:
insertCoupon in interface AdminPromotionMgrIf
Parameters:
coupon -
promotionId -
Returns:
Returns the id of the inserted coupon
Throws:
java.lang.Exception

insertCoupon

protected int insertCoupon(AdminCoupon coupon,
                           int promotionId,
                           java.sql.Connection connection)
                    throws java.lang.Exception
Inserts a coupon and also a record in the promotion_to_coupon table to associate the coupon to a promotion

Parameters:
coupon -
promotionId -
connection - Is set to null if the insert isn't part of a bigger transaction
Returns:
Returns the id of the inserted coupon
Throws:
java.lang.Exception

deletePromotion

public void deletePromotion(int promotionId)
                     throws java.lang.Exception
Delete the promotion referenced to by promotionId.

Specified by:
deletePromotion in interface AdminPromotionMgrIf
Parameters:
promotionId -
Throws:
java.lang.Exception

deleteCouponsPerPromotion

protected void deleteCouponsPerPromotion(int promotionId)
                                  throws org.apache.torque.TorqueException,
                                         com.workingdogs.village.DataSetException
If a coupon belongs to only this promotion it is deleted, otherwise just the entry in the promotion to products table is deleted

Parameters:
promotionId -
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

deleteCoupon

public void deleteCoupon(int couponId)
                  throws org.apache.torque.TorqueException
The coupon is deleted along with any entries in the promotion to coupon table.

Specified by:
deleteCoupon in interface AdminPromotionMgrIf
Parameters:
couponId -
Throws:
org.apache.torque.TorqueException

editPromotion

public void editPromotion(AdminPromotion promotion)
                   throws java.lang.Exception
Edits the promotion

Specified by:
editPromotion in interface AdminPromotionMgrIf
Parameters:
promotion -
Throws:
java.lang.Exception

editCoupon

public void editCoupon(AdminCoupon coupon)
                throws java.lang.Exception
Edits the coupon

Specified by:
editCoupon in interface AdminPromotionMgrIf
Parameters:
coupon -
Throws:
java.lang.Exception

getPromotion

public AdminPromotion getPromotion(int id,
                                   boolean includeCoupons,
                                   boolean includeStats)
                            throws org.apache.torque.TorqueException,
                                   com.workingdogs.village.DataSetException
Get a promotion object and an array of associated coupon objects

Specified by:
getPromotion in interface AdminPromotionMgrIf
Parameters:
id -
includeCoupons - If true we add a coupon array to the promotion if any coupons exist
includeStats - If true we calculate how many manufacturers, products, categories, customers, expressions and coupons are included or excluded from the promotion
Returns:
Returns an AdminPromotion object with an array of coupons if applicable
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

getCouponsPerPromotion

public AdminCoupon[] getCouponsPerPromotion(int promotionId)
                                     throws org.apache.torque.TorqueException,
                                            com.workingdogs.village.DataSetException
Get an array of Admin coupon objects for a promotion

Specified by:
getCouponsPerPromotion in interface AdminPromotionMgrIf
Parameters:
promotionId -
Returns:
Returns an array of AdminCoupon objects
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

getProductsPerPromotion

public AdminProducts getProductsPerPromotion(AdminProductSearch search,
                                             int offset,
                                             int size)
                                      throws java.lang.Exception
Get an array of Admin product objects for a promotion. The AdminProductSearch object must have the promotionId set to a valid promotion.

Specified by:
getProductsPerPromotion in interface AdminPromotionMgrIf
Parameters:
search -
offset -
size -
Returns:
Returns an AdminProducts objects
Throws:
java.lang.Exception

getGiftCertificatesPerPromotion

public AdminProducts getGiftCertificatesPerPromotion(AdminProductSearch search,
                                                     int offset,
                                                     int size)
                                              throws java.lang.Exception
Get an array of Admin product gift certificate objects for a promotion. The AdminProductSearch object must have the promotionId set to a valid promotion.

Specified by:
getGiftCertificatesPerPromotion in interface AdminPromotionMgrIf
Parameters:
search -
offset -
size -
Returns:
Returns an AdminProducts objects
Throws:
java.lang.Exception

getProductsPerPromotion

protected AdminProducts getProductsPerPromotion(AdminProductSearch search,
                                                int offset,
                                                int size,
                                                boolean giftCertificate)
                                         throws java.lang.Exception
Get an array of Admin product objects for a promotion. The AdminProductSearch object must have the promotionId set to a valid promotion.

Parameters:
search -
offset -
size -
giftCertificate -
Returns:
Returns an AdminProducts objects
Throws:
java.lang.Exception

getProductOptionsPerProductAndPromotion

protected AdminOption[] getProductOptionsPerProductAndPromotion(int promotionId,
                                                                int productId,
                                                                boolean giftCertificate)
                                                         throws java.lang.Exception
We return an array of AminOption objects for every product option and value in the promotion.

Parameters:
promotionId -
productId -
giftCertificate -
Returns:
An array of AdminOption objects
Throws:
java.lang.Exception

getPromotionsPerCoupon

public AdminPromotion[] getPromotionsPerCoupon(int couponId)
                                        throws org.apache.torque.TorqueException,
                                               com.workingdogs.village.DataSetException
Get an array of Admin promotion objects for a coupon

Specified by:
getPromotionsPerCoupon in interface AdminPromotionMgrIf
Parameters:
couponId -
Returns:
Returns an array of AdminPromotion objects
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

getPromotions

public AdminPromotionSearchResult getPromotions(AdminPromotionSearch search,
                                                int offset,
                                                int size)
                                         throws org.apache.torque.TorqueException,
                                                com.workingdogs.village.DataSetException
This returns an AdminPromotionSearchResult object.

Specified by:
getPromotions in interface AdminPromotionMgrIf
Parameters:
search -
offset -
size -
Returns:
Returns an AdminPromotionSearchResult object
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

getCoupons

public AdminCouponSearchResult getCoupons(AdminCouponSearch search,
                                          int offset,
                                          int size)
                                   throws org.apache.torque.TorqueException,
                                          com.workingdogs.village.DataSetException
This returns an AdminCouponSearchResult object.

Specified by:
getCoupons in interface AdminPromotionMgrIf
Parameters:
search -
offset -
size -
Returns:
Returns an AdminCouponSearchResult object
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

addCustomersToPromotion

public void addCustomersToPromotion(AdminCustomer[] customers,
                                    int promotionId,
                                    int rule,
                                    int maxUse)
                             throws org.apache.torque.TorqueException
Add the array of customers to the promotion

Specified by:
addCustomersToPromotion in interface AdminPromotionMgrIf
Parameters:
customers -
promotionId -
rule -
maxUse - -1 for unlimited use
Throws:
org.apache.torque.TorqueException

addCustomerGroupsToPromotion

public void addCustomerGroupsToPromotion(int[] groupIds,
                                         int promotionId,
                                         int rule)
                                  throws java.lang.Exception
Add customers to the promotion belonging to the groups in the array of group ids.

Specified by:
addCustomerGroupsToPromotion in interface AdminPromotionMgrIf
Parameters:
groupIds -
promotionId -
rule -
Throws:
java.lang.Exception

addManufacturersToPromotion

public void addManufacturersToPromotion(AdminManufacturer[] manufacturers,
                                        int promotionId,
                                        int rule)
                                 throws org.apache.torque.TorqueException
Add the array of manufacturers to the promotion

Specified by:
addManufacturersToPromotion in interface AdminPromotionMgrIf
Parameters:
manufacturers -
promotionId -
rule -
Throws:
org.apache.torque.TorqueException

addExpressionsToPromotion

public void addExpressionsToPromotion(AdminExpression[] expressions,
                                      int promotionId)
                               throws org.apache.torque.TorqueException
Add the array of expressions to the promotion

Specified by:
addExpressionsToPromotion in interface AdminPromotionMgrIf
Parameters:
expressions -
promotionId -
Throws:
org.apache.torque.TorqueException

addCategoriesToPromotion

public void addCategoriesToPromotion(AdminCategory[] categories,
                                     int promotionId,
                                     int rule)
                              throws org.apache.torque.TorqueException
Add the array of categories to the promotion

Specified by:
addCategoriesToPromotion in interface AdminPromotionMgrIf
Parameters:
categories -
promotionId -
rule -
Throws:
org.apache.torque.TorqueException

addProductsToPromotion

public void addProductsToPromotion(AdminProduct[] products,
                                   int promotionId,
                                   int rule)
                            throws org.apache.torque.TorqueException
Add the array of products to the promotion. Each product may have an array of options. When this array exists, we only add those particular options to the promotion. Otherwise we set the option and option value ids to -1.

Specified by:
addProductsToPromotion in interface AdminPromotionMgrIf
Parameters:
products -
promotionId -
rule -
Throws:
org.apache.torque.TorqueException

addGiftCertificatesToPromotion

public void addGiftCertificatesToPromotion(AdminProduct[] giftCertificates,
                                           int promotionId)
                                    throws org.apache.torque.TorqueException
Associates the gift certificate products with the promotion. The products may have an array of options. When this array exists, we only add those particular options to the promotion. Otherwise we set the option and option value ids to -1.

Specified by:
addGiftCertificatesToPromotion in interface AdminPromotionMgrIf
Parameters:
giftCertificates -
promotionId -
Throws:
org.apache.torque.TorqueException

addProductsToPromotion

protected void addProductsToPromotion(AdminProduct[] products,
                                      int promotionId,
                                      int rule,
                                      boolean giftCertificate)
                               throws org.apache.torque.TorqueException
Add the array of products to the promotion. Each product may have an array of options. When this array exists, we only add those particular options to the promotion. Otherwise we set the option and option value ids to -1.

Parameters:
products -
promotionId -
rule -
giftCertificate -
Throws:
org.apache.torque.TorqueException

removeCustomersFromPromotion

public void removeCustomersFromPromotion(AdminCustomer[] customers,
                                         int promotionId)
                                  throws org.apache.torque.TorqueException
Remove an array of customers from the promotion

Specified by:
removeCustomersFromPromotion in interface AdminPromotionMgrIf
Parameters:
customers -
promotionId -
Throws:
org.apache.torque.TorqueException

removeManufacturersFromPromotion

public void removeManufacturersFromPromotion(AdminManufacturer[] manufacturers,
                                             int promotionId)
                                      throws org.apache.torque.TorqueException
Remove an array of manufacturers from the promotion

Specified by:
removeManufacturersFromPromotion in interface AdminPromotionMgrIf
Parameters:
manufacturers -
promotionId -
Throws:
org.apache.torque.TorqueException

removeExpressionsFromPromotion

public void removeExpressionsFromPromotion(AdminExpression[] expressions,
                                           int promotionId)
                                    throws org.apache.torque.TorqueException
Remove an array of expressions from the promotion

Specified by:
removeExpressionsFromPromotion in interface AdminPromotionMgrIf
Parameters:
expressions -
promotionId -
Throws:
org.apache.torque.TorqueException

removeCategoriesFromPromotion

public void removeCategoriesFromPromotion(AdminCategory[] categories,
                                          int promotionId)
                                   throws org.apache.torque.TorqueException
Remove an array of categories from the promotion

Specified by:
removeCategoriesFromPromotion in interface AdminPromotionMgrIf
Parameters:
categories -
promotionId -
Throws:
org.apache.torque.TorqueException

removeCustomerGroupsFromPromotion

public void removeCustomerGroupsFromPromotion(int[] groupIds,
                                              int promotionId)
                                       throws org.apache.torque.TorqueException
Remove an array of groupIds from the promotion

Specified by:
removeCustomerGroupsFromPromotion in interface AdminPromotionMgrIf
Parameters:
groupIds -
promotionId -
Throws:
org.apache.torque.TorqueException

removeProductsFromPromotion

public void removeProductsFromPromotion(AdminProduct[] products,
                                        int promotionId)
                                 throws org.apache.torque.TorqueException
Remove an array of products from the promotion. All promotions ar eremoved if the array is set to null.

Specified by:
removeProductsFromPromotion in interface AdminPromotionMgrIf
Parameters:
products -
promotionId -
Throws:
org.apache.torque.TorqueException

removeGiftCertificatesFromPromotion

public void removeGiftCertificatesFromPromotion(AdminProduct[] giftCertificates,
                                                int promotionId)
                                         throws org.apache.torque.TorqueException
Remove an array of gift certificates from the promotion. All gift certificates are removed if the array is set to null.

Specified by:
removeGiftCertificatesFromPromotion in interface AdminPromotionMgrIf
Parameters:
giftCertificates -
promotionId -
Throws:
org.apache.torque.TorqueException

removeProductsFromPromotion

protected void removeProductsFromPromotion(AdminProduct[] products,
                                           int promotionId,
                                           boolean giftCertificate)
                                    throws org.apache.torque.TorqueException
Remove an array of products from the promotion

Parameters:
products -
promotionId -
giftCertificate -
Throws:
org.apache.torque.TorqueException

removeCouponsFromPromotion

public void removeCouponsFromPromotion(AdminCoupon[] coupons,
                                       int promotionId)
                                throws org.apache.torque.TorqueException
Remove an array of coupons from the promotion

Specified by:
removeCouponsFromPromotion in interface AdminPromotionMgrIf
Parameters:
coupons -
promotionId -
Throws:
org.apache.torque.TorqueException

removePromotionsFromCoupon

public void removePromotionsFromCoupon(AdminPromotion[] promotions,
                                       int couponId)
                                throws org.apache.torque.TorqueException
Remove an array of promotions from the coupon

Specified by:
removePromotionsFromCoupon in interface AdminPromotionMgrIf
Parameters:
promotions -
couponId -
Throws:
org.apache.torque.TorqueException

addCouponsToPromotion

public void addCouponsToPromotion(AdminCoupon[] coupons,
                                  int promotionId)
                           throws org.apache.torque.TorqueException
Add the array of coupons to the promotion. We assume that the coupon has already been inserted.

Specified by:
addCouponsToPromotion in interface AdminPromotionMgrIf
Parameters:
coupons -
promotionId -
Throws:
org.apache.torque.TorqueException

addPromotionsToCoupon

public void addPromotionsToCoupon(AdminPromotion[] promotions,
                                  int couponId)
                           throws org.apache.torque.TorqueException
Add the array of promotions to the coupon.

Specified by:
addPromotionsToCoupon in interface AdminPromotionMgrIf
Parameters:
promotions -
couponId -
Throws:
org.apache.torque.TorqueException

getPromotionsCount

public int getPromotionsCount(AdminPromotionSearch search)
                       throws org.apache.torque.TorqueException,
                              com.workingdogs.village.DataSetException
Returns a count of the number of Promotions

Specified by:
getPromotionsCount in interface AdminPromotionMgrIf
Parameters:
search - Search criteria
Returns:
A count of the number of Promotions
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

getCouponsCount

public int getCouponsCount(AdminCouponSearch search)
                    throws org.apache.torque.TorqueException,
                           com.workingdogs.village.DataSetException
Returns a count of the number of Coupons

Specified by:
getCouponsCount in interface AdminPromotionMgrIf
Parameters:
search - Search criteria
Returns:
A count of the number of Coupons
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

getCount

protected int getCount(org.apache.torque.util.Criteria c)
                throws org.apache.torque.TorqueException,
                       com.workingdogs.village.DataSetException
This method is mainly used for paging.

Parameters:
c - the Criteria
Returns:
The number of records present in the database matching the given criteria
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

addPromotionOrderBy

protected void addPromotionOrderBy(org.apache.torque.util.Criteria c,
                                   AdminPromotionSearch search)
Add order by constraints to query

Parameters:
c -
search -

addCouponOrderBy

protected void addCouponOrderBy(org.apache.torque.util.Criteria c,
                                AdminCouponSearch search)
Add order by constraints to query

Parameters:
c -
search -

addPromotionSearchCriteria

protected int addPromotionSearchCriteria(org.apache.torque.util.Criteria c,
                                         AdminPromotionSearch promSearch)
Add search criteria to query

Parameters:
c -
promSearch -
Returns:
Returns number of constraints added

addCouponSearchCriteria

protected int addCouponSearchCriteria(org.apache.torque.util.Criteria c,
                                      AdminCouponSearch couponSearch)
Add search criteria to query

Parameters:
c -
couponSearch -
Returns:
Returns number of constraints added

validatePromotion

protected void validatePromotion(AdminPromotion prom)
                          throws KKAdminException
Used to validate a promotion before editing or inserting

Parameters:
prom -
Throws:
KKAdminException

validateCoupon

protected void validateCoupon(AdminCoupon coupon)
                       throws KKAdminException
Used to validate a coupon before editing or inserting

Parameters:
coupon -
Throws:
KKAdminException

setAllPromotionAttrs

protected org.apache.torque.util.Criteria setAllPromotionAttrs(org.apache.torque.util.Criteria c)

setAllCouponAttrs

protected org.apache.torque.util.Criteria setAllCouponAttrs(org.apache.torque.util.Criteria c)

refreshConfigs

public void refreshConfigs()
                    throws java.lang.Exception
Refresh the configuration of the Admin Currency Manager

Specified by:
refreshConfigs in interface AdminPromotionMgrIf
Overrides:
refreshConfigs in class AdminBaseMgr
Throws:
java.lang.Exception

getPromotionIdForGiftCertificate

public int getPromotionIdForGiftCertificate(AdminOrderProduct op)
                                     throws KKAdminException,
                                            org.apache.torque.TorqueException,
                                            com.workingdogs.village.DataSetException
Get the promotion id for an order product object containing a gift certificate. A negative id is returned if a promotion doesn't exist.

Specified by:
getPromotionIdForGiftCertificate in interface AdminPromotionMgrIf
Parameters:
op -
Returns:
Returns the id of the promotion or -1 if a promotion doesn't exist.
Throws:
KKAdminException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

getPromotionIdForGiftCertificate

protected int getPromotionIdForGiftCertificate(int productId,
                                               int productOptionId,
                                               int productOptionValueId)
                                        throws org.apache.torque.TorqueException,
                                               com.workingdogs.village.DataSetException
Protected method for common code to get the promotion id of a promotion connected to a gift certificate. There should only be one promotion.

Parameters:
productId -
productOptionId -
productOptionValueId -
Returns:
Returns the id of the promotion
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException


Copyright © 2011 DS Data Systems UK Ltd.