com.konakart.bl
Class ProductMgr

java.lang.Object
  extended by com.konakart.bl.BaseMgr
      extended by com.konakart.bl.ProductMgr
All Implemented Interfaces:
ProductMgrIf

public class ProductMgr
extends BaseMgr
implements ProductMgrIf

Product Mgr.


Nested Class Summary
protected  class ProductMgr.OptionSortOrderComparator
          Used to sort the Option objects based on option id
protected  class ProductMgr.ProdAttr
          protected class used to create the encoded key
protected  class ProductMgr.ProdAttrSortOrderComparator
          Used to sort the ProdAttr objects based on option id
protected  class ProductMgr.StaticData
          Used to store the static data of this manager
protected  class ProductMgr.TagSortOrderComparator
          Used to sort a list of tags
 
Field Summary
static int ACCESSORY
          Accessories
static int ALL_RELATIONSHIPS
          Returns all related products
static int BOOKABLE_PRODUCT_TYPE
          Bookable Product Type
static int BUNDLE_PRODUCT_TYPE
          Bundle Product Type
static int BUNDLED_PRODUCT_RELATIONSHIP
          Bundled product
static int CROSS_SELL
          Cross Sell related products
static int CUSTOM_RELATIONSHIP_1
          Custom relationship
static int CUSTOM_RELATIONSHIP_2
          Custom relationship
static int CUSTOM_RELATIONSHIP_3
          Custom relationship
static java.lang.Boolean customAttrAnOracleCLOB
          is Oracle CLOB used for custom_attrs column?
static int DEPENDENT_ITEM
          Dependent items, such as warranties
static int DIGITAL_DOWNLOAD
          Digital download product
static int DONT_INCLUDE
          Used to not include values in the query
static int FREE_SHIPPING
          Physical product with free shipping
static int FREE_SHIPPING_BUNDLE_PRODUCT_TYPE
          Free Shipping Bundle Product Type
static int GIFT_CERTIFICATE_PRODUCT_TYPE
          Gift Certificate Product Type
protected static org.apache.commons.logging.Log log
          the log
protected static java.lang.String mutex
          Mutex
static int PHYSICAL_PRODUCT
          Physical product
protected static java.util.Map<java.lang.String,ProductMgr.StaticData> staticDataHM
          Hash Map that contains the static data
static int UP_SELL
          Up Sell related products
 
Fields inherited from class com.konakart.bl.BaseMgr
templateBaseDir
 
Constructor Summary
ProductMgr(KKEngIf eng)
          Constructor
 
Method Summary
protected  void addProductDescriptions(Product[] prods, int langId, boolean multiStoreSearch)
          Adds the description to an array of products
protected  void addReviewInfo(Product[] prodArray)
          Takes an array of products as input and for each one of them, populates the number of reviews
protected  void addTax(Customer cust, Product product)
          We set the price of the product including tax for the customer identified by cust.
protected  void addTax(Customer cust, Product[] prodArray)
          We iterate through the array of products and for each product, we set the price including tax.
protected  KKCriteria beforeSendCriteria(java.lang.String sessionId, java.lang.String apiCall, KKCriteria criteria, DataDescriptorIf dataDesc, ProductSearchIf prodSearch, int languageId)
          Method that can be used to customize the KKCriteria object before it is used to create the query string that is sent to the database.
protected  java.lang.String beforeSendQuery(java.lang.String sessionId, java.lang.String apiCall, java.lang.String queryString, DataDescriptorIf dataDesc, ProductSearchIf prodSearch, int languageId)
          Method that can be used to customize the query string before being sent to the database.
 java.lang.String createEncodedProductIdFromProductQuantityEncodedKey(int productId, java.lang.String productQuantityEncodedKey)
          Takes in a productQuantityEncodedKey and a productId and returns an encoded product Id.
 OptionIf[] createOptionsFromProductQuantityEncodedKey(java.lang.String encodedKey)
          Receives an encoded key from the products_quantity table in the format 3{4}4{6} and creates an array of Option objects.
 ProductQuantity createProductQuantityEncodedKeyFromEncodedProductId(java.lang.String encodedProductId)
          Takes in an encodedProductId and returns an encoded key for the products_quantity table
The format of the encoded product id is 1{2}3{4}5 where the product id = 1, the first optionId / valueId pair have ids of 2,3 and the 2nd optionId / valueId pair have ids of 4,5.
 java.lang.String createProductQuantityEncodedKeyFromOptions(OptionIf[] opts)
          Takes in an an array of options and returns an encoded key for the products_quantity table
The format of the encoded key for the products_quantity table is 3{4}4{6} which means product_options of id==3 and product_options_values of id==4 followed by product_options of id==4 and product_options_values of id==6.
protected  int decProductQuantitiesWithOptions(int productId, int quantitySold, boolean setStatus, boolean onlyOrdered, FetchProductOptionsIf options)
          An internal method to avoid code duplication.
protected  void deleteDigitalDownload(DigitalDownload dd)
          Deletes the digital download passed in as a parameter
protected  boolean doesExtQuantityExist(int productId, java.lang.String encodedOptionValues, java.lang.String catalogId, KKCriteria selectC)
          Returns true if the external quantity record exists
 boolean doesProductExist(int productId)
          Figure out whether a product exists
 void editDigitalDownload(DigitalDownloadIf digitalDownload)
          Edits the digital download object
 void editDigitalDownload(java.lang.String sessionId, DigitalDownloadIf digitalDownload)
          Edits the digital download object
protected  void editExtQuantity(int productId, java.lang.String encodedOptionValues, int quantity, java.lang.String catalogId, KKCriteria selectC, KKCriteria updateC)
          Used to edit a quantity in the external quantity table.
protected  boolean fetchDescriptionsSeparately()
          This can be specialized to modify the way the product descriptions are queried or the configuration variable can be set to the value you require to be returned here.
 Address[] getAddressesPerProduct(int productId)
          Returns all of the addresses for the given product.
 Products getAllProducts(java.lang.String sessionId, DataDescriptorIf dataDesc, int languageId)
          Returns all products
 Products getAllProductsWithOptions(java.lang.String sessionId, DataDescriptorIf dataDesc, int languageId, FetchProductOptionsIf options)
          Returns all products.
 Products getAllSpecials(java.lang.String sessionId, DataDescriptorIf dataDesc, int languageId)
          Returns all special priced products
 Product[] getAlsoPurchased(java.lang.String sessionId, DataDescriptorIf dataDesc, int productId, int languageId)
          Find products that were in the same order as orders containing the product referenced by productId.
 Product[] getAlsoPurchasedWithOptions(java.lang.String sessionId, DataDescriptorIf dataDesc, int productId, int languageId, FetchProductOptionsIf options)
          Find products that were in the same order as orders containing the product referenced by productId.
 Product[] getBestSellers(DataDescriptorIf dataDesc, int categoryId, int languageId)
          Calls getBestSellersWithOptions
 Product[] getBestSellersWithOptions(DataDescriptorIf dataDesc, int categoryId, int languageId, FetchProductOptionsIf options)
          Returns an array of bestseller products for the category and its children.
protected  ProductQuantityIf getBundleProductQuantityWithOptions(int productId, FetchProductOptionsIf options)
          Get the quantity and date available of a bundle product.
protected  int getCount(java.lang.String sessionId, java.lang.String apiCall, DataDescriptorIf dataDesc, ProductSearchIf prodSearch, KKCriteria c, boolean fixQuery, boolean tagCount, boolean multiStoreSearch, int languageId)
          This method is mainly used for paging.
protected  java.lang.String getCustomAttrs(int productId)
          Get the custom_attrs for the product with the specified Id
 ProdCustAttr[] getCustomAttrsFromXML(java.lang.String xml)
          Create an array of custom attributes from the XML
protected  DigitalDownload getDigitalDownload(int customerId, int productId)
          Returns a Digital Download object for the customerId and productId passed in as parameters.
 DigitalDownload getDigitalDownloadById(int digitalDownloadId)
          Returns a Digital Download object for the digital download id.
 DigitalDownload getDigitalDownloadById(java.lang.String sessionId, int digitalDownloadId)
          Returns a Digital Download object for the digital download id.
 DigitalDownload[] getDigitalDownloads(java.lang.String sessionId)
          Returns an array of Digital Download objects for the customer identified by the sessionId parameter.
protected  java.util.Date getExpiryDate(int maxDownloadDays)
          Common code to get the expiry date
protected  java.util.Date getLastAddedDateFromTagToProduct()
          Get the last date added for a tag to product record
protected  int getMaxDownloadDays(Product prod)
          Common code to get the maximum number of download days
protected  int getMaxNumDownloads(Product prod)
          Common code to get the maximum number of downloads
 Option getOption(int productId, int optionId, int optionValueId, int priceId, int languageId, FetchProductOptionsIf options)
          Finds a single Option object for the parameters passed in by reading from the product_attributes, product_options and product_options_values tables.
 Product[] getOrderHistory(DataDescriptorIf dataDesc, java.lang.String sessionId, int languageId)
          Get a list of the products ordered by the customer referenced by the sessionId.
 Product[] getOrderHistoryWithOptions(DataDescriptorIf dataDesc, java.lang.String sessionId, int languageId, FetchProductOptionsIf options)
          Get a list of the products ordered by the customer referenced by the sessionId.
 int getPaymentScheduleId(int productId)
          A utility method to return just the Payment Schedule Id from a product to determine whether it requires recurring billing.
 int getPriceId(Customer cust)
          Get the priceId from the customer
 Product getProduct(int customerId, int productId, int languageId)
          Fetches a fully populated product object for a customer referenced by customerId.
 Product getProduct(java.lang.String sessionId, int productId, int languageId)
          Fetches a fully populated product object.
protected  void getProductCountForTag(TagIf tag)
          Get the number of products for a tag and add the number to the tag object
 Product getProductPerSku(java.lang.String sessionId, java.lang.String sku, int languageId)
          Get a product from its SKU.
 Product getProductPerSkuWithOptions(java.lang.String sessionId, java.lang.String sku, int languageId, FetchProductOptionsIf options)
          Get a product from its SKU.
