JdbcSqlManager Class

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

public class JdbcSqlManager

    extends Object
    implements CatalogSqlManager

The JdbcSqlManager class implements the CatalogSqlManager interface using JDBC compliant SQL.
This is an advanced (internal) class and may be subject to change.


Hierarchy
Object
  JdbcSqlManager
All Implemented Interfaces

CatalogSqlManager
Direct Known Subclasses

OracleSqlManager

Constructor Summary

JdbcSqlManager()

 

Method Summary

public void
addItem(Connection connection, CatalogRequest request, CategoryKey categoryKey, ProductItemKey itemKey)
Adds an item to the specified category.
public void
createCategory(Connection connection, CatalogRequest request, CategoryKey parentKey, Category category)
Creates a sub category within the supplied parent category.
public void
createItem(Connection connection, CatalogRequest request, ProductItem product)
Creates a new product item.
public Category[]
getAncestors(Connection connection, CatalogRequest request, CategoryKey categoryKey)
Returns the ancestors of the specified category in ascending order.
public CatalogSchemaManager
getCatalogSchemaManager()
public Category[]
getCategories(Connection connection, CatalogRequest request, CategoryKey[] categoryKeys)
Returns the categories with the given category keys.
public Category
getCategory(Connection connection, CatalogRequest request, CategoryKey categoryKey)
Returns the category with the given category key.
public int
getCategoryCount(Connection connection, CatalogRequest request)
Returns the total number of categories in the product catalog.
public CategoryKey[]
getCategoryKeys(Connection connection, CatalogRequest request, int beginIndex, int endIndex)
Returns an array of all existing category keys within the specified ordered range.
public ProductItem
getItem(Connection connection, CatalogRequest request, ProductItemKey productKey)
Returns the product item with the specified key.
public CategoryKey[]
getItemCategories(Connection connection, CatalogRequest request, ProductItemKey productKey)
Gets all the categories that the item is a part of.
public CategoryKey[][]
getItemCategories(Connection connection, CatalogRequest request, ProductItemKey[] productKeys)
Returns an array of arrays of all the categories that items are part of.
public int
getItemCount(Connection connection, CatalogRequest request)
Returns the number of product items in the product catalog.
public int
getItemCount(Connection connection, CatalogRequest request, CategoryKey categoryKey)
Returns the number of product items associated with the specified category.
public ProductItemKey[]
getItemKeys(Connection connection, CatalogRequest request, int beginIndex, int endIndex)
Returns an array over all existing product item keys within the specified ordered range.
public ProductItemKey[]
getItemKeys(Connection connection, CatalogRequest request, CategoryKey categoryKey, int beginIndex, int endIndex)
Returns an array of all product item keys of the specified category within the specified ordered range.
public ProductItem[]
getItems(Connection connection, CatalogRequest request, ProductItemKey[] productKeys)
Returns the product items with the given product item keys.
public JdbcCatalogFactory
getJdbcCatalogFactory()
public String[]
getKeywords(Connection connection, CatalogRequest request, ProductItemKey productKey)
Returns the keywords associated with a given product item.
public int
getOrphanedItemCount(Connection connection, CatalogRequest request)
Returns the number of orphaned items in the catalog.
public ProductItemKey[]
getOrphanedItemKeys(Connection connection, CatalogRequest request, int beginIndex, int endIndex)
Returns an array of all existing orphaned item keys within the specified ordered range.
public Category
getParent(Connection connection, CatalogRequest request, CategoryKey categoryKey)
Returns the parent of the specified category.
public Category
getRootCategory(Connection connection, CatalogRequest request)
Returns the root category.
public int
getSiblingCount(Connection connection, CatalogRequest request, CategoryKey categoryKey)
Returns the number of siblings associated with the specified category.
public CategoryKey[]
getSiblingKeys(Connection connection, CatalogRequest request, CategoryKey categoryKey, int beginIndex, int endIndex)
Returns an array of all exististing sibling keys of the specified category within the specified ordered range.
public int
getSubCategoryCount(Connection connection, CatalogRequest request, CategoryKey categoryKey)
Returns the number of sub categories associated with the specified category.
public CategoryKey[]
getSubCategoryKeys(Connection connection, CatalogRequest request, CategoryKey categoryKey, int beginIndex, int endIndex)
Returns an array of all sub category keys of the specified category within the specified ordered range.
public void
initialize(String schemaName)
public void
moveCategory(Connection connection, CatalogRequest request, CategoryKey categoryKey, CategoryKey newParentKey)
Moves the specifed category.
public void
removeCategory(Connection connection, CatalogRequest request, CategoryKey categoryKey)
Removes the specifed category.
public void
removeItem(Connection connection, CatalogRequest request, ProductItemKey productKey)
Removes a product item.
public void
removeItem(Connection connection, CatalogRequest request, CategoryKey categoryKey, ProductItemKey itemKey)
Removes an item from the specified category.
public void
setKeywords(Connection connection, CatalogRequest request, ProductItemKey productKey, String[] keywords)
Sets the keywords for a given product item.
public void
updateCategory(Connection connection, CatalogRequest request, Category category)
Updates the specifed category.
public void
updateItem(Connection connection, CatalogRequest request, ProductItem product)
Updates a product item.
 
