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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddProduct(Map parameters) protected voidappendToCategoryMap(Map categoryMap, Collection categories) buildMatrix(Product product) buildMatrix(Product product, Integer attributeLimit, List<Integer> includedAttributeIDs, List<Integer> includedOptionIds) booleanbuildMatrix(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 aCollectioncontaining built-in categories for the store.loadCategories(String categoryList) Retrieves aCollectioncontaining categories corresponding to the codes of the argument.Retrieves aCollectionrepresenting the store's category tree.intloadProductFromCode(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, utilsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:ProductProcessorRetrieves aCollectionrepresenting the store's category tree. Each item in theCollectionis an instance ofCategory, which corresponds to each one of the "top level" categories defined in the store (i.e., categories whoseparentCategoryproperty isnull). To render the tree, iterate through the top level categories and recursively navigate through each of theirsubcategoryCollections 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:
loadCategoryTreein interfaceProductProcessor- Returns:
- A
Collectionrepresenting the store's category tree. - Throws:
Exception
-
createCategoryMapFromCategoryTree
- Specified by:
createCategoryMapFromCategoryTreein interfaceProductProcessor
-
appendToCategoryMap
-
loadBuiltInCategories
Description copied from interface:ProductProcessorRetrieves aCollectioncontaining built-in categories for the store. Each item in theCollectionis 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
sscSettingdatabase table, a comma-separated list of category codes.- Specified by:
loadBuiltInCategoriesin interfaceProductProcessor- Returns:
- A
CollectionofCategoryobjects representing the store's built-in categories. - Throws:
Exception
-
loadCategories
Description copied from interface:ProductProcessorRetrieves aCollectioncontaining categories corresponding to the codes of the argument. Each item in theCollectionis 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:
loadCategoriesin interfaceProductProcessor- Returns:
- A
CollectionofCategoryobjects representing the store's built-in categories. - Throws:
Exception
-
getProductFromCode
Description copied from interface:ProductProcessorRetrieves product information from the database. In the default implementation, this method callsProductDAO.loadProduct()to populate the incomingProductusing itscode.- Specified by:
getProductFromCodein interfaceProductProcessor- Parameters:
product- AProductobject whosecodeproperty has been populated.- Returns:
- A
Productobject 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:ProductProcessorRetrieves product information from the database. In the default implementation, this method callsProductDAO.loadProductFromSeoCode()to populate the incomingProductusing itsseoCode.- Specified by:
getProductFromSeoCodein interfaceProductProcessor- Parameters:
product- AProductobject whoseseoCodeproperty has been populated.- Returns:
- A
Productobject 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:ProductProcessorRetrieves all SKUs associated with attributes but not products.- Specified by:
loadAttributeSKUsin interfaceProductProcessor- Returns:
- A
Mapof all theSKUs in the system associated with attributes but not products. - Throws:
Exception
-
loadAttributeSKUCollection
Description copied from interface:ProductProcessorRetrieves all SKUs associated with attributes but not products, as a Collection of SKUs.- Specified by:
loadAttributeSKUCollectionin interfaceProductProcessor- Returns:
- A
Collectionof all theSKUs in the system associated with attributes but not products. - Throws:
Exception
-
getCategoryFromCode
Description copied from interface:ProductProcessorRetrieves 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:
getCategoryFromCodein interfaceProductProcessor- Parameters:
category- ACategoryobject whosecodeproperty has been populated.- Returns:
- A
Categoryobject 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:ProductProcessorRetrieves category information from the database. In the default implementation, this method callsCategoryDAO.loadCategory()to populate the incomingCategoryusing itscode.If the loadProducts parameter is set to true, in addition to all of the category's regular properties, its
productListCollectionis populated with just thoseProducts 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'sitemsPerPageandfirstRowproperties, respectively.The method
ProductGatewayDAO.loadProductList(ProductList)is used to pull in the category's products.Also in the default implementation, the
Category'sparentCollectionandparentStringproperties are set by callingCategoryDAO.loadParents(). These properties are used in breadcrumbing and in the display of the category tree.- Specified by:
getCategoryFromCodein interfaceProductProcessor- Parameters:
category- ACategoryobject whosecodeproperty has been populated.loadProducts- If set to true, the category's products will be loaded into the category'sproductListCollectionproperty.- Returns:
- A
Categoryobject with all its properties populated from the database. If the category does not exist in the database,null. - Throws:
Exception
-
generateSettingsMap
- Specified by:
generateSettingsMapin interfaceProductProcessor- Throws:
Exception
-
getAllAttributesAndOptions
- Specified by:
getAllAttributesAndOptionsin interfaceProductProcessor- Throws:
Exception
-
getProductList
Description copied from interface:ProductProcessorRetrieves information for a list of products from the database. Depending on the value of theproductListTypefor 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:
getProductListin interfaceProductProcessor- Parameters:
productList- AProductListobject whoseitemsPerPage,firstCode,productListType, and optionallycategoryIDorsearchStringandstopWordsproperties have been set.- Returns:
- A
ProductListobject with all its properties populated from the database. - Throws:
Exception
-
loadAllProducts
- Specified by:
loadAllProductsin interfaceProductProcessor- Throws:
Exception
-
loadMaxProductID
- Specified by:
loadMaxProductIDin interfaceProductProcessor- Throws:
Exception
-
loadProductsForIndexing
- Specified by:
loadProductsForIndexingin interfaceProductProcessor- Throws:
Exception
-
sortProductsByName
- Specified by:
sortProductsByNamein interfaceProductProcessor- Throws:
Exception
-
loadAllProductsSortedByName
- Throws:
Exception
-
sortProductsByCode
- Specified by:
sortProductsByCodein interfaceProductProcessor- Throws:
Exception
-
loadAllProductsSortedByCode
- Throws:
Exception
-
loadAllProductNamesCodesIDs
- Specified by:
loadAllProductNamesCodesIDsin interfaceProductProcessor- Throws:
Exception
-
loadActiveProductNamesCodesIDs
- Specified by:
loadActiveProductNamesCodesIDsin interfaceProductProcessor- Throws:
Exception
-
loadProductsAndCount
- Specified by:
loadProductsAndCountin interfaceProductProcessor- Throws:
Exception
-
addProduct
- Specified by:
addProductin interfaceProductProcessor- Throws:
Exception
-
loadProductFromID
- Specified by:
loadProductFromIDin interfaceProductProcessor- Throws:
Exception
-
loadProductFromID
- Throws:
Exception
-
loadProductFromCode
- Specified by:
loadProductFromCodein interfaceProductProcessor- Throws:
Exception
-
loadProductFromCode
- Specified by:
loadProductFromCodein interfaceProductProcessor- Throws:
Exception
-
editProduct
- Specified by:
editProductin interfaceProductProcessor- Throws:
Exception
-
postChangingProductEvent
- Specified by:
postChangingProductEventin interfaceProductProcessor- Throws:
Exception
-
editDeleteProducts
- Specified by:
editDeleteProductsin interfaceProductProcessor- Throws:
Exception
-
deleteProduct
- Specified by:
deleteProductin interfaceProductProcessor- Throws:
Exception
-
validateProduct
- Throws:
Exception
-
loadSettings
- Specified by:
loadSettingsin interfaceProductProcessor- Throws:
Exception
-
processSettings
- Specified by:
processSettingsin interfaceProductProcessor- Throws:
Exception
-
buildMatrix
- Specified by:
buildMatrixin interfaceProductProcessor
-
buildMatrix
public Collection buildMatrix(Product product, Integer attributeLimit, List<Integer> includedAttributeIDs, List<Integer> includedOptionIds) - Specified by:
buildMatrixin interfaceProductProcessor
-
buildMatrix
public boolean buildMatrix(Collection matrix, Collection options, Collection attributes, Product product, Integer attributeLimit, List<Integer> includedAttributeIDs, List<Integer> includedOptionIds) -
cloneProduct
- Specified by:
cloneProductin interfaceProductProcessor- Throws:
Exception
-
duplicateProduct
- Throws:
Exception
-
duplicateAttribute
- Throws:
Exception
-
loadProductFromCode
- Specified by:
loadProductFromCodein interfaceProductProcessor- Throws:
Exception
-
editProductAssignment
- Specified by:
editProductAssignmentin interfaceProductProcessor- Throws:
Exception
-