JdbcCatalogFactory Class
- 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.
-
Hierarchy
-
Object
JdbcCatalogFactory
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.
|
public void |
-
buildCategoryStatement (PreparedStatement preparedStatement, CategoryKey parentKey, Category cat)
- Assigns the attributes for a Category into a PreparedStatement.
|
public void |
-
buildProductItemStatement (PreparedStatement preparedStatement, ProductItem item)
- Assigns the attributes for a ProductItem into a PreparedStatement.
|
public LinkedList |
-
createCategory (ResultSet resultSet)
- creates a LinkedList of Category objects from a ResultSet.
|
public LinkedList |
-
createProductItem (ResultSet resultSet)
- creates a LinkedList of ProductItem objects from a ResultSet.
|
public String |
-
getCategoryColumnName (String fieldName)
|
public int |
-
getCategoryFieldIndex (String fieldName)
|
public String |
-
getCategoryTableName ()
|
protected int |
-
getMapFieldIndex (Map indexMap, String fieldName)
|
public String |
-
getProductItemColumnName (String fieldName)
|
public int |
-
getProductItemFieldIndex (String fieldName)
|
public String |
-
getProductItemKeywordColumnName (String fieldName)
|
public String |
-
getProductItemKeywordTableName ()
|
public String |
-
getProductItemTableName ()
|
protected String |
-
getResultSetFieldAsString (ResultSet resultSet, Map indexMap, String fieldName)
|
Methods from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CATALOG_ITEM_CONTRIBUTOR
public static final String
CATALOG_ITEM_CONTRIBUTOR
CATALOG_ITEM_COVERAGE
public static final String
CATALOG_ITEM_COVERAGE
CATALOG_ITEM_CREATION_DATE
public static final String
CATALOG_ITEM_CREATION_DATE
CATALOG_ITEM_CREATOR
public static final String
CATALOG_ITEM_CREATOR
CATALOG_ITEM_LANGUAGE
public static final String
CATALOG_ITEM_LANGUAGE
CATALOG_ITEM_LARGE_IMAGE_ALT_TXT
public static final String
CATALOG_ITEM_LARGE_IMAGE_ALT_TXT
CATALOG_ITEM_LARGE_IMAGE_LANGUAGE
public static final String
CATALOG_ITEM_LARGE_IMAGE_LANGUAGE
CATALOG_ITEM_LARGE_IMAGE_NAME
public static final String
CATALOG_ITEM_LARGE_IMAGE_NAME
CATALOG_ITEM_LARGE_IMAGE_TYPE
public static final String
CATALOG_ITEM_LARGE_IMAGE_TYPE
CATALOG_ITEM_LARGE_IMAGE_URL
public static final String
CATALOG_ITEM_LARGE_IMAGE_URL
CATALOG_ITEM_LONG_DESCRIPTION
public static final String
CATALOG_ITEM_LONG_DESCRIPTION
CATALOG_ITEM_MODIFIED_DATE
public static final String
CATALOG_ITEM_MODIFIED_DATE
CATALOG_ITEM_NAME
public static final String
CATALOG_ITEM_NAME
- these are the column names for attributes shared between
categories and product items
CATALOG_ITEM_PUBLISHER
public static final String
CATALOG_ITEM_PUBLISHER
CATALOG_ITEM_RELATION
public static final String
CATALOG_ITEM_RELATION
CATALOG_ITEM_RIGHTS
public static final String
CATALOG_ITEM_RIGHTS
CATALOG_ITEM_SHORT_DESCRIPTION
public static final String
CATALOG_ITEM_SHORT_DESCRIPTION
CATALOG_ITEM_SMALL_IMAGE_ALT_TXT
public static final String
CATALOG_ITEM_SMALL_IMAGE_ALT_TXT
CATALOG_ITEM_SMALL_IMAGE_LANGUAGE
public static final String
CATALOG_ITEM_SMALL_IMAGE_LANGUAGE
CATALOG_ITEM_SMALL_IMAGE_NAME
public static final String
CATALOG_ITEM_SMALL_IMAGE_NAME
CATALOG_ITEM_SMALL_IMAGE_TYPE
public static final String
CATALOG_ITEM_SMALL_IMAGE_TYPE
CATALOG_ITEM_SMALL_IMAGE_URL
public static final String
CATALOG_ITEM_SMALL_IMAGE_URL
CATALOG_ITEM_SOURCE
public static final String
CATALOG_ITEM_SOURCE
CATEGORY_DISPLAY_JSP_URL
public static final String
CATEGORY_DISPLAY_JSP_URL
CATEGORY_ID
public static final String
CATEGORY_ID
- attributes just for category
CATEGORY_NAME
public static final String
CATEGORY_NAME
CATEGORY_PARENT_ID
public static final String
CATEGORY_PARENT_ID
PRODUCT_DETAIL_DISPLAY_JSP_URL
public static final String
PRODUCT_DETAIL_DISPLAY_JSP_URL
PRODUCT_ESTIMATE_SHIP_TIME
public static final String
PRODUCT_ESTIMATE_SHIP_TIME
PRODUCT_FORMAT
public static final String
PRODUCT_FORMAT
PRODUCT_IN_STOCK
public static final String
PRODUCT_IN_STOCK
PRODUCT_KEYWORD_KEYWORD
public static final String
PRODUCT_KEYWORD_KEYWORD
PRODUCT_KEYWORD_SKU
public static final String
PRODUCT_KEYWORD_SKU
PRODUCT_MSRP_AMOUNT
public static final String
PRODUCT_MSRP_AMOUNT
PRODUCT_MSRP_CURRENCY
public static final String
PRODUCT_MSRP_CURRENCY
PRODUCT_PRICE_AMOUNT
public static final String
PRODUCT_PRICE_AMOUNT
PRODUCT_PRICE_CURRENCY
public static final String
PRODUCT_PRICE_CURRENCY
PRODUCT_SHIPPING_CODE
public static final String
PRODUCT_SHIPPING_CODE
PRODUCT_SKU
public static final String
PRODUCT_SKU
- attributes just for product items
PRODUCT_SPECIAL_NOTES
public static final String
PRODUCT_SPECIAL_NOTES
PRODUCT_SUMMARY_DISPLAY_JSP_URL
public static final String
PRODUCT_SUMMARY_DISPLAY_JSP_URL
PRODUCT_TAX_CODE
public static final String
PRODUCT_TAX_CODE
PRODUCT_TYPE
public static final String
PRODUCT_TYPE
PRODUCT_VISIBLE
public static final String
PRODUCT_VISIBLE
JdbcCatalogFactory
public JdbcCatalogFactory(CatalogSchemaManager
schema)
- This class is abstract and cannot be created.
assignCatalogItemAttributes(MutableCatalogItem, ResultSet, Map) Method
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
-
indexMap
- the name of the field. Use the constants defined in this class.
Exceptions
-
SQLException
buildCatalogItemStatement(PreparedStatement, CatalogItem, Map) Method
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
-
indexMap
- the name of the field. Use the constants defined in this class.
Exceptions
-
SQLException
buildCategoryStatement(PreparedStatement, CategoryKey, Category) Method
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
-
parentKey
- the Category which is the source of the values
Exceptions
-
SQLException
buildProductItemStatement(PreparedStatement, ProductItem) Method
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
Exceptions
-
SQLException
createCategory(ResultSet) Method
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
Exceptions
-
SQLException
-
InvalidArgumentException
createProductItem(ResultSet) Method
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
Exceptions
-
SQLException
-
InvalidArgumentException
getCategoryColumnName(String) Method
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(String) Method
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() Method
public String
getCategoryTableName()
Returns
- the name of the database table used to store categories
getMapFieldIndex(Map, String) Method
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(String) Method
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(String) Method
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(String) Method
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() Method
public String
getProductItemKeywordTableName()
Returns
- the name of the database table used to store product item
keywords.
getProductItemTableName() Method
public String
getProductItemTableName()
Returns
- the name of the database table used to store product items
getResultSetFieldAsString(ResultSet, Map, String) Method
protected String
getResultSetFieldAsString(ResultSet
resultSet,
Map
indexMap,
String
fieldName)
throws SQLException
Parameters
-
resultSet
- one of the column maps for the tables we support
-
indexMap
- 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
).
Exceptions
-
SQLException