com.konakart.blif
Interface ProductMgrIf

All Known Implementing Classes:
ProductMgr

public interface ProductMgrIf

ProductMgrIf Interface which an implementation of this manager must adhere to.


Method Summary
 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_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.
 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 and checks that it belongs to the customer identified by the sessionId.
 Address[] getAddressesPerProduct(int productId)
          Gets an array of Address objects that have been defined for the product referenced by the productId.
 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)
          Returns an array of bestseller products for the category and its children.
 Product[] getBestSellersWithOptions(DataDescriptorIf dataDesc, int categoryId, int languageId, FetchProductOptionsIf options)
          Returns an array of bestseller products for the category and its children.
 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.
 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.
 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.
 ProductQuantityIf getProductQuantity(java.lang.String encodedProductId)
          The stock level and date available of the product is returned.
 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.
 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.
 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.
 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.
 java.lang.String getSku(OrderProductIf orderProd)
          Get the SKU for an orderProduct object.
 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.
 int getTaxClassId(int productId)
          Returns the tax class id for a product
 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.
 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.
 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.
 Products searchForProductsWithOptions(java.lang.String sessionId, DataDescriptorIf dataDesc, ProductSearchIf prodSearch, int languageId, FetchProductOptionsIf options)
          Returns products matching the search criteria.
 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.
 

Method Detail

getProductsPerCategory

Products getProductsPerCategory(java.lang.String sessionId,
                                DataDescriptorIf dataDesc,
                                int categoryId,
                                boolean searchInSubCats,
                                int languageId)
                                throws java.lang.Exception
Returns the products for a category

Parameters:
sessionId -
dataDesc -
categoryId -
searchInSubCats -
languageId -
Returns:
Products object
Throws:
java.lang.Exception

getProductsPerCategoryWithOptions

Products getProductsPerCategoryWithOptions(java.lang.String sessionId,
                                           DataDescriptorIf dataDesc,
                                           int categoryId,
                                           boolean searchInSubCats,
                                           int languageId,
                                           FetchProductOptionsIf options)
                                           throws java.lang.Exception
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.

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

getProductsPerCategoryPerManufacturer

Products getProductsPerCategoryPerManufacturer(java.lang.String sessionId,
                                               DataDescriptorIf dataDesc,
                                               int categoryId,
                                               int manufacturerId,
                                               int languageId)
                                               throws java.lang.Exception
Returns the products for a category and a manufacturer

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

getProductsPerCategoryPerManufacturerWithOptions

Products getProductsPerCategoryPerManufacturerWithOptions(java.lang.String sessionId,
                                                          DataDescriptorIf dataDesc,
                                                          int categoryId,
                                                          int manufacturerId,
                                                          int languageId,
                                                          FetchProductOptionsIf options)
                                                          throws java.lang.Exception
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.

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

getAllProducts

Products getAllProducts(java.lang.String sessionId,
                        DataDescriptorIf dataDesc,
                        int languageId)
                        throws java.lang.Exception
Returns all products

Parameters:
sessionId -
dataDesc -
languageId -
Returns:
Products object
Throws:
java.lang.Exception

getAllProductsWithOptions

Products getAllProductsWithOptions(java.lang.String sessionId,
                                   DataDescriptorIf dataDesc,
                                   int languageId,
                                   FetchProductOptionsIf options)
                                   throws java.lang.Exception
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.

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

getProductsPerManufacturer

Products getProductsPerManufacturer(java.lang.String sessionId,
                                    DataDescriptorIf dataDesc,
                                    int manufacturerId,
                                    int languageId)
                                    throws java.lang.Exception
Returns the products for a manufacturer

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

getProductsPerManufacturerWithOptions

Products getProductsPerManufacturerWithOptions(java.lang.String sessionId,
                                               DataDescriptorIf dataDesc,
                                               int manufacturerId,
                                               int languageId,
                                               FetchProductOptionsIf options)
                                               throws java.lang.Exception
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.

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

