Class ProductInitializer

java.lang.Object
com.softslate.commerce.customer.product.ProductInitializer

public class ProductInitializer extends Object
Initializes singleton objects related to products, in the application scope. Called by BaseRequestProcessor at the beginning of a request, if the singletons are found to be missing.
Author:
David Tobey
  • Field Details

    • log

      static org.apache.commons.logging.Log log
    • servlet

      private org.apache.struts.action.ActionServlet servlet
  • Constructor Details

    • ProductInitializer

      public ProductInitializer()
    • ProductInitializer

      public ProductInitializer(org.apache.struts.action.ActionServlet servlet)
  • Method Details

    • getServlet

      public org.apache.struts.action.ActionServlet getServlet()
    • setServlet

      public void setServlet(org.apache.struts.action.ActionServlet servlet)
    • initializeCategoryTree

      public void initializeCategoryTree(BusinessObjectFactory businessObjectFactory)
      Creates a Collection representing the tree of categories in the system. Places the Collection in the application scope as an attribute with the name "categoryTree" so it can be referenced on any store screen. (Use application.categoryTree to reference the Collection from within a JSP template.) 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.

      This method invokes ProductProcessor.loadCategoryTree() to load the category information from the database.

      Parameters:
      businessObjectFactory - An initialized BusinessObjectFactory used to create the ProductProcessor implementer that loads the category information from the database.
    • initializeBuiltInCategories

      public void initializeBuiltInCategories(BusinessObjectFactory businessObjectFactory)
      Creates a Collection containing each of the built-in categories in the system. Built-in categories are typically composed of specials or other featured products that need to displayed on arbitrary pages thoughout the store. This method places the Collection in the application scope as an attribute with the name "builtInCategories" so it can be referenced on any store screen. Each item in the Collection is an instance of Category. (Use application.builtInCategories to reference the Collection from within a JSP template.)

      Built-in categories are definined by the "builtInCategories" setting in the sscSetting database table, a comma-separated list of category codes.

      This method invokes ProductProcessor.loadBuiltInCategories() to load the category information from the database.

      Parameters:
      businessObjectFactory - An initialized BusinessObjectFactory used to create the ProductProcessor implementer that loads the category information from the database.
    • initializeManufacturers

      public void initializeManufacturers(BusinessObjectFactory businessObjectFactory)
      Creates a Collection containing each of the manufacturers in the system. This method places the Collection in the application scope as an attribute with the name "manufacturers" so it can be referenced on any store screen. Each item in the Collection is an instance of Manufacturer. (Use application.manufacturers to reference the Collection from within a JSP template.)

      This method invokes ManufacturerProcessor.loadActiveManufacturers() to load the manufacturers' information from the database.

      Parameters:
      businessObjectFactory - An initialized BusinessObjectFactory used to create the ManufacturerProcessor implementer that loads the manufacturers' information from the database.
    • initializeStoreDiscounts

      public void initializeStoreDiscounts(BusinessObjectFactory businessObjectFactory)
      Creates a Collection containing discounts for display within the store. The discounts include any global discount (which apply to the user's cart as a whole rather than to particular line items), or discounts where a condition of the discount is that a given product is in the user's cart (querying for these discounts here allows us to display them alongside the required products, as a method of upselling). This method places the Collection in the application scope as an attribute with the name "storeDiscounts" so it can be referenced on any store screen. Each item in the Collection is an instance of Discount. (Use application.storeDiscounts to reference the Collection from within a JSP template.)

      This method invokes DiscountProcessor.loadStoreDiscounts() to load the discounts' information from the database.

      Parameters:
      businessObjectFactory - An initialized BusinessObjectFactory used to create the DiscountProcessor implementer that loads the discounts' information from the database.