protected  ProductQuantityIf[] getProductQuantitiesPerProductWithOptions(int productId, FetchProductOptionsIf options)
          Return all of the product quantities associated with a product
 ProductQuantityIf getProductQuantity(java.lang.String encodedProductId)
          The stock level of the product is returned.
protected  ProductQuantityIf getProductQuantityPerProductWithOptions(int productId, java.lang.String encodedOptionValues, FetchProductOptionsIf options)
          Return all of the product quantities associated with a product
protected  ProductQuantityIf getProductQuantityWithOptions(int productId, FetchProductOptionsIf options)
          The stock level and available date of the product is returned assuming it has no attributes.
 ProductQuantityIf getProductQuantityWithOptions(java.lang.String encodedProductId, FetchProductOptionsIf options)
          The stock level of the product is returned.
 int getProductReorderLevel(int productId)
          Return the re-order level of the product.
protected  Products getProductsAllCases(java.lang.String apiCall, java.lang.String sessionId, DataDescriptorIf dataDesc, int categoryId, int languageId, int manufacturerId, FetchProductOptionsIf options)
          This protected method gets called by various flavours of public methods to get an array of products with differing criteria.
 Product[] getProductsFromIds(java.lang.String sessionId, java.util.ArrayList<java.lang.Integer> prodIdList, int languageId)
          Returns an array of products referenced by the ids in prodIdList.
 Product[] getProductsFromIdsWithOptions(java.lang.String sessionId, java.util.ArrayList<java.lang.Integer> prodIdList, int languageId, FetchProductOptionsIf options)
          Returns an array of products referenced by the ids in prodIdList.
 Product[] getProductsFromIdsWithOptions(java.lang.String sessionId, DataDescriptorIf dataDesc, int[] prodIdArray, int languageId, FetchProductOptionsIf options)
          Returns an array of products referenced by the ids in prodIdArray.
 Products getProductsPerCategory(java.lang.String sessionId, DataDescriptorIf dataDesc, int categoryId, boolean searchInSubCats, int languageId)
          Returns the products for a category
 Products getProductsPerCategoryPerManufacturer(java.lang.String sessionId, DataDescriptorIf dataDesc, int categoryId, int manufacturerId, int languageId)
          Returns the products for a category and a manufacturer
 Products getProductsPerCategoryPerManufacturerWithOptions(java.lang.String sessionId, DataDescriptorIf dataDesc, int categoryId, int manufacturerId, int languageId, FetchProductOptionsIf options)
          Returns the products for a category and a manufacturer.
 Products getProductsPerCategoryWithOptions(java.lang.String sessionId, DataDescriptorIf dataDesc, int categoryId, boolean searchInSubCats, int languageId, FetchProductOptionsIf options)
          Returns the products for a category.An options object is passed in to customize from where some of the product attributes (such as price and quantity) are fetched from.
 Products getProductsPerManufacturer(java.lang.String sessionId, DataDescriptorIf dataDesc, int manufacturerId, int languageId)
          Returns the products for a manufacturer
 Products getProductsPerManufacturerWithOptions(java.lang.String sessionId, DataDescriptorIf dataDesc, int manufacturerId, int languageId, FetchProductOptionsIf options)
          Returns the products for a manufacturer.An options object is passed in to customize from where some of the product attributes (such as price and quantity) are fetched from.
protected  int getProductType(int productId)
          Return the product type
protected  Product getProductWithOptions(int productId, Customer cust, int languageId, FetchProductOptionsIf options)
           
 Product getProductWithOptions(int customerId, int productId, int languageId, FetchProductOptionsIf options)
          Fetches a fully populated product object for a customer referenced by customerId.
 Product getProductWithOptions(java.lang.String sessionId, int productId, int languageId, FetchProductOptionsIf options)
          Fetches a fully populated product object.
 Products getRelatedProducts(java.lang.String sessionId, DataDescriptorIf dataDesc, int productId, int relationType, int languageId)
          Find products related to the product defined by the productId parameter.
protected  Products getRelatedProducts(java.lang.String sessionId, DataDescriptorIf dataDesc, int productId, int relationType, int languageId, java.util.HashMap<java.lang.String,Product> bundleProdMap, int loop, int quantity, FetchProductOptionsIf options)
          A protected version of getRelatedProducts with a hash map passed in for recursion
 Products getRelatedProductsWithOptions(java.lang.String sessionId, DataDescriptorIf dataDesc, int productId, int relationType, int languageId, FetchProductOptionsIf options)
          Find products related to the product defined by the productId parameter.
protected  java.lang.String getSku(int productId)
          Gets the SKU for a product directly from the product table.
 java.lang.String getSku(OrderProductIf orderProd)
          This method is deprecated since release 4.0.0.0 because an SKU attribute was added to the OrderProduct.
 Products getSpecialsPerCategory(java.lang.String sessionId, DataDescriptorIf dataDesc, int categoryId, boolean searchInSubCats, int languageId)
          Returns all special priced products for a category
 TagIf getTag(int tagId, boolean getProdCount, int languageId)
          Returns a Tag object for the id passed in as a parameter.
 TagGroupIf getTagGroup(int tagGroupId, boolean getProdCount, int languageId)
          Returns a TagGroup object for the id passed in as a parameter.
 TagGroup[] getTagGroupsPerCategory(int categoryId, boolean getProdCount, int languageId)
          Return an array of TagGroup objects for a category.
 TagIf[] getTagsPerCategory(int categoryId, boolean getProdCount, int languageId)
          Return an array of Tag objects for a category.
protected  TagIf[] getTagsPerTagGroup(int tagGroupId, boolean getProdCount, int languageId)
          Returns an array of Tags for a TagGroup
protected  int getTagToProductCount()
          Get the number of records in the tag to product table
 int getTaxClassId(int productId)
          Returns the tax class id for a product
protected  TierPrice[] getTierPrices(Product prod, int priceId, FetchProductOptionsIf options)
          Return the An array of TierPrice objects (or null) for the product referenced by productId
 int insertDigitalDownload(int customerId, int productId)
          Create and insert a digital download record for the product identified by the productId and the customer identified by the customerId.
 int insertDigitalDownload(java.lang.String sessionId, int productId)
          Create and insert a digital download record for the product identified by the productId and the customer identified by the sessionId.
protected  void insertExtQuantity(int productId, java.lang.String encodedOptionValues, int quantity, java.lang.String catalogId, KKCriteria insertC)
          Used to insert a quantity in the external quantity table.
 int insertGiftCertificateDigitalDownload(int customerId, int productId, java.lang.String filePath)
          Create and insert a digital download record for the product identified by the productId and the customer identified by the customerId.
static boolean isCustomAttrAnOracleCLOB()
          Is the custom_attrs column is an Oracle CLOB? We only check once and save the result in a static variable.
protected  void manageDataDescriptor(DataDescriptorIf dataDesc, org.apache.torque.util.Criteria c, java.lang.String price)
          Provides common code to deal with the management of the DataDescriptor.
protected  void manageDataDescriptor(DataDescriptorIf dataDesc, org.apache.torque.util.Criteria c, java.lang.String price, boolean addConstraints)
          Provides common code to deal with the management of the DataDescriptor.
 void refreshConfigs()
          Refresh the configuration of the product manager
 Products searchForProducts(java.lang.String sessionId, DataDescriptorIf dataDesc, ProductSearchIf prodSearch, int languageId)
          Returns products matching the search criteria.
protected  Products searchForProductsPrivate(java.lang.String apiCall, java.lang.String sessionId, DataDescriptorIf dataDesc, ProductSearchIf prodSearch, java.util.ArrayList<java.lang.Integer> prodIdList, int languageId, FetchProductOptionsIf options)
          Returns products matching the search criteria in the format defined by the data descriptor.
 Products searchForProductsWithOptions(java.lang.String sessionId, DataDescriptorIf dataDesc, ProductSearchIf prodSearch, int languageId, FetchProductOptionsIf options)
          Returns products matching the search criteria.
protected  java.util.List<com.workingdogs.village.Record> sendQuery(java.lang.String sessionId, java.lang.String apiCall, KKCriteria criteria, DataDescriptorIf dataDesc, ProductSearchIf prodSearch, int languageId, boolean fixQuery)
          Common code to send a query string
protected  void setCriteriaWithStandardAttributes(KKCriteria c, int languageId, boolean manuOuterJoin, boolean multiStoreSearch, FetchProductOptionsIf options, DataDescriptorIf dd)
          Initializes the criteria with the standard attributes for the product.
protected  void setCriteriaWithStandardAttributes(KKCriteria c, int languageId, FetchProductOptionsIf options)
          Initializes the criteria with the standard attributes for the product.
protected  void setDigitalDownloadCriteria(KKCriteria c)
          Sets the criteria with the standard attributes so as not to have to repeat this code many times.
protected  void setExtPriceProductAttributeCriteria(KKCriteria c, int productId, FetchProductOptionsIf options)
          Add criteria for getting the prices from another table based on the catalog id .
protected  void setExtPriceProductCriteria(KKCriteria c, FetchProductOptionsIf options)
          Add criteria for getting the prices from another table based on the catalog id .
protected  void setExtQuantityProductCriteria(KKCriteria c, FetchProductOptionsIf options)
          Add criteria for getting the product quantity from another table based on the catalog id .
protected  void setExtQuantityProductQuantityCriteria(KKCriteria c, int productId, FetchProductOptionsIf options)
          Add criteria for getting the product quantity from another table based on the catalog id .
protected  void setOptionPrice(Option opt, Product prod, int productId, int priceId)
          Edit the product option to use the correct price based on the price Id
protected  void setProductPrice(Product prod, int priceId)
          Edit the product to use the correct price based on the price Id
protected  void setProductsSharedCriteria(KKCriteria c, boolean getPriceId)
          Add criteria to get shared products from the database
protected  void setTagCriteriaWithStandardAttributes(KKCriteria c, int languageId)
          Set the Criteria attribute with standard attributes for a Tag object
protected  void setTagGroupCriteriaWithStandardAttributes(KKCriteria c, int languageId)
          Set the Criteria attribute with standard attributes for a TagGroup object