getTaxClassId

int getTaxClassId(int productId)
                  throws org.apache.torque.TorqueException,
                         KKException,
                         com.workingdogs.village.DataSetException
Returns the tax class id for a product

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

getProduct

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

Parameters:
sessionId -
productId -
languageId -
Returns:
Returns a product object with full details
Throws:
java.lang.Exception

getProductWithOptions

Product getProductWithOptions(java.lang.String sessionId,
                              int productId,
                              int languageId,
                              FetchProductOptionsIf options)
                              throws java.lang.Exception
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.

Parameters:
sessionId -
productId -
languageId -
options -
Returns:
Returns a product object with full details
Throws:
java.lang.Exception

getProduct

Product getProduct(int customerId,
                   int productId,
                   int languageId)
                   throws java.lang.Exception
Fetches a fully populated product object for a customer referenced by customerId.

Parameters:
customerId -
productId -
languageId -
Returns:
Returns a product object
Throws:
java.lang.Exception

getProductWithOptions

Product getProductWithOptions(int customerId,
                              int productId,
                              int languageId,
                              FetchProductOptionsIf options)
                              throws java.lang.Exception
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.

Parameters:
customerId -
productId -
languageId -
options -
Returns:
Returns a product object
Throws:
java.lang.Exception

updateProductViewedCount

void updateProductViewedCount(int productId,
                              int languageId)
                              throws java.lang.Exception
Increments the viewed count for the product.

Parameters:
productId -
languageId -
Throws:
java.lang.Exception

getAllSpecials

Products getAllSpecials(java.lang.String sessionId,
                        DataDescriptorIf dataDesc,
                        int languageId)
                        throws java.lang.Exception
Returns all special priced products

Parameters:
sessionId -
dataDesc -
languageId -
Returns:
Array of products
Throws:
java.lang.Exception

getSpecialsPerCategory

Products getSpecialsPerCategory(java.lang.String sessionId,
                                DataDescriptorIf dataDesc,
                                int categoryId,
                                boolean searchInSubCats,
                                int languageId)
                                throws java.lang.Exception
Returns all special priced products for a category

Parameters:
sessionId -
dataDesc -
categoryId -
searchInSubCats -
languageId -
Returns:
Return an array of products
Throws:
java.lang.Exception

getProductsFromIds

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.

Parameters:
sessionId -
prodIdList -
languageId -
Returns:
An array of products
Throws:
java.lang.Exception

getProductsFromIdsWithOptions

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. An options object is passed in to customize from where some of the product attributes (such as price and quantity) are fetched from.

Parameters:
sessionId -
prodIdList -
languageId -
options -
Returns:
An array of products
Throws:
java.lang.Exception

getProductsFromIdsWithOptions

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. An options object is passed in to customize from where some of the product attributes (such as price and quantity) are fetched from.

Parameters:
sessionId -
dataDesc -
prodIdArray -
languageId -
options -
Returns:
An array of products
Throws:
java.lang.Exception

searchForProducts

Products searchForProducts(java.lang.String sessionId,
                           DataDescriptorIf dataDesc,
                           ProductSearchIf prodSearch,
                           int languageId)
                           throws java.lang.Exception
Returns products matching the search criteria.

Parameters:
sessionId -
dataDesc -
prodSearch -
languageId -
Returns:
Return a Products object
Throws:
java.lang.Exception

searchForProductsWithOptions

Products searchForProductsWithOptions(java.lang.String sessionId,
                                      DataDescriptorIf dataDesc,
                                      ProductSearchIf prodSearch,
                                      int languageId,
                                      FetchProductOptionsIf options)
                                      throws java.lang.Exception
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.

Parameters:
sessionId -
dataDesc -
prodSearch -
languageId -
options -
Returns:
Return a Products object
Throws:
java.lang.Exception

getOption

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.