Methods from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
   
Methods from interface com.beasys.commerce.ebusiness.catalog.sql.CatalogSqlManager
addItem, createCategory, createItem, getAncestors, getCatalogSchemaManager, getCategories, getCategory, getCategoryCount, getCategoryKeys, getItem, getItemCount, getItemCount, getItemKeys, getItemKeys, getItems, getJdbcCatalogFactory, getKeywords, getOrphanedItemCount, getOrphanedItemKeys, getParent, getRootCategory, getSiblingCount, getSiblingKeys, getSubCategoryCount, getSubCategoryKeys, initialize, moveCategory, removeCategory, removeItem, removeItem, setKeywords, updateCategory, updateItem
 

Constructor Detail

JdbcSqlManager

public JdbcSqlManager()
 

Method Detail

addItem(Connection, CatalogRequest, CategoryKey, ProductItemKey) Method

public void addItem(Connection connection, 
                    CatalogRequest request, 
                    CategoryKey categoryKey, 
                    ProductItemKey itemKey)
throws CatalogFinderException, CatalogException, SQLException
Adds an item to the specified category.

Parameters

connection
The database connection object.
request
The catalog request object.
categoryKey
The key of target category.
itemKey
The key of the target item.

Exceptions

CatalogFinderException
if the target category or item could not be found.
CatalogException
on general error.
SQLException

createCategory(Connection, CatalogRequest, CategoryKey, Category) Method

public void createCategory(Connection connection, 
                           CatalogRequest request, 
                           CategoryKey parentKey, 
                           Category category)
throws CatalogCreateException, CatalogException, SQLException
Creates a sub category within the supplied parent category.

Parameters

connection
The database connection object.
request
The catalog request object.
parentKey
The key of the target parent category.
category
The category to persist.

Exceptions

CatalogCreateException
on category creation error.
CatalogException
on general error.
SQLException

createItem(Connection, CatalogRequest, ProductItem) Method

public void createItem(Connection connection, 
                       CatalogRequest request, 
                       ProductItem product)
throws CatalogCreateException, CatalogException, SQLException
Creates a new product item.

Parameters

connection
The database connection object.
request
The catalog request object.
product
The product item to persist.

Exceptions

CatalogCreateException
if the product item could not be created.
CatalogException
on general error.
SQLException
on database access error.

getAncestors(Connection, CatalogRequest, CategoryKey) Method

public Category[] getAncestors(Connection connection, 
                             CatalogRequest request, 
                             CategoryKey categoryKey)
throws CatalogException, SQLException
Returns the ancestors of the specified category in ascending order.

Parameters

connection
The database connection object.
request
The catalog request object.
categoryKey
The key of the target category.

Returns

An array of ancestor categories in ascending order.

Exceptions

CatalogException
on general error.
SQLException

getCatalogSchemaManager() Method

public CatalogSchemaManager getCatalogSchemaManager()

getCategories(Connection, CatalogRequest, CategoryKey[]) Method

public Category[] getCategories(Connection connection, 
                              CatalogRequest request, 
                              CategoryKey[] categoryKeys)
throws CatalogFinderException, CatalogException, SQLException
Returns the categories with the given category keys.

Parameters

connection
The database connection object.
request
The catalog request object.
categoryKeys
The keys of the target categories.

Returns

The categories with the given category keys.

Exceptions

CatalogFinderException
if a category with a given key does not exist.
CatalogException
on general error.
SQLException

getCategory(Connection, CatalogRequest, CategoryKey) Method

public Category getCategory(Connection connection, 
                            CatalogRequest request, 
                            CategoryKey categoryKey)
throws CatalogFinderException, CatalogException, SQLException
Returns the category with the given category key.

Parameters

connection
The database connection object.
request
The catalog request object.
categoryKey
The key of the target category.

Returns

The category with the given category key.

Exceptions

CatalogFinderException
if a category with the given key does not exist.
CatalogException
on general error.
SQLException

getCategoryCount(Connection, CatalogRequest) Method

public int getCategoryCount(Connection connection, 
                            CatalogRequest request)
