com.softslate.commerce.businessobjects.product
Class BasicProductProcessor

java.lang.Object
  extended by com.softslate.commerce.businessobjects.core.BaseBusinessObject
      extended by com.softslate.commerce.businessobjects.core.BaseBusinessProcessor
          extended by com.softslate.commerce.businessobjects.product.BasicProductProcessor
All Implemented Interfaces:
BusinessObject, BusinessProcessor, ProductProcessor

public class BasicProductProcessor
extends BaseBusinessProcessor
implements ProductProcessor

Processes business logic affecting products and other related objects. BasicProductProcessor is the default implementation of the ProductProcessor interface for the application.

Author:
David Tobey

Field Summary
(package private) static org.apache.commons.logging.Log log
           
 
Constructor Summary
BasicProductProcessor()
           
 
Method Summary
 void addProduct(java.util.Map parameters)
           
 boolean buildMatrix(java.util.Collection matrix, java.util.Collection options, java.util.Collection attributes, Product product)
           
 java.util.Collection buildMatrix(Product product)
           
 void deleteProduct(java.util.Map parameters)
           
 void editDeleteProducts(java.util.Map parameters)
           
 void editProduct(java.util.Map parameters)
           
 java.util.HashMap generateSettingsMap(java.util.Collection settings)
           
 java.util.Collection getAllAttributesAndOptions(int productID)
           
 Category getCategoryFromCode(Category category)
          Retrieves category information from the database.
 Category getCategoryFromCode(Category category, boolean loadProducts)
          Retrieves category information from the database.
 Product getProductFromCode(Product product)
          Retrieves product information from the database.
 ProductList getProductList(ProductList productList)
          Retrieves information for a list of products from the database.
 java.util.Collection loadAllProductNamesCodesIDs()
           
 java.util.Collection loadAllProducts()
           
 java.util.Collection loadAllProductsSortedByName()
           
 java.util.Collection loadAttributeSKUCollection()
          Retrieves all SKUs associated with attributes but not products, as a Collection of SKUs.
 java.util.Map loadAttributeSKUs()
          Retrieves all SKUs associated with attributes but not products.
 java.util.Collection loadBuiltInCategories()
          Retrieves a Collection containing built-in categories for the store.
 java.util.Collection loadCategoryTree()
          Retrieves a Collection representing the store's category tree.
 Product loadProductFromID(java.util.Map parameters)
           
 java.util.Map loadProductsAndCount(java.util.Map parameters)
           
 java.util.Collection loadSettings(java.util.Map parameters)
           
 java.util.Collection processSettings(java.util.Map parameters)
           
 java.util.Map sortProductsByName(java.util.Map parameters)
           
 
Methods inherited from class com.softslate.commerce.businessobjects.core.BaseBusinessProcessor
formatDateTime, formatPrice, getAppComponents, getAppSettings, getAttributeIDs, getBusinessObjectFactory, getDaoFactory, getProductIDs, getSettings, getUser, initialize, loadMatchingSkus, parseDateTime, parseResponseData, prepareRequestData, sendHTTPPost, setAppComponents, setAppSettings, setBusinessObjectFactory, setDaoFactory, setSettings, setUser, 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 Detail

log

static org.apache.commons.logging.Log log
Constructor Detail

BasicProductProcessor

public BasicProductProcessor()
Method Detail

loadCategoryTree

public java.util.Collection loadCategoryTree()
                                      throws java.lang.Exception
Description copied from interface: ProductProcessor
Retrieves a Collection representing the store's category tree. Each item in the Collection is an instance of Category, which corresponds to each one of the "top level" categories defined in the store (i.e., categories whose parentCategory property is null). To render the tree, iterate through the top level categories and recursively navigate through each of their subcategoryCollections in turn.

The default implementation of this method calls ProductGatewayDAOHibernate.loadCategoryTree(), which uses Hibernate.initialize(java.lang.Object) to pull the entire tree from the database non-lazily.

Specified by:
loadCategoryTree in interface ProductProcessor
Returns:
A Collection representing the store's category tree.
Throws:
java.lang.Exception

loadBuiltInCategories

public java.util.Collection loadBuiltInCategories()
                                           throws java.lang.Exception
Description copied from interface: ProductProcessor
Retrieves a Collection containing built-in categories for the store. Each item in the Collection is an instance of Category. 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 interface ProductProcessor
Returns:
A Collection of Category objects representing the store's built-in categories.
Throws:
java.lang.Exception

getProductFromCode

public Product getProductFromCode(Product product)
                           throws java.lang.Exception
Description copied from interface: ProductProcessor
Retrieves product information from the database. In the default implementation, this method calls ProductDAO.loadProduct() to populate the incoming Product using its code.

Specified by:
getProductFromCode in interface ProductProcessor
Parameters:
product - A Product object whose code 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:
java.lang.Exception

loadAttributeSKUs

public java.util.Map loadAttributeSKUs()
                                throws java.lang.Exception
Description copied from interface: ProductProcessor
Retrieves all SKUs associated with attributes but not products.

Specified by:
loadAttributeSKUs in interface ProductProcessor
Returns:
A Map of all the SKUs in the system associated with attributes but not products.
Throws:
java.lang.Exception

loadAttributeSKUCollection

public java.util.Collection loadAttributeSKUCollection()
                                                throws java.lang.Exception