protected  void synchronizeTagProductCount()
          We save the product count for each tag, in a hash table.
protected  void updateBundleProductQuantityWithOptions(int productId, int quantitySold, boolean setStatus, FetchProductOptionsIf options)
          Updates the quantities for a bundle product.
 int updateDigitalDownloadCount(java.lang.String sessionId, int productId)
          Updates the count of the Digital Download that defines how many times it has been downloaded.
 int updateDigitalDownloadCountById(java.lang.String sessionId, int digitalDownloadId)
          Updates the count of the Digital Download (identified by id) that defines how many times it has been downloaded.
 int updateProductQuantity(int productId, OptionIf[] opts, int quantitySold, boolean setStatus)
          The product quantity is updated by subtracting quantitySold from the current quantity.
 int updateProductQuantity(int productId, OptionIf[] opts, java.lang.String encodedOptions, int quantitySold, boolean setStatus)
          The product quantity is updated by subtracting quantitySold from the current quantity.
 int updateProductQuantityWithOptions(int productId, OptionIf[] opts, java.lang.String encodedOptions, int quantitySold, boolean setStatus, FetchProductOptionsIf options)
          The product quantity is updated by subtracting quantitySold from the current quantity.
 void updateProductViewedCount(int productId, int languageId)
          Increments the viewed count for the product.
protected  boolean useSpecialPrice()
          This can be specialized to return false if special prices aren't used.
protected  Product validateDigitalDownload(int productId)
          Validate the digital download productId
 
Methods inherited from class com.konakart.bl.BaseMgr
addInsertAttr, addInsertAttr, checkRequired, executeQuery, executeQuery, getAdminEngMgr, getBasketMgr, getBillingMgr, getBookableProductMgr, getCatMgr, getConfigMgr, getCookieMgr, getCurrMgr, getCustMgr, getCustomerIdFromSession, getCustomerStatsMgr, getCustomerTagMgr, getEmailMgr, getEng, getLangMgr, getManuMgr, getMiscItemMgr, getMode, getModeString, getMqMgr, getMultiStoreMgr, getNewCriteria, getNewCriteria, getOrderIntegrationMgr, getOrderMgr, getOrderTotalMgr, getPaymentMgr, getProdMgr, getPromMgr, getPunchOutMgr, getRewardPointMgr, getSecMgr, getShippingMgr, getSolrMgr, getStoreId, getTaxMgr, getTemplate, getTemplateRoot, getVelocityContextMgr, getWishListMgr, init, isDeadlockException, isEnterprise, isMultiStoreShareCategories, isMultiStoreShareCustomers, isMultiStoreShareProducts
 
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


DONT_INCLUDE

public static final int DONT_INCLUDE
Used to not include values in the query

See Also:
Constant Field Values

ALL_RELATIONSHIPS

public static final int ALL_RELATIONSHIPS
Returns all related products

See Also:
Constant Field Values

UP_SELL

public static final int UP_SELL
Up Sell related products

See Also:
Constant Field Values

CROSS_SELL

public static final int CROSS_SELL
Cross Sell related products

See Also:
Constant Field Values

ACCESSORY

public static final int ACCESSORY
Accessories

See Also:
Constant Field Values

DEPENDENT_ITEM

public static final int DEPENDENT_ITEM
Dependent items, such as warranties

See Also:
Constant Field Values

BUNDLED_PRODUCT_RELATIONSHIP

public static final int BUNDLED_PRODUCT_RELATIONSHIP
Bundled product

See Also:
Constant Field Values

CUSTOM_RELATIONSHIP_1

public static final int CUSTOM_RELATIONSHIP_1
Custom relationship

See Also:
Constant Field Values

CUSTOM_RELATIONSHIP_2

public static final int CUSTOM_RELATIONSHIP_2
Custom relationship

See Also:
Constant Field Values

CUSTOM_RELATIONSHIP_3

public static final int CUSTOM_RELATIONSHIP_3
Custom relationship

See Also:
Constant Field Values

PHYSICAL_PRODUCT

public static final int PHYSICAL_PRODUCT
Physical product

See Also:
Constant Field Values

DIGITAL_DOWNLOAD

public static final int DIGITAL_DOWNLOAD
Digital download product

See Also:
Constant Field Values

FREE_SHIPPING

public static final int FREE_SHIPPING
Physical product with free shipping

See Also:
Constant Field Values

BUNDLE_PRODUCT_TYPE

public static final int BUNDLE_PRODUCT_TYPE
Bundle Product Type

See Also:
Constant Field Values

FREE_SHIPPING_BUNDLE_PRODUCT_TYPE

public static final int FREE_SHIPPING_BUNDLE_PRODUCT_TYPE
Free Shipping Bundle Product Type

See Also:
Constant Field Values

GIFT_CERTIFICATE_PRODUCT_TYPE

public static final int GIFT_CERTIFICATE_PRODUCT_TYPE
Gift Certificate Product Type

See Also:
Constant Field Values

BOOKABLE_PRODUCT_TYPE

public static final int BOOKABLE_PRODUCT_TYPE
Bookable Product Type

See Also:
Constant Field Values

staticDataHM

protected static java.util.Map<java.lang.String,ProductMgr.StaticData> staticDataHM
Hash Map that contains the static data


customAttrAnOracleCLOB

public static java.lang.Boolean customAttrAnOracleCLOB
is Oracle CLOB used for custom_attrs column?


mutex

protected static java.lang.String mutex
Mutex

Constructor Detail

ProductMgr

public ProductMgr(KKEngIf eng)
           throws java.lang.Exception
Constructor

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

getProductsPerCategory

public Products getProductsPerCategory(java.lang.String sessionId,
                                       DataDescriptorIf dataDesc,
                                       int categoryId,
                                       boolean searchInSubCats,
                                       int languageId)
                                throws java.lang.Exception
Description copied from interface: ProductMgrIf
Returns the products for a category

Specified by:
getProductsPerCategory in interface ProductMgrIf
Parameters:
sessionId -
dataDesc -
categoryId -
searchInSubCats -
languageId -
Returns:
Products object
Throws:
java.lang.Exception

getProductsPerCategoryWithOptions

public Products getProductsPerCategoryWithOptions(java.lang.String sessionId,
                                                  DataDescriptorIf dataDesc,
                                                  int categoryId,
                                                  boolean searchInSubCats,
                                                  int languageId,
                                                  FetchProductOptionsIf options)
                                           throws java.lang.Exception
Description copied from interface: ProductMgrIf
Returns the products for a category.An options object is passed in to customize from where some of the product attributes (such as price and quantity) are fetched from.

Specified by:
getProductsPerCategoryWithOptions in interface ProductMgrIf
Parameters:
sessionId -
dataDesc -
categoryId -
searchInSubCats -
languageId -
options -
Returns:
Products object
Throws:
java.lang.Exception

getProductsPerCategoryPerManufacturer

public Products getProductsPerCategoryPerManufacturer(java.lang.String sessionId,
                                                      DataDescriptorIf dataDesc,
                                                      int categoryId,
                                                      int manufacturerId,
                                                      int languageId)
                                               throws java.lang.Exception
Description copied from interface: ProductMgrIf
Returns the products for a category and a manufacturer

Specified by:
getProductsPerCategoryPerManufacturer in interface ProductMgrIf
Parameters:
sessionId -
dataDesc -
categoryId -
manufacturerId -
languageId -
Returns:
Products object
Throws:
java.lang.Exception

getProductsPerCategoryPerManufacturerWithOptions

public Products getProductsPerCategoryPerManufacturerWithOptions(java.lang.String sessionId,
                                                                 DataDescriptorIf dataDesc,
                                                                 int categoryId,
                                                                 int manufacturerId,
                                                                 int languageId,
                                                                 FetchProductOptionsIf options)
                                                          throws java.lang.Exception
Description copied from interface: ProductMgrIf
Returns the products for a category and a manufacturer. An options object is passed in to customize from where some of the product attributes (such as price and quantity) are fetched from.

Specified by:
getProductsPerCategoryPerManufacturerWithOptions in interface ProductMgrIf
Parameters:
sessionId -
dataDesc -
categoryId -
manufacturerId -
languageId -
options -
Returns:
Products object
Throws:
java.lang.Exception

getAllProducts

public Products getAllProducts(java.lang.String sessionId,
                               DataDescriptorIf dataDesc,
                               int languageId)
                        throws java.lang.Exception
Description copied from interface: ProductMgrIf
Returns all products

Specified by:
getAllProducts in interface ProductMgrIf
Parameters:
sessionId -
dataDesc -
languageId -
Returns:
Products object
Throws:
java.lang.Exception

getAllProductsWithOptions

public Products getAllProductsWithOptions(java.lang.String sessionId,
                                          DataDescriptorIf dataDesc,
                                          int languageId,
                                          FetchProductOptionsIf options)
                                   throws java.lang.Exception
Description copied from interface: ProductMgrIf
Returns all products. An options object is passed in to customize from where some of the product attributes (such as price and quantity) are fetched from.

Specified by:
getAllProductsWithOptions in interface ProductMgrIf
Parameters:
sessionId -
dataDesc -
languageId -
options -
Returns:
Products object
Throws:
java.lang.Exception

getProductsPerManufacturer

public Products getProductsPerManufacturer(java.lang.String sessionId,
                                           DataDescriptorIf dataDesc,
                                           int manufacturerId,
                                           int languageId)
                                    throws java.lang.Exception
Description copied from interface: ProductMgrIf
Returns the products for a manufacturer

Specified by:
getProductsPerManufacturer in interface ProductMgrIf
Parameters:
sessionId -
dataDesc -
manufacturerId -
languageId -
Returns:
Products object
Throws:
java.lang.Exception

getProductsPerManufacturerWithOptions

public Products getProductsPerManufacturerWithOptions(java.lang.String sessionId,
                                                      DataDescriptorIf dataDesc,
                                                      int manufacturerId,
                                                      int languageId,
                                                      FetchProductOptionsIf options)
                                               throws java.lang.Exception
