© 2005 BEA Systems, Inc.

com.beasys.commerce.ebusiness.catalog.sql
Class JdbcCatalogFactory

java.lang.Object
  extended bycom.beasys.commerce.ebusiness.catalog.sql.JdbcCatalogFactory

public class JdbcCatalogFactory
extends Object

This class provides static methods to insulate the JDBC catalog developer from the underlying database schema. It implements a number of methods to query the structure of the schema and can create Category and Product Item objects from a ResultSet.
This is an advanced (internal) class and may be subject to change.


Field Summary
static String CATALOG_ITEM_CONTRIBUTOR
           
static String CATALOG_ITEM_COVERAGE
           
static String CATALOG_ITEM_CREATION_DATE
           
static String CATALOG_ITEM_CREATOR
           
static String CATALOG_ITEM_LANGUAGE
           
static String CATALOG_ITEM_LARGE_IMAGE_ALT_TXT
           
static String CATALOG_ITEM_LARGE_IMAGE_LANGUAGE
           
static String CATALOG_ITEM_LARGE_IMAGE_NAME
           
static String CATALOG_ITEM_LARGE_IMAGE_TYPE
           
static String CATALOG_ITEM_LARGE_IMAGE_URL
           
static String CATALOG_ITEM_LONG_DESCRIPTION
           
static String CATALOG_ITEM_MODIFIED_DATE
           
static String CATALOG_ITEM_NAME
          these are the column names for attributes shared between categories and product items
static String CATALOG_ITEM_PUBLISHER
           
static String CATALOG_ITEM_RELATION
           
static String CATALOG_ITEM_RIGHTS
           
static String CATALOG_ITEM_SHORT_DESCRIPTION
           
static String CATALOG_ITEM_SMALL_IMAGE_ALT_TXT
           
static String CATALOG_ITEM_SMALL_IMAGE_LANGUAGE
           
static String CATALOG_ITEM_SMALL_IMAGE_NAME
           
static String CATALOG_ITEM_SMALL_IMAGE_TYPE
           
static String CATALOG_ITEM_SMALL_IMAGE_URL
           
static String CATALOG_ITEM_SOURCE
           
static String CATEGORY_DISPLAY_JSP_URL
           
static String CATEGORY_ID
          attributes just for category
static String CATEGORY_NAME
           
static String CATEGORY_PARENT_ID
           
static String PRODUCT_DETAIL_DISPLAY_JSP_URL
           
static String PRODUCT_ESTIMATE_SHIP_TIME
           
static String PRODUCT_FORMAT
           
static String PRODUCT_IN_STOCK
           
static String PRODUCT_KEYWORD_KEYWORD
           
static String PRODUCT_KEYWORD_SKU
           
static String PRODUCT_MSRP_AMOUNT
           
static String PRODUCT_MSRP_CURRENCY
           
static String PRODUCT_PRICE_AMOUNT
           
static String PRODUCT_PRICE_CURRENCY
           
static String PRODUCT_SHIPPING_CODE
           
static String PRODUCT_SKU
          attributes just for product items
static String PRODUCT_SPECIAL_NOTES
           
static String PRODUCT_SUMMARY_DISPLAY_JSP_URL
           
static String PRODUCT_TAX_CODE
           
static String PRODUCT_TYPE
           
static String PRODUCT_VISIBLE
           
 
Constructor Summary
JdbcCatalogFactory(CatalogSchemaManager schema)
          This class is abstract and cannot be created.
 
Method Summary
protected  void assignCatalogItemAttributes(MutableCatalogItem item, ResultSet resultSet, Map indexMap)
          Assigns the base class CatalogItem attributes from the ResultSet to a CatalogItem object.
