# com.beasys.commerce.ebusiness.catalog.service.category
JdbcCategoryManagerImpl Class

public class JdbcCategoryManagerImpl
extends `JdbcCatalogServiceImpl`

Implementation class for the Tier 2 service provider that manages catalog categories using a JDBC persistence model. This class should not be accessed directly, instead all catalog access should pass through the CatalogManager.getCategoryManager method.

Related Topics

``CatalogManager``
``JdbcCategoryManager``
``JdbcCategoryManagerHome``

Hierarchy
  `Object`
  `SessionImpl`
  `CatalogServiceImpl`
  `JdbcCatalogServiceImpl`
  `JdbcCategoryManagerImpl`

All Implemented Interfaces
  `EnterpriseBean`, `Serializable`, `SessionBean`

## Field Summary

Fields from com.beasys.commerce.ebusiness.catalog.service`.`JdbcCatalogServiceImpl``
``DATA_SOURCE_NAME`, `SCHEMA_FILE_NAME`, `SQL_MANAGER_CLASS``

Fields from com.beasys.commerce.ebusiness.catalog.service`.`CatalogServiceImpl``
``CATALOG_MANAGER_HOME``

Fields from com.beasys.commerce.foundation`.`SessionImpl``
``_ctx`, `_environmentNamingContext`, `_environmentPropertyCache`, `_isDirty``

## Constructor Summary

JdbcCategoryManagerImpl()

## Method Summary