Description copied from interface: ProductMgrIf
Returns the products for a manufacturer.An options object is passed in to customize from where some of the product attributes (such as price and quantity) are fetched from.

Specified by:
getProductsPerManufacturerWithOptions in interface ProductMgrIf
Parameters:
sessionId -
dataDesc -
manufacturerId -
languageId -
options -
Returns:
Products object
Throws:
java.lang.Exception

getProductsAllCases

protected Products getProductsAllCases(java.lang.String apiCall,
                                       java.lang.String sessionId,
                                       DataDescriptorIf dataDesc,
                                       int categoryId,
                                       int languageId,
                                       int manufacturerId,
                                       FetchProductOptionsIf options)
                                throws java.lang.Exception
This protected method gets called by various flavours of public methods to get an array of products with differing criteria.

Parameters:
apiCall -
sessionId -
dataDesc -
categoryId -
languageId -
manufacturerId -
options -
Returns:
Products object
Throws:
java.lang.Exception

addReviewInfo

protected void addReviewInfo(Product[] prodArray)
                      throws org.apache.torque.TorqueException,
                             com.workingdogs.village.DataSetException,
                             KKException
Takes an array of products as input and for each one of them, populates the number of reviews

We do it this way because we didn't want to create a select query for each product in the array. The way that this method deals with the problem is to perform one query using the IN clause.

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

getTaxClassId

public int getTaxClassId(int productId)
                  throws org.apache.torque.TorqueException,
                         KKException,
                         com.workingdogs.village.DataSetException
Description copied from interface: ProductMgrIf
Returns the tax class id for a product

Specified by:
getTaxClassId in interface ProductMgrIf
Parameters:
productId -
Returns:
Returns the TaxClass Id
Throws:
org.apache.torque.TorqueException
KKException
com.workingdogs.village.DataSetException

getProduct

public Product getProduct(java.lang.String sessionId,
                          int productId,
                          int languageId)
                   throws java.lang.Exception
Description copied from interface: ProductMgrIf
Fetches a fully populated product object. If there is a valid sessionId, the prices are calculated for the logged in customer.

Specified by:
getProduct in interface ProductMgrIf
Parameters:
sessionId -
productId -
languageId -
Returns:
Returns a product object with full details
Throws:
java.lang.Exception

getProductWithOptions

public Product getProductWithOptions(java.lang.String sessionId,
                                     int productId,
                                     int languageId,
                                     FetchProductOptionsIf options)
                              throws java.lang.Exception
Description copied from interface: ProductMgrIf
Fetches a fully populated product object. If there is a valid sessionId, the prices are calculated for the logged in customer. An options object is passed in to customize from where some of the product attributes (such as price and quantity) are fetched from.

Specified by:
getProductWithOptions in interface ProductMgrIf
Parameters:
sessionId -
productId -
languageId -
options -
Returns:
Returns a product object with full details
Throws:
java.lang.Exception

getProduct

public Product getProduct(int customerId,
                          int productId,
                          int languageId)
                   throws java.lang.Exception
Description copied from interface: ProductMgrIf
Fetches a fully populated product object for a customer referenced by customerId.

Specified by:
getProduct in interface ProductMgrIf
Parameters:
customerId -
productId -
languageId -
Returns:
Returns a product object
Throws:
java.lang.Exception

getProductWithOptions

public Product getProductWithOptions(int customerId,
                                     int productId,
                                     int languageId,
                                     FetchProductOptionsIf options)
                              throws java.lang.Exception
Description copied from interface: ProductMgrIf
Fetches a fully populated product object for a customer referenced by customerId. An options object is passed in to customize from where some of the product attributes (such as price and quantity) are fetched from.

Specified by:
getProductWithOptions in interface ProductMgrIf
Parameters:
customerId -
productId -
languageId -
options -
Returns:
Returns a product object
Throws:
java.lang.Exception

getProductWithOptions

protected Product getProductWithOptions(int productId,
                                        Customer cust,
                                        int languageId,
                                        FetchProductOptionsIf options)
                                 throws java.lang.Exception
Parameters:
productId -
cust -
languageId -
options -
Returns:
A product object with full details
Throws:
java.lang.Exception

updateProductViewedCount

public void updateProductViewedCount(int productId,
                                     int languageId)
                              throws java.lang.Exception
Description copied from interface: ProductMgrIf
Increments the viewed count for the product.

Specified by:
updateProductViewedCount in interface ProductMgrIf
Parameters:
productId -
languageId -
Throws:
java.lang.Exception

getAllSpecials

public Products getAllSpecials(java.lang.String sessionId,
                               DataDescriptorIf dataDesc,
                               int languageId)
                        throws java.lang.Exception
Description copied from interface: ProductMgrIf
Returns all special priced products

Specified by:
getAllSpecials in interface ProductMgrIf
Parameters:
sessionId -
dataDesc -
languageId -
Returns:
Array of products
Throws:
java.lang.Exception

getSpecialsPerCategory

public Products getSpecialsPerCategory(java.lang.String sessionId,
                                       DataDescriptorIf dataDesc,
                                       int categoryId,
                                       boolean searchInSubCats,
                                       int languageId)
                                throws java.lang.Exception
Description copied from interface: ProductMgrIf
Returns all special priced products for a category

Specified by:
getSpecialsPerCategory in interface ProductMgrIf
Parameters:
sessionId -
dataDesc -
categoryId -
searchInSubCats -
languageId -
Returns:
Return an array of products
Throws:
java.lang.Exception

addTax

protected void addTax(Customer cust,
                      Product[] prodArray)
               throws java.lang.Exception
We iterate through the array of products and for each product, we set the price including tax. If the user isn't logged in, we use the country and zone of the store to determine whether any tax is due. Otherwise we use the country id and zone of the primary address of the logged in customer.

Parameters:
cust -
prodArray -
Throws:
java.lang.Exception

addTax

protected void addTax(Customer cust,
                      Product product)
               throws java.lang.Exception
We set the price of the product including tax for the customer identified by cust. We use the country id and zone of the primary address of the customer.

Parameters:
cust -
product -
Throws:
java.lang.Exception

getProductsFromIds

public Product[] getProductsFromIds(java.lang.String sessionId,
                                    java.util.ArrayList<java.lang.Integer> prodIdList,
                                    int languageId)
                             throws java.lang.Exception
Returns an array of products referenced by the ids in prodIdList.

Specified by:
getProductsFromIds in interface ProductMgrIf
Parameters:
sessionId -
prodIdList -
languageId -
Returns:
An array of products
Throws:
java.lang.Exception

getProductsFromIdsWithOptions

public Product[] getProductsFromIdsWithOptions(java.lang.String sessionId,
                                               java.util.ArrayList<java.lang.Integer> prodIdList,
                                               int languageId,
                                               FetchProductOptionsIf options)
                                        throws java.lang.Exception
Returns an array of products referenced by the ids in prodIdList.

Specified by:
getProductsFromIdsWithOptions in interface ProductMgrIf
Parameters:
sessionId -
prodIdList -
languageId -
options -
Returns:
An array of products
Throws:
java.lang.Exception

getProductsFromIdsWithOptions

public Product[] getProductsFromIdsWithOptions(java.lang.String sessionId,
                                               DataDescriptorIf dataDesc,
                                               int[] prodIdArray,
                                               int languageId,
                                               FetchProductOptionsIf options)
                                        throws java.lang.Exception
Returns an array of products referenced by the ids in prodIdArray.

Specified by:
getProductsFromIdsWithOptions in interface ProductMgrIf
Parameters:
sessionId -
dataDesc -
prodIdArray -
languageId -
options -
Returns:
An array of products
Throws:
java.lang.Exception

searchForProducts

public Products searchForProducts(java.lang.String sessionId,
                                  DataDescriptorIf dataDesc,
                                  ProductSearchIf prodSearch,
                                  int languageId)
                           throws java.lang.Exception
Description copied from interface: ProductMgrIf
Returns products matching the search criteria.

Specified by:
searchForProducts in interface ProductMgrIf
Parameters:
sessionId -
dataDesc -
prodSearch -
languageId -
Returns:
Return a Products object
Throws:
java.lang.Exception

searchForProductsWithOptions

public Products searchForProductsWithOptions(java.lang.String sessionId,
                                             DataDescriptorIf dataDesc,
                                             ProductSearchIf prodSearch,
                                             int languageId,
                                             FetchProductOptionsIf options)
                                      throws java.lang.Exception
Description copied from interface: ProductMgrIf
Returns products matching the search criteria. An options object is passed in to customize from where some of the product attributes (such as price and quantity) are fetched from.

Specified by:
searchForProductsWithOptions in interface ProductMgrIf
Parameters:
sessionId -
dataDesc -
prodSearch -
languageId -
options -
Returns:
Return a Products object
Throws:
java.lang.Exception

useSpecialPrice

protected boolean useSpecialPrice()
This can be specialized to return false if special prices aren't used. In this case the query that filters products by price runs faster.

Returns:
Returns a boolean

fetchDescriptionsSeparately

protected boolean fetchDescriptionsSeparately()
                                       throws KKException
This can be specialized to modify the way the product descriptions are queried or the configuration variable can be set to the value you require to be returned here.

Returns:
Returns true to fetch the product descriptions separately (typically used when using Oracle CLOBs for storing product descriptions). Returns false to fetch the product descriptions as part of the main product query.
Throws:
KKException

searchForProductsPrivate

protected Products searchForProductsPrivate(java.lang.String apiCall,
                                            java.lang.String sessionId,
                                            DataDescriptorIf dataDesc,
                                            ProductSearchIf prodSearch,
                                            java.util.ArrayList<java.lang.Integer> prodIdList,
                                            int languageId,
                                            FetchProductOptionsIf options)
                                     throws java.lang.Exception
Returns products matching the search criteria in the format defined by the data descriptor.

Parameters:
apiCall -
sessionId -
dataDesc -
prodSearch -
prodIdList - If not null, it must contain a list of productIds which will be added to an IN clause.
languageId -
options -
Returns:
Return a Products object
Throws:
java.lang.Exception

getCustomAttrs

protected java.lang.String getCustomAttrs(int productId)
                                   throws java.lang.Exception
