Class BasicProductProcessor
- All Implemented Interfaces:
BusinessObject
,BusinessProcessor
,ProductProcessor
BasicProductProcessor
is the default implementation of the
ProductProcessor
interface for the application.- Author:
- David Tobey
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddProduct
(Map parameters) protected void
appendToCategoryMap
(Map categoryMap, Collection categories) buildMatrix
(Product product) buildMatrix
(Product product, Integer attributeLimit, List<Integer> includedAttributeIDs, List<Integer> includedOptionIds) boolean
buildMatrix
(Collection matrix, Collection options, Collection attributes, Product product, Integer attributeLimit, List<Integer> includedAttributeIDs, List<Integer> includedOptionIds) cloneProduct
(Map parameters) createCategoryMapFromCategoryTree
(Collection categoryTree) deleteProduct
(Map parameters) duplicateAttribute
(Attribute attribute, Map parameters) duplicateProduct
(Product product, Map parameters) editDeleteProducts
(Map parameters) editProduct
(Map parameters) editProductAssignment
(Map parameters) generateSettingsMap
(Collection settings) getAllAttributesAndOptions
(int productID) getCategoryFromCode
(Category category) Retrieves category information from the database.getCategoryFromCode
(Category category, boolean loadProducts) Retrieves category information from the database.getProductFromCode
(Product product) Retrieves product information from the database.getProductFromSeoCode
(Product product) Retrieves product information from the database.getProductList
(ProductList productList) Retrieves information for a list of products from the database.Retrieves all SKUs associated with attributes but not products, as a Collection of SKUs.Retrieves all SKUs associated with attributes but not products.Retrieves aCollection
containing built-in categories for the store.loadCategories
(String categoryList) Retrieves aCollection
containing categories corresponding to the codes of the argument.Retrieves aCollection
representing the store's category tree.int
loadProductFromCode
(Product product) loadProductFromCode
(String code) loadProductFromCode
(Map parameters) loadProductFromID
(int productID) loadProductFromID
(Map parameters) loadProductsAndCount
(Map parameters) loadProductsForIndexing
(int firstProductID, int lastProductID) loadSettings
(Map parameters) postChangingProductEvent
(Product product, Map parameters) processSettings
(Map parameters) sortProductsByCode
(Map parameters) sortProductsByName
(Map parameters) validateProduct
(Product product) Methods inherited from class com.softslate.commerce.businessobjects.core.BaseBusinessProcessor
formatDateTime, formatPrice, getAppComponents, getAppSettings, getAttributeIDs, getBusinessObjectFactory, getDaoFactory, getEventBus, getInjector, getProductIDs, getSettings, getUser, initialize, isProcessorClassActive, loadMatchingSkus, parseDateTime, parseResponseData, prepareRequestData, sendHTTPGet, sendHTTPPost, sendHTTPPost, setAppComponents, setAppSettings, setBusinessObjectFactory, setDaoFactory, setEventBus, setInjector, setSettings, setUser, updateOrderTotals, updateOrderTotals, updateOrderTotals, utils
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.softslate.commerce.businessobjects.core.BusinessObject
initialize
-
Field Details
-
log
static org.apache.commons.logging.Log log
-
-
Constructor Details
-
BasicProductProcessor
public BasicProductProcessor()
-
-
Method Details
-
loadCategoryTree
Description copied from interface:ProductProcessor
Retrieves aCollection
representing the store's category tree. Each item in theCollection
is an instance ofCategory
, which corresponds to each one of the "top level" categories defined in the store (i.e., categories whoseparentCategory
property isnull
). To render the tree, iterate through the top level categories and recursively navigate through each of theirsubcategoryCollection
s in turn.The default implementation of this method calls
ProductGatewayDAOHibernate.loadCategoryTree()
, which usesHibernate.initialize(java.lang.Object)
to pull the entire tree from the database non-lazily.- Specified by:
loadCategoryTree
in interfaceProductProcessor
- Returns:
- A
Collection
representing the store's category tree. - Throws:
Exception
-
createCategoryMapFromCategoryTree
- Specified by:
createCategoryMapFromCategoryTree
in interfaceProductProcessor
-
appendToCategoryMap
-
loadBuiltInCategories
Description copied from interface:ProductProcessor
Retrieves aCollection
containing built-in categories for the store. Each item in theCollection
is an instance ofCategory
. Built-in categories are typically composed of specials or other featured products that need to displayed on arbitrary pages thoughout the store.Built-in categories are definined by the "builtInCategories" setting in the
sscSetting
database table, a comma-separated list of category codes.- Specified by:
loadBuiltInCategories
in interfaceProductProcessor
- Returns:
- A
Collection
ofCategory
objects representing the store's built-in categories. - Throws:
Exception
-
loadCategories
Description copied from interface:ProductProcessor
Retrieves aCollection
containing categories corresponding to the codes of the argument. Each item in theCollection
is an instance ofCategory
. This method is used to populate the 'headerCategoriesAndContentPages' and 'footerCategoriesAndContentPages' - the categories that appear as links in the header and footer of the store.- Specified by:
loadCategories
in interfaceProductProcessor
- Returns:
- A
Collection
ofCategory
objects representing the store's built-in categories. - Throws:
Exception
-
getProductFromCode
Description copied from interface:ProductProcessor
Retrieves product information from the database. In the default implementation, this method callsProductDAO.loadProduct()
to populate the incomingProduct
using itscode
.- Specified by:
getProductFromCode
in interfaceProductProcessor
- Parameters:
product
- AProduct
object whosecode
property has been populated.- Returns:
- A
Product
object with all its properties populated from the database. If the product does not exist in the database,null
. - Throws:
Exception
-
getProductFromSeoCode
Description copied from interface:ProductProcessor
Retrieves product information from the database. In the default implementation, this method callsProductDAO.loadProductFromSeoCode()
to populate the incomingProduct
using itsseoCode
.- Specified by:
getProductFromSeoCode
in interfaceProductProcessor
- Parameters:
product
- AProduct
object whoseseoCode
property has been populated.- Returns:
- A
Product
object with all its properties populated from the database. If the product does not exist in the database,null
. - Throws:
Exception
-
loadAttributeSKUs
Description copied from interface:ProductProcessor
Retrieves all SKUs associated with attributes but not products.- Specified by:
loadAttributeSKUs
in interfaceProductProcessor
- Returns:
- A
Map
of all theSKU
s in the system associated with attributes but not products. - Throws:
Exception
-
loadAttributeSKUCollection
Description copied from interface:ProductProcessor
Retrieves all SKUs associated with attributes but not products, as a Collection of SKUs.- Specified by:
loadAttributeSKUCollection
in interfaceProductProcessor
- Returns:
- A
Collection
of all theSKU
s in the system associated with attributes but not products. - Throws:
Exception
-
getCategoryFromCode
Description copied from interface:ProductProcessor
Retrieves category information from the database. In the default implementation, this method calls getCategoryFromCode(Category category, boolean loadProducts) with the loadProducts parameter set to true. category tree.- Specified by:
getCategoryFromCode
in interfaceProductProcessor
- Parameters:
category
- ACategory
object whosecode
property has been populated.- Returns:
- A
Category
object with all its properties populated from the database. If the category does not exist in the database,null
. - Throws:
Exception
-
getCategoryFromCode
Description copied from interface:ProductProcessor
Retrieves category information from the database. In the default implementation, this method callsCategoryDAO.loadCategory()
to populate the incomingCategory
using itscode
.If the loadProducts parameter is set to true, in addition to all of the category's regular properties, its
productListCollection
is populated with just thoseProduct
s falling on the current page being displayed. The paging parameters for the number of items to display and which page to display come from the incomingCategory
'sitemsPerPage
andfirstRow
properties, respectively.The method
ProductGatewayDAO.loadProductList(ProductList)
is used to pull in the category's products.Also in the default implementation, the
Category
'sparentCollection
andparentString
properties are set by callingCategoryDAO.loadParents()
. These properties are used in breadcrumbing and in the display of the category tree.- Specified by:
getCategoryFromCode
in interfaceProductProcessor
- Parameters:
category
- ACategory
object whosecode
property has been populated.loadProducts
- If set to true, the category's products will be loaded into the category'sproductListCollection
property.- Returns:
- A
Category
object with all its properties populated from the database. If the category does not exist in the database,null
. - Throws:
Exception
-
generateSettingsMap
- Specified by:
generateSettingsMap
in interfaceProductProcessor
- Throws:
Exception
-
getAllAttributesAndOptions
- Specified by:
getAllAttributesAndOptions
in interfaceProductProcessor
- Throws:
Exception
-
getProductList
Description copied from interface:ProductProcessor
Retrieves information for a list of products from the database. Depending on the value of theproductListType
for theProductList
, the products could be the entire list of products in the system, the products under a given category, or the products matching a given search request.- Specified by:
getProductList
in interfaceProductProcessor
- Parameters:
productList
- AProductList
object whoseitemsPerPage
,firstCode
,productListType
, and optionallycategoryID
orsearchString
andstopWords
properties have been set.- Returns:
- A
ProductList
object with all its properties populated from the database. - Throws:
Exception
-
loadAllProducts
- Specified by:
loadAllProducts
in interfaceProductProcessor
- Throws:
Exception
-
loadMaxProductID
- Specified by:
loadMaxProductID
in interfaceProductProcessor
- Throws:
Exception
-
loadProductsForIndexing
- Specified by:
loadProductsForIndexing
in interfaceProductProcessor
- Throws:
Exception
-
sortProductsByName
- Specified by:
sortProductsByName
in interfaceProductProcessor
- Throws:
Exception
-
loadAllProductsSortedByName
- Throws:
Exception
-
sortProductsByCode
- Specified by:
sortProductsByCode
in interfaceProductProcessor
- Throws:
Exception
-
loadAllProductsSortedByCode
- Throws:
Exception
-
loadAllProductNamesCodesIDs
- Specified by:
loadAllProductNamesCodesIDs
in interfaceProductProcessor
- Throws:
Exception
-
loadActiveProductNamesCodesIDs
- Specified by:
loadActiveProductNamesCodesIDs
in interfaceProductProcessor
- Throws:
Exception
-
loadProductsAndCount
- Specified by:
loadProductsAndCount
in interfaceProductProcessor
- Throws:
Exception
-
addProduct
- Specified by:
addProduct
in interfaceProductProcessor
- Throws:
Exception
-
loadProductFromID
- Specified by:
loadProductFromID
in interfaceProductProcessor
- Throws:
Exception
-
loadProductFromID
- Throws:
Exception
-
loadProductFromCode
- Specified by:
loadProductFromCode
in interfaceProductProcessor
- Throws:
Exception
-
loadProductFromCode
- Specified by:
loadProductFromCode
in interfaceProductProcessor
- Throws:
Exception
-
editProduct
- Specified by:
editProduct
in interfaceProductProcessor
- Throws:
Exception
-
postChangingProductEvent
- Specified by:
postChangingProductEvent
in interfaceProductProcessor
- Throws:
Exception
-
editDeleteProducts
- Specified by:
editDeleteProducts
in interfaceProductProcessor
- Throws:
Exception
-
deleteProduct
- Specified by:
deleteProduct
in interfaceProductProcessor
- Throws:
Exception
-
validateProduct
- Throws:
Exception
-
loadSettings
- Specified by:
loadSettings
in interfaceProductProcessor
- Throws:
Exception
-
processSettings
- Specified by:
processSettings
in interfaceProductProcessor
- Throws:
Exception
-
buildMatrix
- Specified by:
buildMatrix
in interfaceProductProcessor
-
buildMatrix
public Collection buildMatrix(Product product, Integer attributeLimit, List<Integer> includedAttributeIDs, List<Integer> includedOptionIds) - Specified by:
buildMatrix
in interfaceProductProcessor
-
buildMatrix
public boolean buildMatrix(Collection matrix, Collection options, Collection attributes, Product product, Integer attributeLimit, List<Integer> includedAttributeIDs, List<Integer> includedOptionIds) -
cloneProduct
- Specified by:
cloneProduct
in interfaceProductProcessor
- Throws:
Exception
-
duplicateProduct
- Throws:
Exception
-
duplicateAttribute
- Throws:
Exception
-
loadProductFromCode
- Specified by:
loadProductFromCode
in interfaceProductProcessor
- Throws:
Exception
-
editProductAssignment
- Specified by:
editProductAssignment
in interfaceProductProcessor
- Throws:
Exception
-