`public void` | `addItem`(`CatalogRequest` request, `CategoryKey` categoryKey, `ProductItemKey` itemKey) Adds an item to the specified category.
`public void` | `createCategory`(`CatalogRequest` request, `CategoryKey` parentKey, `Category` category) Creates a sub category within the supplied parent category.
`public void` | `ejbActivate`() ejbActivate method.
`public void` | `ejbCreate`() ejbCreate method.
`public void` | `ejbPassivate`() ejbPassivate method.
`public void` | `ejbPostCreate`() ejbPostCreate method.
`public void` | `ejbRemove`() ejbRemove method.
`public `Category`[]` | `getAncestors`(`CatalogRequest` request, `CategoryKey` categoryKey) Returns the ancestors of the specified category in ascending order.
`public `Category`[]` | `getCategories`(`CatalogRequest` request, `CategoryKey`[] categoryKeys) Returns the categories with the given category keys.
`public `ViewIterator`` | `getCategories`(`CatalogRequest` request, int viewSize) Returns a ViewIterator over all existing categories.
`public `Category`` | `getCategory`(`CatalogRequest` request, `CategoryKey` categoryKey) Returns the category with the given category key.
`public int` | `getCategoryCount`(`CatalogRequest` request) Returns the total number of categories in the product catalog.
`public `CategoryKey`[]` | `getCategoryKeys`(`CatalogRequest` request, int beginIndex, int endIndex) Returns an array of all existing category keys within the specified ordered range.
`public `CategoryKey`[]` | `getItemCategories`(`CatalogRequest` request, `ProductItemKey` productKey) Gets all the categories that an item is a part of.
`public `CategoryKey`[][]` | `getItemCategories`(`CatalogRequest` request, `ProductItemKey`[] productKeys) Returns an array of arrays of all the categories that items are part of.
`public int` | `getItemCount`(`CatalogRequest` request, `CategoryKey` categoryKey) Returns the number of product items associated with the specified category.
`public `ProductItemKey`[]` | `getItemKeys`(`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 `ViewIterator`` | `getItems`(`CatalogRequest` request, `CategoryKey` categoryKey, int viewSize) Returns a ViewIterator over all product items of the specified category.
`public int` | `getOrphanedItemCount`(`CatalogRequest` request) Returns the number of orphaned items in the catalog.
`public `ProductItemKey`[]` | `getOrphanedItemKeys`(`CatalogRequest` request, int beginIndex, int endIndex) Returns an array of all existing orphaned category keys within the specified ordered range.
`public `ViewIterator`` | `getOrphanedItems`(`CatalogRequest` request, int viewSize) Returns a ViewIterator over all existing orphaned categories.
`public `Category`` | `getParent`(`CatalogRequest` request, `CategoryKey` categoryKey) Returns the parent of the specified category.
`public `Category`` | `getRootCategory`(`CatalogRequest` request) Returns the root category.
`public int` | `getSiblingCount`(`CatalogRequest` request, `CategoryKey` categoryKey) Returns the number of siblings associated with the specified category.
`public `CategoryKey`[]` | `getSiblingKeys`(`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 `ViewIterator`` | `getSiblings`(`CatalogRequest` request, `CategoryKey` categoryKey, int viewSize) Returns a ViewIterator over all siblings of the specified category.
`public `ViewIterator`` | `getSubCategories`(`CatalogRequest` request, `CategoryKey` categoryKey, int viewSize) Returns a ViewIterator over all sub categories of the specified category.
`public int` | `getSubCategoryCount`(`CatalogRequest` request, `CategoryKey` categoryKey) Returns the number of sub categories associated with the specified category.
`public `CategoryKey`[]` | `getSubCategoryKeys`(`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` | `moveCategory`(`CatalogRequest` request, `CategoryKey` categoryKey, `CategoryKey` newParentKey) Moves the specifed category.
`public void` | `removeCategory`(`CatalogRequest` request, `CategoryKey` categoryKey) Removes the specifed category.
`public void` | `removeItem`(`CatalogRequest` request, `CategoryKey` categoryKey, `ProductItemKey` itemKey) Removes an item from the specified category.
`public void` | `setSessionContext`(`SessionContext` ctx) setSessionContext method.
`public void` | `updateCategory`(`CatalogRequest` request, `Category` category) Updates the specifed category.

Methods from `com.beasys.commerce.ebusiness.catalog.service.`JdbcCatalogServiceImpl``
``getCatalogSchemaName`, `getCatalogSqlManager`, `getCatalogSqlManager`, `getCatalogSqlManagerName`, `getDatabaseConnection`, `getJdbcCatalogFactory`,`

Methods from `com.beasys.commerce.ebusiness.catalog.service.`CatalogServiceImpl``
``ejbActivate`, `ejbCreate`, `ejbPassivate`, `ejbPostCreate`, `ejbRemove`, `getCatalogManager`, `getCatalogManagerJndiName`, `setSessionContext`, `validateAuthorization``

Methods from `com.beasys.commerce.foundation.`SessionImpl``
``clearRelationalBinding`, `clearRelationalBinding`, `clearRelationalBinding`, `clearRelationalBinding`, `doRelationalBinding`, `doRelationalBinding`, `doRelationalBindingOnElement`, `doRelationalBindingOnElement`, `doRelationalBindingOnElement`, `doRelationalBindingOnSingleton`, `doRelationalBindingOnSingleton`, `doRelationalBindingOnSingleton`, `doRelationalBindingWithMapKey`, `doRelationalBindingWithMapKey`, `doRelationalBindingWithMapKey`, `ejbActivate`, `ejbCreate`, `ejbPassivate`, `ejbPostCreate`, `ejbRemove`, `enumerateRelationalBinding`, `enumerateRelationalBinding`, `getEnvironmentNamingContext`, `getEnvironmentProperty`, `getEnvironmentProperty`, `getEnvironmentPropertyCache`, `getPersistenceHelperPlugin`, `getSessionContext`, `setSessionContext``

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods from interface `javax.ejb.`SessionBean``
`ejbActivate, ejbPassivate, ejbRemove, setSessionContext`

## Constructor Detail

### JdbcCategoryManagerImpl

    public JdbcCategoryManagerImpl()

## Method Detail

### addItem(CatalogRequest, CategoryKey, ProductItemKey) Method

    public void addItem(CatalogRequest request,
                        CategoryKey categoryKey,
                        ProductItemKey itemKey)
         throws CatalogFinderException, CatalogException

Adds an item to the specified category.

#### Parameters

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.

### createCategory(CatalogRequest, CategoryKey, Category) Method

    public void createCategory(CatalogRequest request,
                               CategoryKey parentKey,
                               Category category)
         throws CatalogCreateException, CatalogException

Creates a sub category within the supplied parent category.

#### Parameters

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.

### ejbActivate() Method

    public void ejbActivate()
         throws EJBException

Description copied from `SessionImpl.ejbActivate()`
ejbActivate method.

Overrides
  `JdbcCatalogServiceImpl.ejbActivate()`

#### Exceptions

``EJBException``

### ejbCreate() Method

    public void ejbCreate()
         throws CreateException

Description copied from `SessionImpl.ejbCreate()`
ejbCreate method.

Overrides
  `JdbcCatalogServiceImpl.ejbCreate()`

#### Exceptions

``CreateException``

### ejbPassivate() Method

    public void ejbPassivate()
         throws EJBException

Description copied from `SessionImpl.ejbPassivate()`
ejbPassivate method.

Overrides
  `JdbcCatalogServiceImpl.ejbPassivate()`

#### Exceptions

``EJBException``

### ejbPostCreate() Method

    public void ejbPostCreate()
         throws CreateException

Description copied from `SessionImpl.ejbPostCreate()`
ejbPostCreate method.

Overrides
  `JdbcCatalogServiceImpl.ejbPostCreate()`

#### Exceptions

``CreateException``

### ejbRemove() Method

    public void ejbRemove()
         throws EJBException

Description copied from `SessionImpl.ejbRemove()`
ejbRemove method.

Overrides
  `JdbcCatalogServiceImpl.ejbRemove()`

#### Exceptions

``EJBException``

### getAncestors(CatalogRequest, CategoryKey) Method

    public Category[] getAncestors(CatalogRequest request,
                                 CategoryKey categoryKey)
         throws CatalogException

Returns the ancestors of the specified category in ascending order.

#### Parameters

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.

### getCategories(CatalogRequest, CategoryKey[]) Method

    public Category[] getCategories(CatalogRequest request,
                                  CategoryKey[] categoryKeys)
         throws CatalogFinderException, CatalogException

Returns the categories with the given category keys.

#### Parameters

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.

### getCategories(CatalogRequest, int) Method

    public ViewIterator getCategories(CatalogRequest request,
                                      int viewSize)
         throws RemoteException, CatalogException

Returns a ViewIterator over all existing categories.

#### Parameters

request
  The catalog request object.

viewSize
  The view size of the returned ViewIterator.

#### Returns

A ViewIterator over the categories.

#### Exceptions

``RemoteException``
``CatalogException``
  on general error.

### getCategory(CatalogRequest, CategoryKey) Method

    public Category getCategory(CatalogRequest request,
                                CategoryKey categoryKey)
         throws CatalogFinderException, CatalogException

Returns the category with the given category key.

#### Parameters

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.

### getCategoryCount(CatalogRequest) Method

    public int getCategoryCount(CatalogRequest request)
         throws CatalogException

Returns the total number of categories in the product catalog.

#### Parameters

request
  The catalog request object.

#### Returns

The total number of categories in the product catalog.

#### Exceptions

``CatalogException``
  on general error.

### getCategoryKeys(CatalogRequest, int, int) Method

    public CategoryKey[] getCategoryKeys(CatalogRequest request,
                                       int beginIndex,
                                       int endIndex)
         throws CatalogException

Returns an array of all existing category keys within the specified ordered range.

#### Parameters

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.

### getItemCategories(CatalogRequest, ProductItemKey) Method

    public CategoryKey[] getItemCategories(CatalogRequest request,
                                         ProductItemKey productKey)
         throws RemoteException, CatalogFinderException, CatalogException

Gets all the categories that an item is a part of.

#### Parameters

request
  The catalog request object.

productKey
  ProductItemKey of the product item concerned.

#### Returns

An array of category keys.

#### Exceptions

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

### getItemCategories(CatalogRequest, ProductItemKey[]) Method

    public CategoryKey[][] getItemCategories(CatalogRequest request,
                                         ProductItemKey[] productKeys)
         throws RemoteException, CatalogException

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

request
  The catalog request object.

productKeys
  Array of ProductItemKeys.

#### Returns

An array of arrays of category keys.

#### Exceptions

``RemoteException``
``CatalogException``
  on general error.

### getItemCount(CatalogRequest, CategoryKey) Method

    public int getItemCount(CatalogRequest request,
                            CategoryKey categoryKey)
         throws CatalogFinderException, CatalogException

Returns the number of product items associated with the specified category.

#### Parameters

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.

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

    public ProductItemKey[] getItemKeys(CatalogRequest request,
                                      CategoryKey categoryKey,
                                      int beginIndex,
                                      int endIndex)
         throws CatalogException

Returns an array of all product item keys of the specified category within the specified ordered range.

#### Parameters

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.

### getItems(CatalogRequest, CategoryKey, int) Method

    public ViewIterator getItems(CatalogRequest request,
                                 CategoryKey categoryKey,
                                 int viewSize)
         throws RemoteException, CatalogException

Returns a ViewIterator over all product items of the specified category.

#### Parameters

request
  The catalog request object.

categoryKey
  The key of the target category.

viewSize
  The view size of the returned ViewIterator.

#### Returns

A ViewIterator over all product items.

#### Exceptions

``RemoteException``
``CatalogException``
  on general error.

### getOrphanedItemCount(CatalogRequest) Method

    public int getOrphanedItemCount(CatalogRequest request)
         throws CatalogException

Returns the number of orphaned items in the catalog.

#### Parameters

request
  The catalog request object.

#### Returns

The number of orphaned items in the catalog.

#### Exceptions

``CatalogException``
  on general error.

### getOrphanedItemKeys(CatalogRequest, int, int) Method

    public ProductItemKey[] getOrphanedItemKeys(CatalogRequest request,
                                              int beginIndex,
                                              int endIndex)
         throws CatalogException

Returns an array of all existing orphaned category keys within the specified ordered range.

#### Parameters

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.

### getOrphanedItems(CatalogRequest, int) Method

    public ViewIterator getOrphanedItems(CatalogRequest request,
                                         int viewSize)
         throws RemoteException, CatalogException

Returns a ViewIterator over all existing orphaned categories.

#### Parameters

request
  The catalog request object.

viewSize
  The view size of the returned ViewIterator.

#### Returns

A ViewIterator over all existing orphaned categories.

#### Exceptions

``RemoteException``
``CatalogException``
  on general error.

### getParent(CatalogRequest, CategoryKey) Method

    public Category getParent(CatalogRequest request,
                              CategoryKey categoryKey)
         throws CatalogFinderException, CatalogException

Returns the parent of the specified category.

#### Parameters

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.

### getRootCategory(CatalogRequest) Method

    public Category getRootCategory(CatalogRequest request)
         throws CatalogCreateException, CatalogException

Returns the root category. If the root cattegory does not exist, it will be created.

#### Parameters

request
  The catalog request object.

#### Returns

The root category.

#### Exceptions

``CatalogCreateException``
  if the root category could not be created.
``CatalogException``
  on general error.

### getSiblingCount(CatalogRequest, CategoryKey) Method

    public int getSiblingCount(CatalogRequest request,
                               CategoryKey categoryKey)
         throws CatalogFinderException, CatalogException

Returns the number of siblings associated with the specified category.

#### Parameters

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.

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

    public CategoryKey[] getSiblingKeys(CatalogRequest request,
                                      CategoryKey categoryKey,
                                      int beginIndex,
                                      int endIndex)
         throws CatalogException

Returns an array of all exististing sibling keys of the specified category within the specified ordered range.

#### Parameters

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.

### getSiblings(CatalogRequest, CategoryKey, int) Method

    public ViewIterator getSiblings(CatalogRequest request,
                                    CategoryKey categoryKey,
                                    int viewSize)
         throws RemoteException, CatalogException

Returns a ViewIterator over all siblings of the specified category.

#### Parameters

request
  The catalog request object.

categoryKey
  The key of the target category.

viewSize
  The view size of the returned ViewIterator.

#### Returns

A ViewIterator over all siblings.

#### Exceptions

``RemoteException``
``CatalogException``
  on general error.

### getSubCategories(CatalogRequest, CategoryKey, int) Method

    public ViewIterator getSubCategories(CatalogRequest request,
                                         CategoryKey categoryKey,
                                         int viewSize)
         throws RemoteException, CatalogException

Returns a ViewIterator over all sub categories of the specified category.

#### Parameters

request
  The catalog request object.

categoryKey
  The key of the target category.

viewSize
  The view size of the returned ViewIterator.

#### Returns

A ViewIterator over all the sub categories.

#### Exceptions

``RemoteException``
``CatalogException``
  on general error.

### getSubCategoryCount(CatalogRequest, CategoryKey) Method

    public int getSubCategoryCount(CatalogRequest request,
                                   CategoryKey categoryKey)
         throws CatalogFinderException, CatalogException

Returns the number of sub categories associated with the specified category.

#### Parameters

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.

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

    public CategoryKey[] getSubCategoryKeys(CatalogRequest request,
                                          CategoryKey categoryKey,
                                          int beginIndex,
                                          int endIndex)
         throws CatalogException

Returns an array of all sub category keys of the specified category within the specified ordered range.

#### Parameters

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.

### moveCategory(CatalogRequest, CategoryKey, CategoryKey) Method

    public void moveCategory(CatalogRequest request,
                             CategoryKey categoryKey,
                             CategoryKey newParentKey)
         throws CatalogFinderException, CatalogException

Moves the specifed category.

#### Parameters

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.

### removeCategory(CatalogRequest, CategoryKey) Method

    public void removeCategory(CatalogRequest request,
                               CategoryKey categoryKey)
         throws CatalogRemoveException, CatalogFinderException, CatalogException

Removes the specifed category.

#### Parameters

request
  The catalog request object.

categoryKey
  The key of the target category.

#### Exceptions

``CatalogRemoveException``
  if the specified category could not be removed.
``CatalogFinderException``
  if the specified category could not be found.
``CatalogException``
  on general error.

### removeItem(CatalogRequest, CategoryKey, ProductItemKey) Method

    public void removeItem(CatalogRequest request,
                           CategoryKey categoryKey,
                           ProductItemKey itemKey)
         throws CatalogFinderException, CatalogException

Removes an item from the specified category.

#### Parameters

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.

### setSessionContext(SessionContext) Method

    public void setSessionContext(SessionContext ctx)
         throws EJBException

Description copied from `SessionImpl.setSessionContext(SessionContext)`
setSessionContext method.

Overrides
  `JdbcCatalogServiceImpl.setSessionContext(SessionContext)`

#### Exceptions

``EJBException``

### updateCategory(CatalogRequest, Category) Method

    public void updateCategory(CatalogRequest request,
                               Category category)
         throws CatalogFinderException, CatalogException

Updates the specifed category.

#### Parameters

request
  The catalog request object.

category
  The category to update.

#### Exceptions

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