Get the custom_attrs for the product with the specified Id

Parameters:
productId -
Returns:
the custom_attrs as a String
Throws:
java.lang.Exception

getTierPrices

protected TierPrice[] getTierPrices(Product prod,
                                    int priceId,
                                    FetchProductOptionsIf options)
                             throws org.apache.torque.TorqueException,
                                    KKException,
                                    com.workingdogs.village.DataSetException
Return the An array of TierPrice objects (or null) for the product referenced by productId

Parameters:
prod -
priceId -
options -
Returns:
Returns an array of TierPrice objects
Throws:
org.apache.torque.TorqueException
KKException
com.workingdogs.village.DataSetException

setCriteriaWithStandardAttributes

protected void setCriteriaWithStandardAttributes(KKCriteria c,
                                                 int languageId,
                                                 FetchProductOptionsIf options)
                                          throws org.apache.torque.TorqueException,
                                                 KKException,
                                                 com.workingdogs.village.DataSetException,
                                                 java.lang.Exception
Initializes the criteria with the standard attributes for the product.

Parameters:
c -
languageId -
options -
Throws:
java.lang.Exception
com.workingdogs.village.DataSetException
KKException
org.apache.torque.TorqueException

setCriteriaWithStandardAttributes

protected void setCriteriaWithStandardAttributes(KKCriteria c,
                                                 int languageId,
                                                 boolean manuOuterJoin,
                                                 boolean multiStoreSearch,
                                                 FetchProductOptionsIf options,
                                                 DataDescriptorIf dd)
                                          throws org.apache.torque.TorqueException,
                                                 KKException,
                                                 com.workingdogs.village.DataSetException,
                                                 java.lang.Exception
Initializes the criteria with the standard attributes for the product. Depending on the value of manuOuterJoin we do a normal or outer join with the manufacturers table.

Parameters:
c -
languageId -
manuOuterJoin -
multiStoreSearch -
options -
dd -
Throws:
java.lang.Exception
com.workingdogs.village.DataSetException
KKException
org.apache.torque.TorqueException

setExtPriceProductCriteria

protected void setExtPriceProductCriteria(KKCriteria c,
                                          FetchProductOptionsIf options)
                                   throws KKException
Add criteria for getting the prices from another table based on the catalog id .

Parameters:
c - criteria object
options - fetch product options
Throws:
KKException

setExtQuantityProductCriteria

protected void setExtQuantityProductCriteria(KKCriteria c,
                                             FetchProductOptionsIf options)
                                      throws KKException
Add criteria for getting the product quantity from another table based on the catalog id .

Parameters:
c - criteria object
options - fetch product options
Throws:
KKException

setExtQuantityProductQuantityCriteria

protected void setExtQuantityProductQuantityCriteria(KKCriteria c,
                                                     int productId,
                                                     FetchProductOptionsIf options)
                                              throws KKException
Add criteria for getting the product quantity from another table based on the catalog id .

Parameters:
c -
productId -
options -
Throws:
KKException

setExtPriceProductAttributeCriteria

protected void setExtPriceProductAttributeCriteria(KKCriteria c,
                                                   int productId,
                                                   FetchProductOptionsIf options)
                                            throws KKException
Add criteria for getting the prices from another table based on the catalog id .

Parameters:
c -
productId -
options -
Throws:
KKException

setProductsSharedCriteria

protected void setProductsSharedCriteria(KKCriteria c,
                                         boolean getPriceId)
                                  throws KKException
Add criteria to get shared products from the database

Parameters:
c -
getPriceId -
Throws:
KKException

manageDataDescriptor

protected void manageDataDescriptor(DataDescriptorIf dataDesc,
                                    org.apache.torque.util.Criteria c,
                                    java.lang.String price)
Provides common code to deal with the management of the DataDescriptor. The price is passed in because in the case of specials, we use the specials price. In the case of products that may not have the special price set, we use a virtual column that is either set to the price or the special price if it exists. It calls manageDataDescriptor(DataDescriptorIf dataDesc, Criteria c, String price, boolean addConstraints) with addConstraints set to true.

Parameters:
dataDesc -
c -
price -

manageDataDescriptor

protected void manageDataDescriptor(DataDescriptorIf dataDesc,
                                    org.apache.torque.util.Criteria c,
                                    java.lang.String price,
                                    boolean addConstraints)
Provides common code to deal with the management of the DataDescriptor. The price is passed in because in the case of specials, we use the specials price. In the case of products that may not have the special price set, we use a virtual column that is either set to the price or the special price if it exists.

Parameters:
dataDesc -
c -
price -
addConstraints - If set to true, the custom field constraints are added.

getCount

protected int getCount(java.lang.String sessionId,
                       java.lang.String apiCall,
                       DataDescriptorIf dataDesc,
                       ProductSearchIf prodSearch,
                       KKCriteria c,
                       boolean fixQuery,
                       boolean tagCount,
                       boolean multiStoreSearch,
                       int languageId)
                throws java.lang.Exception
This method is mainly used for paging.

Parameters:
sessionId -
apiCall -
dataDesc -
prodSearch -
c -
fixQuery -
tagCount -
multiStoreSearch -
languageId -
Returns:
The number of records present in the database matching the given criteria
Throws:
java.lang.Exception

getOption

public Option getOption(int productId,
                        int optionId,
                        int optionValueId,
                        int priceId,
                        int languageId,
                        FetchProductOptionsIf options)
                 throws java.lang.Exception
Finds a single Option object for the parameters passed in by reading from the product_attributes, product_options and product_options_values tables.

Specified by:
getOption in interface ProductMgrIf
Parameters:
productId -
optionId -
optionValueId -
priceId -
languageId -
Returns:
Returns an Option object or null if not found
Throws:
java.lang.Exception

getBestSellersWithOptions

public Product[] getBestSellersWithOptions(DataDescriptorIf dataDesc,
                                           int categoryId,
                                           int languageId,
                                           FetchProductOptionsIf options)
                                    throws java.lang.Exception
Returns an array of bestseller products for the category and its children. The products are returned in the language referenced by languageId. If the categoryId=0 then it is not used as a constraint for the query.

Specified by:
getBestSellersWithOptions in interface ProductMgrIf
Parameters:
dataDesc -
categoryId -
languageId -
options -
Returns:
An array of products
Throws:
java.lang.Exception

addProductDescriptions

protected void addProductDescriptions(Product[] prods,
                                      int langId,
                                      boolean multiStoreSearch)
                               throws java.lang.Exception
Adds the description to an array of products

Parameters:
prods -
langId -
multiStoreSearch -
Throws:
java.lang.Exception

getBestSellers

public Product[] getBestSellers(DataDescriptorIf dataDesc,
                                int categoryId,
                                int languageId)
                         throws java.lang.Exception
Calls getBestSellersWithOptions

Specified by:
getBestSellers in interface ProductMgrIf
Returns:
An array of products
Throws:
java.lang.Exception

getOrderHistoryWithOptions

public Product[] getOrderHistoryWithOptions(DataDescriptorIf dataDesc,
                                            java.lang.String sessionId,
                                            int languageId,
                                            FetchProductOptionsIf options)
                                     throws java.lang.Exception
Get a list of the products ordered by the customer referenced by the sessionId.

Specified by:
getOrderHistoryWithOptions in interface ProductMgrIf
Parameters:
dataDesc -
sessionId -
languageId -
options -
Returns:
Returns a list of products
Throws:
java.lang.Exception

getOrderHistory

public Product[] getOrderHistory(DataDescriptorIf dataDesc,
                                 java.lang.String sessionId,
                                 int languageId)
                          throws java.lang.Exception
Description copied from interface: ProductMgrIf
Get a list of the products ordered by the customer referenced by the sessionId.

Specified by:
getOrderHistory in interface ProductMgrIf
Returns:
Returns a list of products
Throws:
java.lang.Exception

getAlsoPurchasedWithOptions

public Product[] getAlsoPurchasedWithOptions(java.lang.String sessionId,
                                             DataDescriptorIf dataDesc,
                                             int productId,
                                             int languageId,
                                             FetchProductOptionsIf options)
                                      throws java.lang.Exception
Find products that were in the same order as orders containing the product referenced by productId. The return order of the products is by purchase date. The DataDescriptor determines the number of products returned.

Specified by:
getAlsoPurchasedWithOptions in interface ProductMgrIf
Parameters:
sessionId -
dataDesc -
productId -
languageId -
options -
Returns:
Array of products
Throws:
java.lang.Exception

getAlsoPurchased

public Product[] getAlsoPurchased(java.lang.String sessionId,
                                  DataDescriptorIf dataDesc,
                                  int productId,
                                  int languageId)
                           throws java.lang.Exception
Description copied from interface: ProductMgrIf
Find products that were in the same order as orders containing the product referenced by productId. The return order of the products is by purchase date. The DataDescriptor determines the number of products returned.

Specified by:
getAlsoPurchased in interface ProductMgrIf
Returns:
Array of products
Throws:
java.lang.Exception

getRelatedProducts

public Products getRelatedProducts(java.lang.String sessionId,
                                   DataDescriptorIf dataDesc,
                                   int productId,
                                   int relationType,
                                   int languageId)
                            throws java.lang.Exception
Find products related to the product defined by the productId parameter. The relationType defines the relation. Valid values for relationType are:

Specified by:
getRelatedProducts in interface ProductMgrIf
Parameters:
sessionId -
dataDesc -
productId -
relationType -
languageId -
Returns:
A products object
Throws:
java.lang.Exception

getRelatedProductsWithOptions

public Products getRelatedProductsWithOptions(java.lang.String sessionId,
                                              DataDescriptorIf dataDesc,
                                              int productId,
                                              int relationType,
                                              int languageId,
                                              FetchProductOptionsIf options)
                                       throws java.lang.Exception
Description copied from interface: ProductMgrIf
Find products related to the product defined by the productId parameter. The relationType defines the relation. Valid values for relationType are: An options object is passed in to customize from where some of the product attributes (such as price and quantity) are fetched from.