protected  void buildCatalogItemStatement(PreparedStatement preparedStatement, CatalogItem item, Map indexMap)
          Assigns the attributes for a CatalogItem into a PreparedStatement.
 void buildCategoryStatement(PreparedStatement preparedStatement, CategoryKey parentKey, Category cat)
          Assigns the attributes for a Category into a PreparedStatement.
 void buildProductItemStatement(PreparedStatement preparedStatement, ProductItem item)
          Assigns the attributes for a ProductItem into a PreparedStatement.
 LinkedList createCategory(ResultSet resultSet)
          creates a LinkedList of Category objects from a ResultSet.
 LinkedList createProductItem(ResultSet resultSet)
          creates a LinkedList of ProductItem objects from a ResultSet.
 String getCategoryColumnName(String fieldName)
           
 int getCategoryFieldIndex(String fieldName)
           
 String getCategoryTableName()
           
protected  int getMapFieldIndex(Map indexMap, String fieldName)
           
 String getProductItemColumnName(String fieldName)
           
 int getProductItemFieldIndex(String fieldName)
           
 String getProductItemKeywordColumnName(String fieldName)
           
 String getProductItemKeywordTableName()
           
 String getProductItemTableName()
           
protected  String getResultSetFieldAsString(ResultSet resultSet, Map indexMap, String fieldName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CATALOG_ITEM_CONTRIBUTOR

public static final String CATALOG_ITEM_CONTRIBUTOR
See Also:
Constant Field Values

CATALOG_ITEM_COVERAGE

public static final String CATALOG_ITEM_COVERAGE
See Also:
Constant Field Values

CATALOG_ITEM_CREATION_DATE

public static final String CATALOG_ITEM_CREATION_DATE
See Also:
Constant Field Values

CATALOG_ITEM_CREATOR

public static final String CATALOG_ITEM_CREATOR
See Also:
Constant Field Values

CATALOG_ITEM_LANGUAGE

public static final String CATALOG_ITEM_LANGUAGE
See Also:
Constant Field Values

CATALOG_ITEM_LARGE_IMAGE_ALT_TXT

public static final String CATALOG_ITEM_LARGE_IMAGE_ALT_TXT
See Also:
Constant Field Values

CATALOG_ITEM_LARGE_IMAGE_LANGUAGE

public static final String CATALOG_ITEM_LARGE_IMAGE_LANGUAGE
See Also:
Constant Field Values

CATALOG_ITEM_LARGE_IMAGE_NAME

public static final String CATALOG_ITEM_LARGE_IMAGE_NAME
See Also:
Constant Field Values

CATALOG_ITEM_LARGE_IMAGE_TYPE

public static final String CATALOG_ITEM_LARGE_IMAGE_TYPE
See Also:
Constant Field Values

CATALOG_ITEM_LARGE_IMAGE_URL

public static final String CATALOG_ITEM_LARGE_IMAGE_URL
See Also:
Constant Field Values

CATALOG_ITEM_LONG_DESCRIPTION

public static final String CATALOG_ITEM_LONG_DESCRIPTION
See Also:
Constant Field Values

CATALOG_ITEM_MODIFIED_DATE

public static final String CATALOG_ITEM_MODIFIED_DATE
See Also:
Constant Field Values

CATALOG_ITEM_NAME

public static final String CATALOG_ITEM_NAME
these are the column names for attributes shared between categories and product items

See Also:
Constant Field Values

CATALOG_ITEM_PUBLISHER

public static final String CATALOG_ITEM_PUBLISHER
See Also:
Constant Field Values

CATALOG_ITEM_RELATION

public static final String CATALOG_ITEM_RELATION
See Also:
Constant Field Values

CATALOG_ITEM_RIGHTS

public static final String CATALOG_ITEM_RIGHTS
See Also:
Constant Field Values

CATALOG_ITEM_SHORT_DESCRIPTION

public static final String CATALOG_ITEM_SHORT_DESCRIPTION
See Also:
Constant Field Values

CATALOG_ITEM_SMALL_IMAGE_ALT_TXT

public static final String CATALOG_ITEM_SMALL_IMAGE_ALT_TXT
See Also:
Constant Field Values

CATALOG_ITEM_SMALL_IMAGE_LANGUAGE

public static final String CATALOG_ITEM_SMALL_IMAGE_LANGUAGE
See Also:
Constant Field Values

CATALOG_ITEM_SMALL_IMAGE_NAME

public static final String CATALOG_ITEM_SMALL_IMAGE_NAME
See Also:
Constant Field Values

CATALOG_ITEM_SMALL_IMAGE_TYPE

public static final String CATALOG_ITEM_SMALL_IMAGE_TYPE
See Also:
Constant Field Values

CATALOG_ITEM_SMALL_IMAGE_URL

public static final String CATALOG_ITEM_SMALL_IMAGE_URL
See Also:
Constant Field Values

CATALOG_ITEM_SOURCE

public static final String CATALOG_ITEM_SOURCE
See Also:
Constant Field Values

CATEGORY_DISPLAY_JSP_URL

public static final String CATEGORY_DISPLAY_JSP_URL
See Also:
Constant Field Values

CATEGORY_ID

public static final String CATEGORY_ID
attributes just for category

See Also:
Constant Field Values

CATEGORY_NAME

public static final String CATEGORY_NAME
See Also:
Constant Field Values

CATEGORY_PARENT_ID

public static final String CATEGORY_PARENT_ID
See Also:
Constant Field Values

PRODUCT_DETAIL_DISPLAY_JSP_URL

public static final String PRODUCT_DETAIL_DISPLAY_JSP_URL
See Also:
Constant Field Values

PRODUCT_ESTIMATE_SHIP_TIME

public static final String PRODUCT_ESTIMATE_SHIP_TIME
See Also:
Constant Field Values

PRODUCT_FORMAT

public static final String PRODUCT_FORMAT
See Also:
Constant Field Values

PRODUCT_IN_STOCK

public static final String PRODUCT_IN_STOCK
See Also:
Constant Field Values

PRODUCT_KEYWORD_KEYWORD

public static final String PRODUCT_KEYWORD_KEYWORD
See Also:
Constant Field Values

PRODUCT_KEYWORD_SKU

public static final String PRODUCT_KEYWORD_SKU
See Also:
Constant Field Values

PRODUCT_MSRP_AMOUNT

public static final String PRODUCT_MSRP_AMOUNT
See Also:
Constant Field Values

PRODUCT_MSRP_CURRENCY

public static final String PRODUCT_MSRP_CURRENCY
See Also:
Constant Field Values

PRODUCT_PRICE_AMOUNT

public static final String PRODUCT_PRICE_AMOUNT
See Also:
Constant Field Values

PRODUCT_PRICE_CURRENCY

public static final String PRODUCT_PRICE_CURRENCY
See Also:
Constant Field Values

PRODUCT_SHIPPING_CODE

public static final String PRODUCT_SHIPPING_CODE
See Also:
Constant Field Values

PRODUCT_SKU

public static final String PRODUCT_SKU
attributes just for product items

See Also:
Constant Field Values

PRODUCT_SPECIAL_NOTES

public static final String PRODUCT_SPECIAL_NOTES
See Also:
Constant Field Values

PRODUCT_SUMMARY_DISPLAY_JSP_URL

public static final String PRODUCT_SUMMARY_DISPLAY_JSP_URL
See Also:
Constant Field Values

PRODUCT_TAX_CODE

public static final String PRODUCT_TAX_CODE
See Also:
Constant Field Values

PRODUCT_TYPE

public static final String PRODUCT_TYPE
See Also:
Constant Field Values

PRODUCT_VISIBLE

public static final String PRODUCT_VISIBLE
See Also:
Constant Field Values
Constructor Detail

JdbcCatalogFactory

public JdbcCatalogFactory(CatalogSchemaManager schema)
This class is abstract and cannot be created.

Method Detail

assignCatalogItemAttributes

protected void assignCatalogItemAttributes(MutableCatalogItem item,
                                           ResultSet resultSet,
                                           Map indexMap)
                                    throws SQLException
Assigns the base class CatalogItem attributes from the ResultSet to a CatalogItem object.

Parameters:
item - the Category or ProductItem to populate
resultSet - the SQL result set for the category or product item
Throws:
SQLException

buildCatalogItemStatement

protected void buildCatalogItemStatement(PreparedStatement preparedStatement,
                                         CatalogItem item,
                                         Map indexMap)
                                  throws SQLException
Assigns the attributes for a CatalogItem into a PreparedStatement.

Parameters:
preparedStatement - the PreparedStatement to populate
item - the Category or ProductItem which is the source of the values
Throws:
SQLException

buildCategoryStatement

public void buildCategoryStatement(PreparedStatement preparedStatement,
                                   CategoryKey parentKey,
                                   Category cat)
                            throws SQLException
Assigns the attributes for a Category into a PreparedStatement.

Parameters:
preparedStatement - the PreparedStatement to populate
cat - the Category which is the source of the values
Throws:
SQLException

buildProductItemStatement

public void buildProductItemStatement(PreparedStatement preparedStatement,
                                      ProductItem item)
                               throws SQLException
Assigns the attributes for a ProductItem into a PreparedStatement.

Parameters:
preparedStatement - the PreparedStatement to populate
item - the ProductItem which is the source of the values
Throws:
SQLException

createCategory

public LinkedList createCategory(ResultSet resultSet)
                          throws SQLException,
                                 InvalidArgumentException
creates a LinkedList of Category objects from a ResultSet. The ResultSet must include all the columns of the category table in the correct order.

Parameters:
resultSet - the SQL result set for the category table
Returns:
a Vector of Category objects
Throws:
SQLException
InvalidArgumentException

createProductItem

public LinkedList createProductItem(ResultSet resultSet)
                             throws SQLException,
                                    InvalidArgumentException
creates a LinkedList of ProductItem objects from a ResultSet. The ResultSet must include all the columns of the product item table in the correct order.

Parameters:
resultSet - the SQL result set for the product item table
Returns:
a Vector of ProductItem objects
Throws:
SQLException
InvalidArgumentException

getCategoryColumnName

public String getCategoryColumnName(String fieldName)
Parameters:
fieldName - the name of the field. Use the constants defined in this class.
Returns:
the name of the database column used to store a category attribute

getCategoryFieldIndex

public int getCategoryFieldIndex(String fieldName)
Parameters:
fieldName - the name of the field. Use the constants defined in this class.
Returns:
the index of a database column used to store a category attribute

getCategoryTableName

public String getCategoryTableName()
Returns:
the name of the database table used to store categories

getMapFieldIndex

protected int getMapFieldIndex(Map indexMap,
                               String fieldName)
Parameters:
indexMap - one of the column maps for the tables we support
fieldName - the name of the field. Use the constants defined in this class.
Returns:
the index of the column for an attribute from one of the database tables we support

getProductItemColumnName

public String getProductItemColumnName(String fieldName)
Parameters:
fieldName - the name of the field. Use the constants defined in this class.
Returns:
the name of the database column used to store a product item attribute

getProductItemFieldIndex

public int getProductItemFieldIndex(String fieldName)
Parameters:
fieldName - the name of the field. Use the constants defined in this class.
Returns:
the index of a database column used to store a product item attribute

getProductItemKeywordColumnName

public String getProductItemKeywordColumnName(String fieldName)
Parameters:
fieldName - the name of the field (PRODUCT_KEYWORD_SKU, PRODUCT_KEYWORD_KEYWORD).
Returns:
the name of the database column used to store a product item keyword attribute.

getProductItemKeywordTableName

public String getProductItemKeywordTableName()
Returns:
the name of the database table used to store product item keywords.

getProductItemTableName

public String getProductItemTableName()
Returns:
the name of the database table used to store product items

getResultSetFieldAsString

protected String getResultSetFieldAsString(ResultSet resultSet,
                                           Map indexMap,
                                           String fieldName)
                                    throws SQLException
Parameters:
indexMap - one of the column maps for the tables we support
fieldName - the name of the field. Use the constants defined in this class.
Returns:
The value of a String attribute from one of the database tables we support (after passing through a call to processString).
Throws:
SQLException

© 2005 BEA Systems, Inc.

Copyright © 2005 BEA Systems, Inc. All Rights Reserved