throws CatalogException, SQLException
Returns the total number of categories in the product catalog.

Parameters

connection
The database connection object.
request
The catalog request object.

Returns

The total number of categories in the product catalog.

Exceptions

CatalogException
on general error.
SQLException

getCategoryKeys(Connection, CatalogRequest, int, int) Method

public CategoryKey[] getCategoryKeys(Connection connection, 
                                   CatalogRequest request, 
                                   int beginIndex, 
                                   int endIndex)
throws CatalogException, SQLException
Returns an array of all existing category keys within the specified ordered range.

Parameters

connection
The database connection object.
request
The catalog request object.
beginIndex
The lower bound index for returned category keys.
endIndex
The upper bound index for returned category keys.

Returns

An array of the category keys.

Exceptions

CatalogException
on general error.
SQLException

getItem(Connection, CatalogRequest, ProductItemKey) Method

public ProductItem getItem(Connection connection, 
                           CatalogRequest request, 
                           ProductItemKey productKey)
throws CatalogFinderException, CatalogException, SQLException
Returns the product item with the specified key.

Parameters

connection
The database connection object.
request
The catalog request object.
productKey
The key of the target product.

Exceptions

CatalogFinderException
if the product item could not be found.
CatalogException
on general error.
SQLException
on database access error.

getItemCategories(Connection, CatalogRequest, ProductItemKey) Method

public CategoryKey[] getItemCategories(Connection connection, 
                                     CatalogRequest request, 
                                     ProductItemKey productKey)
throws CatalogFinderException, CatalogException, SQLException
Gets all the categories that the item is a part of.

Parameters

connection
The database connection object.
request
The catalog request object.
productKey
ProductItemKey of the product item concerned.

Returns

An array of category keys.

Exceptions

CatalogFinderException
if the product item could not be found.
CatalogException
on general error.
SQLException

getItemCategories(Connection, CatalogRequest, ProductItemKey[]) Method

public CategoryKey[][] getItemCategories(Connection connection, 
                                     CatalogRequest request, 
                                     ProductItemKey[] productKeys)
throws CatalogException, SQLException
Returns an array of arrays of all the categories that items are part of. The order of the arrays returned is the same as the product item keys in the input. In case a product item key does not exist an empty array is returned.

Parameters

connection
The catalog request object.
request
Array of ProductItemKeys.

Returns

An array of arrays of category keys.

Exceptions

CatalogException
on general error.
SQLException

getItemCount(Connection, CatalogRequest) Method

public int getItemCount(Connection connection, 
                        CatalogRequest request)
throws CatalogException, SQLException
Returns the number of product items in the product catalog.

Parameters

connection
The database connection object.
request
The catalog request object.

Returns

The number of product items in the product catalog.

Exceptions

CatalogException
on general error.
SQLException
on database access error.

getItemCount(Connection, CatalogRequest, CategoryKey) Method

public int getItemCount(Connection connection, 
                        CatalogRequest request, 
                        CategoryKey categoryKey)
throws CatalogFinderException, CatalogException, SQLException
Returns the number of product items associated with the specified category.

Parameters

connection
The database connection object.
request
The catalog request object.
categoryKey
The key of the target category.

Returns

The number of product items associated with the specified category.

Exceptions

CatalogFinderException
if the specified category could not be found.
CatalogException
on general error.
SQLException

getItemKeys(Connection, CatalogRequest, int, int) Method

public ProductItemKey[] getItemKeys(Connection connection, 
                                  CatalogRequest request, 
                                  int beginIndex, 
                                  int endIndex)
throws CatalogException, SQLException
Returns an array over all existing product item keys within the specified ordered range.

Parameters

connection
The database connection object.
request
The catalog request object.
beginIndex
The lower bound index for returned product item keys.
endIndex
The upper bound index for returned product item keys.

Returns

An array of the product item keys.

Exceptions

CatalogException
on general error.
SQLException
on database access error.

getItemKeys(Connection, CatalogRequest, CategoryKey, int, int) Method

public ProductItemKey[] getItemKeys(Connection connection, 
                                  CatalogRequest request, 
                                  CategoryKey categoryKey, 
                                  int beginIndex, 
                                  int endIndex)
throws CatalogException, SQLException
Returns an array of all product item keys of the specified category within the specified ordered range.

Parameters

connection
The database connection object.
request
The catalog request object.
categoryKey
The key of the target category.
beginIndex
The lower bound index for returned product item keys.
endIndex
The upper bound index for returned product item keys.

Returns

An array of all the product item keys.

Exceptions

CatalogException
on general error.
SQLException