Specified by:
getRelatedProductsWithOptions in interface ProductMgrIf
Parameters:
sessionId -
dataDesc -
productId -
relationType -
languageId -
options -
Returns:
A products object
Throws:
java.lang.Exception

getRelatedProducts

protected Products getRelatedProducts(java.lang.String sessionId,
                                      DataDescriptorIf dataDesc,
                                      int productId,
                                      int relationType,
                                      int languageId,
                                      java.util.HashMap<java.lang.String,Product> bundleProdMap,
                                      int loop,
                                      int quantity,
                                      FetchProductOptionsIf options)
                               throws java.lang.Exception
A protected version of getRelatedProducts with a hash map passed in for recursion

Parameters:
sessionId -
dataDesc -
productId -
relationType -
languageId -
bundleProdMap - HashMap used to keep track of products during recursion.
loop - Used to stop recursion forever. Throws an exception if recursion occurs when a bundle product is set to be a product within the bundle.
quantity - Used to multiply quantity during recursion. i.e. A bundled product may have a quantity of two and itself be a bundle. This means that all of the products in its bundle have to be multiplied by two.
options -
Returns:
A products object
Throws:
java.lang.Exception

getSku

public java.lang.String getSku(OrderProductIf orderProd)
                        throws KKException,
                               org.apache.torque.TorqueException,
                               com.workingdogs.village.DataSetException
This method is deprecated since release 4.0.0.0 because an SKU attribute was added to the OrderProduct.

Specified by:
getSku in interface ProductMgrIf
Parameters:
orderProd -
Returns:
Returns the SKU for the OrderProduct
Throws:
KKException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

getSku

protected java.lang.String getSku(int productId)
                           throws org.apache.torque.TorqueException,
                                  com.workingdogs.village.DataSetException,
                                  KKException
Gets the SKU for a product directly from the product table.

Parameters:
productId -
Returns:
Returns the SKU
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKException

updateProductQuantity

public int updateProductQuantity(int productId,
                                 OptionIf[] opts,
                                 int quantitySold,
                                 boolean setStatus)
                          throws java.lang.Exception
The product quantity is updated by subtracting quantitySold from the current quantity. If setStatus is set to true, we make the product unavailable (by setting the product status to 0) if the quantity falls to zero or below.

Specified by:
updateProductQuantity in interface ProductMgrIf
Parameters:
productId -
opts -
quantitySold -
setStatus -
Returns:
The new quantity
Throws:
java.lang.Exception

updateProductQuantity

public int updateProductQuantity(int productId,
                                 OptionIf[] opts,
                                 java.lang.String encodedOptions,
                                 int quantitySold,
                                 boolean setStatus)
                          throws java.lang.Exception
The product quantity is updated by subtracting quantitySold from the current quantity. If setStatus is set to true, we make the product unavailable (by setting the product status to 0) if the quantity falls to zero or below.
This method either uses opts or encodedOptions depending on which one isn't set to null.

Specified by:
updateProductQuantity in interface ProductMgrIf
Parameters:
productId -
opts -
encodedOptions -
quantitySold -
setStatus -
Returns:
The new quantity
Throws:
java.lang.Exception

updateProductQuantityWithOptions

public int updateProductQuantityWithOptions(int productId,
                                            OptionIf[] opts,
                                            java.lang.String encodedOptions,
                                            int quantitySold,
                                            boolean setStatus,
                                            FetchProductOptionsIf options)
                                     throws java.lang.Exception
The product quantity is updated by subtracting quantitySold from the current quantity. If setStatus is set to true, we make the product unavailable (by setting the product status to 0) if the quantity falls to zero or below.
This method either uses opts or encodedOptions depending on which one isn't set to null.

Specified by:
updateProductQuantityWithOptions in interface ProductMgrIf
Parameters:
productId -
opts -
encodedOptions -
quantitySold -
setStatus -
options -
Returns:
The new quantity
Throws:
java.lang.Exception

updateBundleProductQuantityWithOptions

protected void updateBundleProductQuantityWithOptions(int productId,
                                                      int quantitySold,
                                                      boolean setStatus,
                                                      FetchProductOptionsIf options)
                                               throws java.lang.Exception
Updates the quantities for a bundle product.

Parameters:
productId -
quantitySold -
setStatus -
options -
Throws:
java.lang.Exception

decProductQuantitiesWithOptions

protected int decProductQuantitiesWithOptions(int productId,
                                              int quantitySold,
                                              boolean setStatus,
                                              boolean onlyOrdered,
                                              FetchProductOptionsIf options)
                                       throws java.lang.Exception
An internal method to avoid code duplication. It reads the product object to get the current quantity and current products ordered. These values are updated with respect to the quantitySold parameter and then re-written to the DB.
If onlyOrdered == true, we don't touch the quantity attribute and only update the ordered attribute.
If setStatus is set to true, the status of the product is changed if the quantity falls below zero.

Parameters:
productId -
quantitySold -
setStatus -
onlyOrdered -
options -
Returns:
Returns the current quantity
Throws:
java.lang.Exception

getProductQuantity

public ProductQuantityIf getProductQuantity(java.lang.String encodedProductId)
                                     throws java.lang.Exception
The stock level of the product is returned. An exception is thrown if the product doesn't exist or if the encoded product id has an invalid format. The format of the encoded product id is 1{2}3{4}5 where the product id = 1, the first optionId / valueId pair have ids of 2,3 and the 2nd optionId / valueId pair have ids of 4,5. If there are no option / value pairs then we use the stock level from the product object. If there is at least one option / value pair, we attempt to find the quantity in the product quantity table. If we can't find it in the product_quantity table we look for at least one record in the product_quantity table for this product id. If we find something then we assume that the quantity is zero. If we find no records, we use the quantity from the product object.

Specified by:
getProductQuantity in interface ProductMgrIf
Parameters:
encodedProductId -
Returns:
Stock level
Throws:
java.lang.Exception

getProductQuantityWithOptions

public ProductQuantityIf getProductQuantityWithOptions(java.lang.String encodedProductId,
                                                       FetchProductOptionsIf options)
                                                throws java.lang.Exception
The stock level of the product is returned. An exception is thrown if the product doesn't exist or if the encoded product id has an invalid format. The format of the encoded product id is 1{2}3{4}5 where the product id = 1, the first optionId / valueId pair have ids of 2,3 and the 2nd optionId / valueId pair have ids of 4,5. If there are no option / value pairs then we use the stock level from the product object. If there is at least one option / value pair, we attempt to find the quantity in the product quantity table. If we can't find it in the product_quantity table we look for at least one record in the product_quantity table for this product id. If we find something then we assume that the quantity is zero. If we find no records, we use the quantity from the product object.

Specified by:
getProductQuantityWithOptions in interface ProductMgrIf
Parameters:
encodedProductId -
options -
Returns:
Stock level
Throws:
java.lang.Exception

createProductQuantityEncodedKeyFromOptions

public java.lang.String createProductQuantityEncodedKeyFromOptions(OptionIf[] opts)
Takes in an an array of options and returns an encoded key for the products_quantity table
The format of the encoded key for the products_quantity table is 3{4}4{6} which means product_options of id==3 and product_options_values of id==4 followed by product_options of id==4 and product_options_values of id==6. The order is very important since the product option ids must be in ascending order.

Specified by:
createProductQuantityEncodedKeyFromOptions in interface ProductMgrIf
Parameters:
opts -
Returns:
Returns the encoded key for the products_quantity table

createOptionsFromProductQuantityEncodedKey

public OptionIf[] createOptionsFromProductQuantityEncodedKey(java.lang.String encodedKey)
Receives an encoded key from the products_quantity table in the format 3{4}4{6} and creates an array of Option objects.

Specified by:
createOptionsFromProductQuantityEncodedKey in interface ProductMgrIf
Parameters:
encodedKey -
Returns:
Return an array of Option objects

createProductQuantityEncodedKeyFromEncodedProductId

public ProductQuantity createProductQuantityEncodedKeyFromEncodedProductId(java.lang.String encodedProductId)
                                                                    throws KKException
Takes in an encodedProductId and returns an encoded key for the products_quantity table
The format of the encoded product id is 1{2}3{4}5 where the product id = 1, the first optionId / valueId pair have ids of 2,3 and the 2nd optionId / valueId pair have ids of 4,5.
The format of the encoded key for the products_quantitytable is 3{4}4{6} which means product_options of id==3 and product_options_values of id==4 followed by product_options of id==4 and product_options_values of id==6. The order is very important since the product option ids must be in ascending order.

Specified by:
createProductQuantityEncodedKeyFromEncodedProductId in interface ProductMgrIf
Parameters:
encodedProductId -
Returns:
Returns the encoded key for the products_quantity table
Throws:
KKException

createEncodedProductIdFromProductQuantityEncodedKey

public java.lang.String createEncodedProductIdFromProductQuantityEncodedKey(int productId,
                                                                            java.lang.String productQuantityEncodedKey)
Takes in a productQuantityEncodedKey and a productId and returns an encoded product Id. for the products_quantity table
The format of the encoded product id is 1{2}3{4}5 where the product id = 1, the first optionId / valueId pair have ids of 2,3 and the 2nd optionId / valueId pair have ids of 4,5.
The format of the encoded key for the products_quantitytable is 3{4}4{6} which means product_options of id==3 and product_options_values of id==4 followed by product_options of id==4 and product_options_values of id==6. The order is very important since the product option ids must be in ascending order.

Specified by:
createEncodedProductIdFromProductQuantityEncodedKey in interface ProductMgrIf
Parameters:
productId -
productQuantityEncodedKey -
Returns:
Returns the encoded productId

getProductQuantityWithOptions

protected ProductQuantityIf getProductQuantityWithOptions(int productId,
                                                          FetchProductOptionsIf options)
                                                   throws java.lang.Exception
The stock level and available date of the product is returned assuming it has no attributes. An exception is thrown if the product doesn't exist.

Parameters:
productId -
options -
Returns:
Stock level
Throws:
java.lang.Exception

getProductQuantitiesPerProductWithOptions