Parameters:
productId -
optionId -
optionValueId -
priceId -
languageId -
options -
Returns:
Returns an Option object or null if not found
Throws:
java.lang.Exception

getBestSellers

Product[] getBestSellers(DataDescriptorIf dataDesc,
                         int categoryId,
                         int languageId)
                         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.

Parameters:
dataDesc -
categoryId -
languageId -
Returns:
An array of products
Throws:
java.lang.Exception

getBestSellersWithOptions

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. An options object is passed in to customize from where some of the product attributes (such as price and quantity) are fetched from.

Parameters:
dataDesc -
categoryId -
languageId -
options -
Returns:
An array of products
Throws:
java.lang.Exception

getOrderHistory

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

Parameters:
dataDesc -
sessionId -
languageId -
Returns:
Returns a list of products
Throws:
java.lang.Exception

getOrderHistoryWithOptions

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. An options object is passed in to customize from where some of the product attributes (such as price and quantity) are fetched from.

Parameters:
dataDesc -
sessionId -
languageId -
options -
Returns:
Returns a list of products
Throws:
java.lang.Exception

getAlsoPurchased

Product[] getAlsoPurchased(java.lang.String sessionId,
                           DataDescriptorIf dataDesc,
                           int productId,
                           int languageId)
                           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.

Parameters:
sessionId -
dataDesc -
productId -
languageId -
Returns:
Array of products
Throws:
java.lang.Exception

getAlsoPurchasedWithOptions

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. An options object is passed in to customize from where some of the product attributes (such as price and quantity) are fetched from.

Parameters:
sessionId -
dataDesc -
productId -
languageId -
options -
Returns:
Array of products
Throws:
java.lang.Exception

getRelatedProducts

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:

Parameters:
sessionId -
dataDesc -
productId -
relationType -
languageId -
Returns:
A products object
Throws:
java.lang.Exception

getRelatedProductsWithOptions

Products getRelatedProductsWithOptions(java.lang.String sessionId,
                                       DataDescriptorIf dataDesc,
                                       int productId,
                                       int relationType,
                                       int languageId,
                                       FetchProductOptionsIf options)
                                       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: An options object is passed in to customize from where some of the product attributes (such as price and quantity) are fetched from.

Parameters:
sessionId -
dataDesc -
productId -
relationType -
languageId -
options -
Returns:
A products object
Throws:
java.lang.Exception

getSku

java.lang.String getSku(OrderProductIf orderProd)
                        throws KKException,
                               org.apache.torque.TorqueException,
                               com.workingdogs.village.DataSetException
Get the SKU for an orderProduct object. If it has no options we look directly for the SKU in the product table. Otherwise we look in the productQuantities table. If we can't find it there, then we look in the product table.

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

updateProductQuantity

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.

Parameters:
productId -
opts -
quantitySold -
setStatus -
Returns:
The new quantity
Throws:
java.lang.Exception

updateProductQuantity

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.

Parameters:
productId -
opts -
encodedOptions -
quantitySold -
setStatus -
Returns:
The new quantity
Throws:
java.lang.Exception

updateProductQuantityWithOptions

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. An options object is passed in to customize where the quantity is stored. This could be in an external table.

Parameters:
productId -
opts -
encodedOptions -
quantitySold -
setStatus -
options -
Returns:
The new quantity
Throws:
java.lang.Exception

getProductQuantity

ProductQuantityIf getProductQuantity(java.lang.String encodedProductId)
                                     throws java.lang.Exception
The stock level and date available 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.

Parameters:
encodedProductId -
Returns:
Product Quantity object containing the Stock level and available date
Throws:
java.lang.Exception

insertDigitalDownload

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.

Parameters:
sessionId -
productId -
Returns:
Returns the id of the inserted Digital Download
Throws:
java.lang.Exception

insertDigitalDownload

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.