Description copied from interface: ProductProcessor
Retrieves all SKUs associated with attributes but not products, as a Collection of SKUs.

Specified by:
loadAttributeSKUCollection in interface ProductProcessor
Returns:
A Collection of all the SKUs in the system associated with attributes but not products.
Throws:
java.lang.Exception

getCategoryFromCode

public Category getCategoryFromCode(Category category)
                             throws java.lang.Exception
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 interface ProductProcessor
Parameters:
category - A Category object whose code 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:
java.lang.Exception

getCategoryFromCode

public Category getCategoryFromCode(Category category,
                                    boolean loadProducts)
                             throws java.lang.Exception
Description copied from interface: ProductProcessor
Retrieves category information from the database. In the default implementation, this method calls CategoryDAO.loadCategory() to populate the incoming Category using its code.

If the loadProducts parameter is set to true, in addition to all of the category's regular properties, its productListCollection is populated with just those Products 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 incoming Category's itemsPerPage and firstRow properties, respectively.

The method ProductGatewayDAO.loadProductList(ProductList) is used to pull in the category's products.

Also in the default implementation, the Category's parentCollection and parentString properties are set by calling CategoryDAO.loadParents(). These properties are used in breadcrumbing and in the display of the category tree.

Specified by:
getCategoryFromCode in interface ProductProcessor
Parameters:
category - A Category object whose code property has been populated.
loadProducts - If set to true, the category's products will be loaded into the category's productListCollection property.
Returns:
A Category object with all its properties populated from the database. If the category does not exist in the database, null.
Throws:
java.lang.Exception

generateSettingsMap

public java.util.HashMap generateSettingsMap(java.util.Collection settings)
                                      throws java.lang.Exception
Specified by:
generateSettingsMap in interface ProductProcessor
Throws:
java.lang.Exception

getAllAttributesAndOptions

public java.util.Collection getAllAttributesAndOptions(int productID)
                                                throws java.lang.Exception
Specified by:
getAllAttributesAndOptions in interface ProductProcessor
Throws:
java.lang.Exception

getProductList

public ProductList getProductList(ProductList productList)
                           throws java.lang.Exception
Description copied from interface: ProductProcessor
Retrieves information for a list of products from the database. Depending on the value of the productListType for the ProductList, 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 interface ProductProcessor
Parameters:
productList - A ProductList object whose itemsPerPage,firstCode, productListType, and optionally categoryID or searchString and stopWords properties have been set.
Returns:
A ProductList object with all its properties populated from the database.
Throws:
java.lang.Exception

loadAllProducts

public java.util.Collection loadAllProducts()
                                     throws java.lang.Exception
Specified by:
loadAllProducts in interface ProductProcessor
Throws:
java.lang.Exception

sortProductsByName

public java.util.Map sortProductsByName(java.util.Map parameters)
                                 throws java.lang.Exception
Specified by:
sortProductsByName in interface ProductProcessor
Throws:
java.lang.Exception

loadAllProductsSortedByName

public java.util.Collection loadAllProductsSortedByName()
                                                 throws java.lang.Exception
Throws:
java.lang.Exception

loadAllProductNamesCodesIDs

public java.util.Collection loadAllProductNamesCodesIDs()
                                                 throws java.lang.Exception
Specified by:
loadAllProductNamesCodesIDs in interface ProductProcessor
Throws:
java.lang.Exception

loadProductsAndCount

public java.util.Map loadProductsAndCount(java.util.Map parameters)
                                   throws java.lang.Exception
Specified by:
loadProductsAndCount in interface ProductProcessor
Throws:
java.lang.Exception

addProduct

public void addProduct(java.util.Map parameters)
                throws java.lang.Exception
Specified by:
addProduct in interface ProductProcessor
Throws:
java.lang.Exception

loadProductFromID

public Product loadProductFromID(java.util.Map parameters)
                          throws java.lang.Exception
Specified by:
loadProductFromID in interface ProductProcessor
Throws:
java.lang.Exception

editProduct

public void editProduct(java.util.Map parameters)
                 throws java.lang.Exception
Specified by:
editProduct in interface ProductProcessor
Throws:
java.lang.Exception

editDeleteProducts

public void editDeleteProducts(java.util.Map parameters)
                        throws java.lang.Exception
Specified by:
editDeleteProducts in interface ProductProcessor
Throws:
java.lang.Exception

deleteProduct

public void deleteProduct(java.util.Map parameters)
                   throws java.lang.Exception
Specified by:
deleteProduct in interface ProductProcessor
Throws:
java.lang.Exception

loadSettings

public java.util.Collection loadSettings(java.util.Map parameters)
                                  throws java.lang.Exception
Specified by:
loadSettings in interface ProductProcessor
Throws:
java.lang.Exception

processSettings

public java.util.Collection processSettings(java.util.Map parameters)
                                     throws java.lang.Exception
Specified by:
processSettings in interface ProductProcessor
Throws:
java.lang.Exception

buildMatrix

public java.util.Collection buildMatrix(Product product)
Specified by:
buildMatrix in interface ProductProcessor

buildMatrix

public boolean buildMatrix(java.util.Collection matrix,
                           java.util.Collection options,
                           java.util.Collection attributes,
                           Product product)


Copyright ? SoftSlate, LLC 2003?2005