protected ProductQuantityIf[] getProductQuantitiesPerProductWithOptions(int productId,
                                                                        FetchProductOptionsIf options)
                                                                 throws org.apache.torque.TorqueException,
                                                                        com.workingdogs.village.DataSetException,
                                                                        KKException
Return all of the product quantities associated with a product

Parameters:
productId -
options -
Returns:
Returns a ProductQuantityIf[]
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKException

getProductQuantityPerProductWithOptions

protected ProductQuantityIf getProductQuantityPerProductWithOptions(int productId,
                                                                    java.lang.String encodedOptionValues,
                                                                    FetchProductOptionsIf options)
                                                             throws org.apache.torque.TorqueException,
                                                                    com.workingdogs.village.DataSetException,
                                                                    KKException
Return all of the product quantities associated with a product

Parameters:
productId -
encodedOptionValues -
options -
Returns:
Returns a ProductQuantityIf object
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKException

getProductType

protected int getProductType(int productId)
                      throws org.apache.torque.TorqueException,
                             KKException,
                             com.workingdogs.village.DataSetException
Return the product type

Parameters:
productId -
Returns:
Returns the product type
Throws:
org.apache.torque.TorqueException
KKException
com.workingdogs.village.DataSetException

insertDigitalDownload

public int insertDigitalDownload(java.lang.String sessionId,
                                 int productId)
                          throws java.lang.Exception
Create and insert a digital download record for the product identified by the productId and the customer identified by the sessionId. If the digital download already exists, then we overwrite it with the new one.

Specified by:
insertDigitalDownload in interface ProductMgrIf
Parameters:
sessionId -
productId -
Returns:
Returns the id of the inserted Digital Download
Throws:
java.lang.Exception

insertDigitalDownload

public int insertDigitalDownload(int customerId,
                                 int productId)
                          throws java.lang.Exception
Create and insert a digital download record for the product identified by the productId and the customer identified by the customerId. If the digital download already exists, then we overwrite it with the new one.

Specified by:
insertDigitalDownload in interface ProductMgrIf
Parameters:
productId -
Returns:
Returns the id of the inserted Digital Download
Throws:
java.lang.Exception

insertGiftCertificateDigitalDownload

public int insertGiftCertificateDigitalDownload(int customerId,
                                                int productId,
                                                java.lang.String filePath)
                                         throws java.lang.Exception
Create and insert a digital download record for the product identified by the productId and the customer identified by the customerId. The file path of the digital download will be used instead of the file path in the product object, to download the certificate.

Specified by:
insertGiftCertificateDigitalDownload in interface ProductMgrIf
Parameters:
customerId -
productId -
filePath -
Returns:
Returns the id of the inserted Digital Download
Throws:
java.lang.Exception

getMaxDownloadDays

protected int getMaxDownloadDays(Product prod)
                          throws org.apache.torque.TorqueException,
                                 KKException,
                                 com.workingdogs.village.DataSetException,
                                 java.lang.Exception
Common code to get the maximum number of download days

Parameters:
prod -
Returns:
Returns the maximum number of download days
Throws:
org.apache.torque.TorqueException
KKException
com.workingdogs.village.DataSetException
java.lang.Exception

getExpiryDate

protected java.util.Date getExpiryDate(int maxDownloadDays)
Common code to get the expiry date

Parameters:
maxDownloadDays -
Returns:
Returns the expiry date

getMaxNumDownloads

protected int getMaxNumDownloads(Product prod)
                          throws org.apache.torque.TorqueException,
                                 KKException,
                                 com.workingdogs.village.DataSetException,
                                 java.lang.Exception
Common code to get the maximum number of downloads

Parameters:
prod -
Returns:
Returns the maximum number of downloads
Throws:
org.apache.torque.TorqueException
KKException
com.workingdogs.village.DataSetException
java.lang.Exception

getDigitalDownloads

public DigitalDownload[] getDigitalDownloads(java.lang.String sessionId)
                                      throws java.lang.Exception
Returns an array of Digital Download objects for the customer identified by the sessionId parameter. If the DD_DELETE_ON_EXPIRATION configuration variable is set to "true", then the objects read from the database that have expired are automatically deleted. This avoids having to maintain the database table.

Specified by:
getDigitalDownloads in interface ProductMgrIf
Parameters:
sessionId -
Returns:
Returns an array of DigitalDownload objects
Throws:
java.lang.Exception

getDigitalDownload

protected DigitalDownload getDigitalDownload(int customerId,
                                             int productId)
                                      throws KKException,
                                             org.apache.torque.TorqueException,
                                             com.workingdogs.village.DataSetException
Returns a Digital Download object for the customerId and productId passed in as parameters. Returns null if no object exists.

Parameters:
customerId -
productId -
Returns:
Returns an DigitalDownload object
Throws:
KKException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

getDigitalDownloadById

public DigitalDownload getDigitalDownloadById(java.lang.String sessionId,
                                              int digitalDownloadId)
                                       throws java.lang.Exception
Returns a Digital Download object for the digital download id. Returns null if no object exists.

Specified by:
getDigitalDownloadById in interface ProductMgrIf
Parameters:
sessionId -
digitalDownloadId -
Returns:
Returns an DigitalDownload object
Throws:
java.lang.Exception

getDigitalDownloadById

public DigitalDownload getDigitalDownloadById(int digitalDownloadId)
                                       throws KKException,
                                              org.apache.torque.TorqueException,
                                              com.workingdogs.village.DataSetException
Returns a Digital Download object for the digital download id. Returns null if no object exists.

Specified by:
getDigitalDownloadById in interface ProductMgrIf
Parameters:
digitalDownloadId -
Returns:
Returns an DigitalDownload object
Throws:
KKException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

editDigitalDownload

public void editDigitalDownload(java.lang.String sessionId,
                                DigitalDownloadIf digitalDownload)
                         throws java.lang.Exception
Edits the digital download object

Specified by:
editDigitalDownload in interface ProductMgrIf
Parameters:
sessionId -
digitalDownload -
Throws:
java.lang.Exception

editDigitalDownload

public void editDigitalDownload(DigitalDownloadIf digitalDownload)
                         throws KKException,
                                org.apache.torque.TorqueException,
                                com.workingdogs.village.DataSetException
Edits the digital download object

Specified by:
editDigitalDownload in interface ProductMgrIf
Parameters:
digitalDownload -
Throws:
KKException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

setDigitalDownloadCriteria

protected void setDigitalDownloadCriteria(KKCriteria c)
                                   throws KKException
Sets the criteria with the standard attributes so as not to have to repeat this code many times.

Parameters:
c -
Throws:
KKException

updateDigitalDownloadCount

public int updateDigitalDownloadCount(java.lang.String sessionId,
                                      int productId)
                               throws java.lang.Exception
Updates the count of the Digital Download that defines how many times it has been downloaded.

Specified by:
updateDigitalDownloadCount in interface ProductMgrIf
Parameters:
sessionId -
productId -
Returns:
Returns the new count
Throws:
java.lang.Exception

updateDigitalDownloadCountById

public int updateDigitalDownloadCountById(java.lang.String sessionId,
                                          int digitalDownloadId)
                                   throws java.lang.Exception
Updates the count of the Digital Download (identified by id) that defines how many times it has been downloaded. This is used when there may be many digital downloads for the same product pointing to different files. i.e. Tickets

Specified by:
updateDigitalDownloadCountById in interface ProductMgrIf
Parameters:
sessionId -
digitalDownloadId -
Returns:
Returns the new count
Throws:
java.lang.Exception

deleteDigitalDownload

protected void deleteDigitalDownload(DigitalDownload dd)
                              throws org.apache.torque.TorqueException,
                                     KKException
Deletes the digital download passed in as a parameter

Parameters:
dd -
Throws:
org.apache.torque.TorqueException
KKException

validateDigitalDownload

protected Product validateDigitalDownload(int productId)
                                   throws java.lang.Exception
Validate the digital download productId

Parameters:
productId -
Returns:
the product if it's a digital download product or a gift certificate product otherwise an exception is thrown
Throws:
java.lang.Exception

getPriceId

public int getPriceId(Customer cust)
Get the priceId from the customer

Specified by:
getPriceId in interface ProductMgrIf
Parameters:
cust -
Returns:
Returns the priceId

setProductPrice

protected void setProductPrice(Product prod,
                               int priceId)
                        throws KKException
Edit the product to use the correct price based on the price Id

Parameters:
prod -
priceId -
Throws:
KKException

setOptionPrice

protected void setOptionPrice(Option opt,
                              Product prod,
                              int productId,
                              int priceId)
                       throws KKException,
                              org.apache.torque.TorqueException,
                              com.workingdogs.village.DataSetException
Edit the product option to use the correct price based on the price Id

Parameters:
opt -
prod -
productId -
priceId -
Throws:
KKException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

getBundleProductQuantityWithOptions

protected ProductQuantityIf getBundleProductQuantityWithOptions(int productId,
                                                                FetchProductOptionsIf options)
                                                         throws java.lang.Exception
Get the quantity and date available of a bundle product. We don't require the options of a bundle product since these don't affect the products that are part of the bundle.

Parameters:
productId -
options -
Returns:
The quantity available of a bundle product
Throws:
java.lang.Exception

getTagGroupsPerCategory

public TagGroup[] getTagGroupsPerCategory(int categoryId,
                                          boolean getProdCount,
                                          int languageId)
                                   throws java.lang.Exception
Return an array of TagGroup objects for a category. Each TagGroup is populated with an array of Tags which are sorted first by sort order and then by name. An empty array is returned if no TagGroup objects exist.

Specified by:
getTagGroupsPerCategory in interface ProductMgrIf
Parameters:
categoryId -
getProdCount -
languageId -
Returns:
Returns an array of TagGroup objects
Throws:
java.lang.Exception

getTagsPerCategory

public TagIf[] getTagsPerCategory(int categoryId,
                                  boolean getProdCount,
                                  int languageId)
                           throws java.lang.Exception
Return an array of Tag objects for a category. An empty array is returned if no Tag objects exist. The Tags are sorted first by sort order and then by name.

Specified by:
getTagsPerCategory in interface ProductMgrIf
Parameters:
categoryId -
getProdCount -
languageId -
Returns:
Returns an array of Tag objects
Throws:
java.lang.Exception