Parameters:
customerId -
productId -
Returns:
Returns the id of the inserted Digital Download
Throws:
java.lang.Exception

getDigitalDownloads

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.

Parameters:
sessionId -
Returns:
Returns an array of DigitalDownload objects
Throws:
java.lang.Exception

updateDigitalDownloadCount

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.

Parameters:
sessionId -
productId -
Returns:
Returns the new count
Throws:
java.lang.Exception

updateDigitalDownloadCountById

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

Parameters:
sessionId -
digitalDownloadId -
Returns:
Returns the new count
Throws:
java.lang.Exception

getPriceId

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

Parameters:
cust -
Returns:
Returns the priceId

getTagGroupsPerCategory

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.

Parameters:
categoryId -
getProdCount -
languageId -
Returns:
Returns an array of TagGroup objects
Throws:
java.lang.Exception

getTagsPerCategory

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.

Parameters:
categoryId -
getProdCount -
languageId -
Returns:
Returns an array of Tag objects
Throws:
java.lang.Exception

getTagGroup

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.

Parameters:
tagGroupId -
getProdCount -
languageId -
Returns:
Returns a TagGroup object
Throws:
java.lang.Exception

getTag

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

Parameters:
tagId -
getProdCount -
languageId -
Returns:
Returns a Tag object
Throws:
java.lang.Exception

createEncodedProductIdFromProductQuantityEncodedKey

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.

Parameters:
productId -
productQuantityEncodedKey -
Returns:
Returns the encoded productId

createProductQuantityEncodedKeyFromEncodedProductId

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.

Parameters:
encodedProductId -
Returns:
Returns the encoded key for the products_quantity table
Throws:
KKException

createProductQuantityEncodedKeyFromOptions

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_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.

Parameters:
opts -
Returns:
Returns the encoded key for the products_quantity table

getProductReorderLevel

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

Parameters:
productId -
Returns:
Returns the re-order level of the product.
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKException

getProductQuantityWithOptions

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. An options object is passed in to customize from where some of the product attributes (such as price and quantity) are fetched from.

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

doesProductExist

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

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

insertGiftCertificateDigitalDownload

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.

Parameters:
customerId -
productId -
filePath -
Returns:
Returns the key of the inserted Digital Download
Throws:
java.lang.Exception

getPaymentScheduleId

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

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

getProductPerSkuWithOptions

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.

Parameters:
sessionId -
sku -
languageId -
options -
Returns:
Return the product
Throws:
java.lang.Exception

getProductPerSku

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.

Parameters:
sessionId -
sku -
languageId -
Returns:
Return the product
Throws:
java.lang.Exception

editDigitalDownload

void editDigitalDownload(java.lang.String sessionId,
                         DigitalDownloadIf digitalDownload)
                         throws java.lang.Exception
Edits the digital download object and checks that it belongs to the customer identified by the sessionId.

Parameters:
sessionId -
digitalDownload -
Throws:
java.lang.Exception

editDigitalDownload

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

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

getDigitalDownloadById

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. A check is made to verify that the digital download object belongs to the customer identified by the sessionId.

Parameters:
sessionId -
digitalDownloadId -
Returns:
Returns a DigitalDownload object
Throws:
java.lang.Exception

getDigitalDownloadById

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.

Parameters:
digitalDownloadId -
Returns:
Returns a DigitalDownload object
Throws:
KKException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

getAddressesPerProduct

Address[] getAddressesPerProduct(int productId)
                                 throws java.lang.Exception
Gets an array of Address objects that have been defined for the product referenced by the productId. The primary address(es) are first in the list.

Parameters:
productId -
Returns:
Returns an array of Address objects
Throws:
java.lang.Exception

refreshConfigs

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

Throws:
java.lang.Exception

createOptionsFromProductQuantityEncodedKey

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.

Parameters:
encodedKey -
Returns:
Return an array of Option objects


Copyright © 2011 DS Data Systems UK Ltd.