getItems(Connection, CatalogRequest, ProductItemKey[]) Method

public ProductItem[] getItems(Connection connection, 
                            CatalogRequest request, 
                            ProductItemKey[] productKeys)
throws CatalogFinderException, CatalogException, SQLException
Returns the product items with the given product item keys.

Parameters

connection
The database connection object.
request
The catalog request object.
productKeys
The keys of the target product items.

Returns

The product items with the given product item keys.

Exceptions

CatalogFinderException
if a product item with a given key does not exist.
CatalogException
on general error.
SQLException
on database access error.

getJdbcCatalogFactory() Method

public JdbcCatalogFactory getJdbcCatalogFactory()

getKeywords(Connection, CatalogRequest, ProductItemKey) Method

public String[] getKeywords(Connection connection, 
                          CatalogRequest request, 
                          ProductItemKey productKey)
throws CatalogFinderException, CatalogException, SQLException
Returns the keywords associated with a given product item.

Parameters

connection
The database connection object.
request
The catalog request object.
productKey
The key of the target product.

Returns

The keywords associated with the given product item. If there are no keywords associated with the item, a zero length <code>String</code> array is returned.

Exceptions

CatalogFinderException
if the product item could not be found.
CatalogException
on general error.
SQLException
on database access error.

getOrphanedItemCount(Connection, CatalogRequest) Method

public int getOrphanedItemCount(Connection connection, 
                                CatalogRequest request)
throws CatalogException, SQLException
Returns the number of orphaned items in the catalog.

Parameters

connection
The database connection object.
request
The catalog request object.

Returns

The number of orphaned items in the catalog.

Exceptions

CatalogException
on general error.
SQLException

getOrphanedItemKeys(Connection, CatalogRequest, int, int) Method

public ProductItemKey[] getOrphanedItemKeys(Connection connection, 
                                          CatalogRequest request, 
                                          int beginIndex, 
                                          int endIndex)
throws CatalogException, SQLException
Returns an array of all existing orphaned item keys within the specified ordered range.

Parameters

connection
The database connection object.
request
The catalog request object.
beginIndex
The lower bound index for returned category keys.
endIndex
The upper bound index for returned category keys.

Returns

An array of the orphaned category keys.

Exceptions

CatalogException
on general error.
SQLException

getParent(Connection, CatalogRequest, CategoryKey) Method

public Category getParent(Connection connection, 
                          CatalogRequest request, 
                          CategoryKey categoryKey)
throws CatalogFinderException, CatalogException, SQLException
Returns the parent of the specified category.

Parameters

connection
The database connection object.
request
The catalog request object.
categoryKey
The key of the target category.

Returns

The parent of the specified category.

Exceptions

CatalogFinderException
if the parent could not be found. This could happen if the specified category does not exist or is the root category.
CatalogException
on general error.
SQLException

getRootCategory(Connection, CatalogRequest) Method

public Category getRootCategory(Connection connection, 
                                CatalogRequest request)
throws CatalogException, SQLException
Returns the root category. If the root category does not exist, it will be created.

Parameters

connection
The database connection object.
request
The catalog request object.

Returns

The root category.

Exceptions

CatalogException
on general error.
SQLException

getSiblingCount(Connection, CatalogRequest, CategoryKey) Method

public int getSiblingCount(Connection connection, 
                           CatalogRequest request, 
                           CategoryKey categoryKey)
throws CatalogFinderException, CatalogException, SQLException
Returns the number of siblings associated with the specified category.

Parameters

connection
The database connection object.
request
The catalog request object.
categoryKey
The key of the target category.

Returns

The number of siblings associated with the specified category.

Exceptions

CatalogFinderException
if the specified category could not be found.
CatalogException
on general error.
SQLException

getSiblingKeys(Connection, CatalogRequest, CategoryKey, int, int) Method

public CategoryKey[] getSiblingKeys(Connection connection, 
                                  CatalogRequest request, 
                                  CategoryKey categoryKey, 
                                  int beginIndex, 
                                  int endIndex)
throws CatalogException, SQLException
Returns an array of all exististing sibling keys of the specified category within the specified ordered range.

Parameters

connection
The database connection object.
request
The catalog request object.
categoryKey
The key of the target category.
beginIndex
The lower bound index for returned sibling keys.
endIndex
The upper bound index for returned sibling keys.

Returns

An array of the sibling keys.

Exceptions

CatalogException
on general error.
SQLException

getSubCategoryCount(Connection, CatalogRequest, CategoryKey) Method

public int getSubCategoryCount(Connection connection, 
                               CatalogRequest request, 
                               CategoryKey categoryKey)