getTagGroup

public TagGroupIf getTagGroup(int tagGroupId,
                              boolean getProdCount,
                              int languageId)
                       throws java.lang.Exception
Returns a TagGroup object for the id passed in as a parameter. The TagGroup is populated with an array of Tags which are sorted first by sort order and then by name. Null is returned if the TagGroup object doesn't exist.

Specified by:
getTagGroup in interface ProductMgrIf
Parameters:
tagGroupId -
getProdCount -
languageId -
Returns:
Returns a TagGroup object
Throws:
java.lang.Exception

getTag

public TagIf getTag(int tagId,
                    boolean getProdCount,
                    int languageId)
             throws java.lang.Exception
Returns a Tag object for the id passed in as a parameter.

Specified by:
getTag in interface ProductMgrIf
Parameters:
tagId -
getProdCount -
languageId -
Returns:
Returns a Tag object
Throws:
java.lang.Exception

getTagsPerTagGroup

protected TagIf[] getTagsPerTagGroup(int tagGroupId,
                                     boolean getProdCount,
                                     int languageId)
                              throws com.workingdogs.village.DataSetException,
                                     org.apache.torque.TorqueException,
                                     KKException
Returns an array of Tags for a TagGroup

Parameters:
tagGroupId -
getProdCount -
languageId -
Returns:
Returns an array of Tags
Throws:
com.workingdogs.village.DataSetException
org.apache.torque.TorqueException
KKException

synchronizeTagProductCount

protected void synchronizeTagProductCount()
                                   throws org.apache.torque.TorqueException,
                                          com.workingdogs.village.DataSetException,
                                          KKException
We save the product count for each tag, in a hash table. The hash table is only ever cleared when we detect that a new mapping has been added or that an existing one has been deleted.

Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKException

getLastAddedDateFromTagToProduct

protected java.util.Date getLastAddedDateFromTagToProduct()
                                                   throws com.workingdogs.village.DataSetException,
                                                          org.apache.torque.TorqueException,
                                                          KKException
Get the last date added for a tag to product record

Returns:
Returns the last date added for a tag to product record
Throws:
com.workingdogs.village.DataSetException
org.apache.torque.TorqueException
KKException

getTagToProductCount

protected int getTagToProductCount()
                            throws com.workingdogs.village.DataSetException,
                                   org.apache.torque.TorqueException,
                                   KKException
Get the number of records in the tag to product table

Returns:
Returns the number of records in the tag to product tables
Throws:
com.workingdogs.village.DataSetException
org.apache.torque.TorqueException
KKException

getProductCountForTag

protected void getProductCountForTag(TagIf tag)
                              throws com.workingdogs.village.DataSetException,
                                     org.apache.torque.TorqueException,
                                     KKException
Get the number of products for a tag and add the number to the tag object

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

setTagCriteriaWithStandardAttributes

protected void setTagCriteriaWithStandardAttributes(KKCriteria c,
                                                    int languageId)
Set the Criteria attribute with standard attributes for a Tag object

Parameters:
c -
languageId -

setTagGroupCriteriaWithStandardAttributes

protected void setTagGroupCriteriaWithStandardAttributes(KKCriteria c,
                                                         int languageId)
Set the Criteria attribute with standard attributes for a TagGroup object

Parameters:
c -
languageId -

getProductReorderLevel

public int getProductReorderLevel(int productId)
                           throws org.apache.torque.TorqueException,
                                  com.workingdogs.village.DataSetException,
                                  KKException
Return the re-order level of the product.

Specified by:
getProductReorderLevel in interface ProductMgrIf
Parameters:
productId -
Returns:
Returns the re-order level of the product.
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKException

doesProductExist

public boolean doesProductExist(int productId)
                         throws org.apache.torque.TorqueException,
                                com.workingdogs.village.DataSetException,
                                KKException
Figure out whether a product exists

Specified by:
doesProductExist in interface ProductMgrIf
Parameters:
productId -
Returns:
Returns true if the product exists
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKException

getPaymentScheduleId

public int getPaymentScheduleId(int productId)
                         throws org.apache.torque.TorqueException,
                                KKException,
                                com.workingdogs.village.DataSetException
Description copied from interface: ProductMgrIf
A utility method to return just the Payment Schedule Id from a product to determine whether it requires recurring billing.

Specified by:
getPaymentScheduleId in interface ProductMgrIf
Parameters:
productId -
Returns:
Returns the PaymentSchedule Id
Throws:
org.apache.torque.TorqueException
KKException
com.workingdogs.village.DataSetException

getProductPerSku

public Product getProductPerSku(java.lang.String sessionId,
                                java.lang.String sku,
                                int languageId)
                         throws java.lang.Exception
Get a product from its SKU. If the SKU refers to a particular configuration of the product (i.e. Blue shirt, size small) then the product object is only populated with the options that match the SKU.

Specified by:
getProductPerSku in interface ProductMgrIf
Parameters:
sessionId -
sku -
languageId -
Returns:
Return the product
Throws:
java.lang.Exception

getProductPerSkuWithOptions

public Product getProductPerSkuWithOptions(java.lang.String sessionId,
                                           java.lang.String sku,
                                           int languageId,
                                           FetchProductOptionsIf options)
                                    throws java.lang.Exception
Get a product from its SKU. If the SKU refers to a particular configuration of the product (i.e. Blue shirt, size small) then the product object is only populated with the options that match the SKU.

Specified by:
getProductPerSkuWithOptions in interface ProductMgrIf
Parameters:
sessionId -
sku -
languageId -
options -
Returns:
Return the product
Throws:
java.lang.Exception

doesExtQuantityExist

protected boolean doesExtQuantityExist(int productId,
                                       java.lang.String encodedOptionValues,
                                       java.lang.String catalogId,
                                       KKCriteria selectC)
                                throws org.apache.torque.TorqueException
Returns true if the external quantity record exists

Parameters:
productId -
encodedOptionValues -
catalogId -
selectC -
Returns:
Return true if the external quantity record exists
Throws:
org.apache.torque.TorqueException

insertExtQuantity

protected void insertExtQuantity(int productId,
                                 java.lang.String encodedOptionValues,
                                 int quantity,
                                 java.lang.String catalogId,
                                 KKCriteria insertC)
                          throws org.apache.torque.TorqueException
Used to insert a quantity in the external quantity table.

Parameters:
productId -
encodedOptionValues -
quantity -
catalogId -
insertC -
Throws:
org.apache.torque.TorqueException

editExtQuantity

protected void editExtQuantity(int productId,
                               java.lang.String encodedOptionValues,
                               int quantity,
                               java.lang.String catalogId,
                               KKCriteria selectC,
                               KKCriteria updateC)
                        throws org.apache.torque.TorqueException
Used to edit a quantity in the external quantity table.

Parameters:
productId -
encodedOptionValues -
quantity -
catalogId -
selectC -
updateC -
Throws:
org.apache.torque.TorqueException

getAddressesPerProduct

public Address[] getAddressesPerProduct(int productId)
                                 throws java.lang.Exception
Returns all of the addresses for the given product.

Specified by:
getAddressesPerProduct in interface ProductMgrIf
Parameters:
productId -
Returns:
An array of address objects ordered by primary address(es) first
Throws:
java.lang.Exception

refreshConfigs

public void refreshConfigs()
                    throws java.lang.Exception
Refresh the configuration of the product manager

Specified by:
refreshConfigs in interface ProductMgrIf
Throws:
java.lang.Exception

getCustomAttrsFromXML

public ProdCustAttr[] getCustomAttrsFromXML(java.lang.String xml)
Create an array of custom attributes from the XML

Parameters:
xml - The custom attribute data in xml format
Returns:
Returns an array of AdminProdAttrDesc objects

sendQuery

protected java.util.List<com.workingdogs.village.Record> sendQuery(java.lang.String sessionId,
                                                                   java.lang.String apiCall,
                                                                   KKCriteria criteria,
                                                                   DataDescriptorIf dataDesc,
                                                                   ProductSearchIf prodSearch,
                                                                   int languageId,
                                                                   boolean fixQuery)
                                                            throws java.lang.Exception
Common code to send a query string

Parameters:
sessionId -
apiCall -
criteria -
dataDesc -
prodSearch -
fixQuery -
languageId -
Returns:
Returns a list of Record objects
Throws:
java.lang.Exception

beforeSendQuery

protected java.lang.String beforeSendQuery(java.lang.String sessionId,
                                           java.lang.String apiCall,
                                           java.lang.String queryString,
                                           DataDescriptorIf dataDesc,
                                           ProductSearchIf prodSearch,
                                           int languageId)
                                    throws java.lang.Exception
Method that can be used to customize the query string before being sent to the database.

Parameters:
sessionId - The sessionId of the logged in user
apiCall - Name of the Api call sending the query
queryString - Query string that will be sent to the database
dataDesc - DataDescriptor object
prodSearch - ProductSearch object which may be null
languageId - Language id
Returns:
Returns the customized query string
Throws:
java.lang.Exception

beforeSendCriteria

protected KKCriteria beforeSendCriteria(java.lang.String sessionId,
                                        java.lang.String apiCall,
                                        KKCriteria criteria,
                                        DataDescriptorIf dataDesc,
                                        ProductSearchIf prodSearch,
                                        int languageId)
                                 throws java.lang.Exception
Method that can be used to customize the KKCriteria object before it is used to create the query string that is sent to the database.

Parameters:
sessionId - The sessionId of the logged in user
apiCall - Name of the Api call sending the query
criteria - KKCriteria object that will be used to create the query string
dataDesc - DataDescriptor object
prodSearch - ProductSearch object which may be null
languageId - Language id
Returns:
Returns the customized Torque Criteria
Throws:
java.lang.Exception

isCustomAttrAnOracleCLOB

public static boolean isCustomAttrAnOracleCLOB()
Is the custom_attrs column is an Oracle CLOB? We only check once and save the result in a static variable.

Returns:
the customAttrAnOracleCLOB


Copyright © 2011 DS Data Systems UK Ltd.