throws CatalogFinderException, CatalogException, SQLException
Returns the number of sub categories associated with the specified category.

Parameters

connection
The database connection object.
request
The catalog request object.
categoryKey
The key of the target category.

Returns

The number of sub categories associated with the specified category.

Exceptions

CatalogFinderException
if the specified category could not be found.
CatalogException
on general error.
SQLException

getSubCategoryKeys(Connection, CatalogRequest, CategoryKey, int, int) Method

public CategoryKey[] getSubCategoryKeys(Connection connection, 
                                      CatalogRequest request, 
                                      CategoryKey categoryKey, 
                                      int beginIndex, 
                                      int endIndex)
throws CatalogException, SQLException
Returns an array of all sub category keys of the specified category within the specified ordered range.

Parameters

connection
The database connection object.
request
The catalog request object.
categoryKey
The key of the target category.
beginIndex
The lower bound index for returned sub category keys.
endIndex
The upper bound index for returned sub category keys.

Returns

An array of all the sub category keys.

Exceptions

CatalogException
on general error.
SQLException

initialize(String) Method

public void initialize(String schemaName)

moveCategory(Connection, CatalogRequest, CategoryKey, CategoryKey) Method

public void moveCategory(Connection connection, 
                         CatalogRequest request, 
                         CategoryKey categoryKey, 
                         CategoryKey newParentKey)
throws CatalogFinderException, CatalogException, SQLException
Moves the specifed category.

Parameters

connection
The database connection object.
request
The catalog request object.
categoryKey
The key of the target category.
newParentKey
The key of the new parent category.

Exceptions

CatalogFinderException
if the specified target or parent category could not be found.
CatalogException
on general error.
SQLException

removeCategory(Connection, CatalogRequest, CategoryKey) Method

public void removeCategory(Connection connection, 
                           CatalogRequest request, 
                           CategoryKey categoryKey)
throws CatalogRemoveException, CatalogException, SQLException
Removes the specifed category.

Parameters

connection
The database connection object.
request
The catalog request object.
categoryKey
The key of the target category.

Exceptions

CatalogRemoveException
if the specified category could not be removed.
CatalogException
on general error.
SQLException

removeItem(Connection, CatalogRequest, ProductItemKey) Method

public void removeItem(Connection connection, 
                       CatalogRequest request, 
                       ProductItemKey productKey)
throws CatalogRemoveException, CatalogFinderException, CatalogException, SQLException
Removes a product item.

Parameters

connection
The database connection object.
request
The catalog request object.
productKey
The product item to remove.

Exceptions

CatalogRemoveException
if the product item could not be removed.
CatalogFinderException
if the product item could not be found.
CatalogException
on general error.
SQLException
on database access error.

removeItem(Connection, CatalogRequest, CategoryKey, ProductItemKey) Method

public void removeItem(Connection connection, 
                       CatalogRequest request, 
                       CategoryKey categoryKey, 
                       ProductItemKey itemKey)
throws CatalogFinderException, CatalogException, SQLException
Removes an item from the specified category.

Parameters

connection
The database connection object.
request
The catalog request object.
categoryKey
The key of target category.
itemKey
The key of the target item.

Exceptions

CatalogFinderException
if the target category could not be found.
CatalogException
on general error.
SQLException

setKeywords(Connection, CatalogRequest, ProductItemKey, String[]) Method

public void setKeywords(Connection connection, 
                        CatalogRequest request, 
                        ProductItemKey productKey, 
                        String[] keywords)
throws CatalogFinderException, CatalogException, SQLException
Sets the keywords for a given product item.

Parameters

connection
The database connection object.
request
The catalog request object.
productKey
The key of the target product.
keywords
The keywords to associate with the given product item.

Exceptions

CatalogFinderException
if the product item could not be found.
CatalogException
on general error.
SQLException
on database access error.

updateCategory(Connection, CatalogRequest, Category) Method

public void updateCategory(Connection connection, 
                           CatalogRequest request, 
                           Category category)
throws CatalogFinderException, CatalogException, SQLException
Updates the specifed category.

Parameters

connection
The database connection object.
request
The catalog request object.
category
The category to update.

Exceptions

CatalogFinderException
if the specified category could not be found.
CatalogException
on general error.
SQLException

updateItem(Connection, CatalogRequest, ProductItem) Method

public void updateItem(Connection connection, 
                       CatalogRequest request, 
                       ProductItem product)
throws CatalogFinderException, CatalogException, SQLException
Updates a product item.

Parameters

connection
The database connection object.
request
The catalog request object.
product
The product item to update.

Exceptions

CatalogFinderException
if the product item could not be found.
CatalogException
on general error.
SQLException
on database access error.