Rakesh API

biz.wedoit4u.databeans
Class CategoryHelper

java.lang.Object
  extended by biz.wedoit4u.databeans.CategoryHelper

final class CategoryHelper
extends java.lang.Object

A helper class that provides convenient methods to interact with the categories table. This class is meant to be used from the DatabaseHelper class, or other classes in this package only.

Copyright 2003, Rakesh Vidyadharan and wedoit4u.biz

Version:
$Id: CategoryHelper.java,v 1.3 2004/05/26 11:42:30 rakesh Exp $
Author:
Rakesh Vidyadharan 21st October 2003

Field Summary
(package private) static java.lang.String ALL_CATEGORIES
          The statement that is executed to fetch all the records from the categories table.
(package private) static java.lang.String CATEGORY_ID_SEQUENCE
          The sequence set in the database for the category_id primary key column.
(package private) static java.lang.String DELETE_CATEGORIES
          The delete statement that is used to delete a record from the categories table identified by the primary key value.
(package private) static java.lang.String FIND_BY_CUSTOMER
          The statement that is executed to fetch all the records from the categories table that belong to the specified customer_id.
(package private) static java.lang.String INSERT_CATEGORIES
          The statement that is executed to insert a new record into the categories table.
(package private) static java.lang.String SELECT_CATEGORIES
          The statement that is executed to fetch a specific record from the categories table.
(package private) static java.lang.String UPDATE_CATEGORIES
          The update statement to be executed to update a record in the categories table.
 
Constructor Summary
private CategoryHelper()
          Default constructor.
 
Method Summary
(package private) static void delete(int categoryId)
          Delete the record from the database identified by the primary key value specified.
(package private) static java.util.Collection findAll()
          Return a Collection of Integer values that represent all the primary key values in the categories table.
(package private) static java.util.Collection findByCustomer(int customerId)
          Return a Collection of Integer values that represent all the primary key values in the categories table that are associated with the specified customer_id.
(package private) static int insert(int categoryId, int customerId, java.lang.String menuName, java.lang.String longName, java.lang.String brief, java.lang.String picture, java.lang.String description, int sortOrder)
          Insert a new record into the categories table with the values specified.
(package private) static void select(CategoryBean cb)
          Select the specified record from the categories table.
(package private) static void update(CategoryBean cb)
          Update the values in the categories table with the specified values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CATEGORY_ID_SEQUENCE

static final java.lang.String CATEGORY_ID_SEQUENCE
The sequence set in the database for the category_id primary key column.

See Also:
Constant Field Values

ALL_CATEGORIES

static final java.lang.String ALL_CATEGORIES
The statement that is executed to fetch all the records from the categories table.

See Also:
Constant Field Values

FIND_BY_CUSTOMER

static final java.lang.String FIND_BY_CUSTOMER
The statement that is executed to fetch all the records from the categories table that belong to the specified customer_id.

See Also:
Constant Field Values

INSERT_CATEGORIES

static final java.lang.String INSERT_CATEGORIES
The statement that is executed to insert a new record into the categories table.

See Also:
Constant Field Values

SELECT_CATEGORIES

static final java.lang.String SELECT_CATEGORIES
The statement that is executed to fetch a specific record from the categories table.

See Also:
Constant Field Values

UPDATE_CATEGORIES

static final java.lang.String UPDATE_CATEGORIES
The update statement to be executed to update a record in the categories table.

See Also:
Constant Field Values

DELETE_CATEGORIES

static final java.lang.String DELETE_CATEGORIES
The delete statement that is used to delete a record from the categories table identified by the primary key value.

See Also:
Constant Field Values
Constructor Detail

CategoryHelper

private CategoryHelper()
Default constructor. Cannot be instantiated.

Method Detail

findAll

static final java.util.Collection findAll()
                                   throws java.sql.SQLException,
                                          javax.naming.NamingException
Return a Collection of Integer values that represent all the primary key values in the categories table.

Returns:
Collection - The collection of primary key values.
Throws:
java.sql.SQLException - - If errors are encountered while fetching the records from the database.
javax.naming.NamingException - - If errors are encountered while getting a connection from the connection pool.

findByCustomer

static final java.util.Collection findByCustomer(int customerId)
                                          throws java.sql.SQLException,
                                                 javax.naming.NamingException
Return a Collection of Integer values that represent all the primary key values in the categories table that are associated with the specified customer_id.

Parameters:
customerId - - The customer_id value.
Returns:
Collection - The collection of primary key values.
Throws:
java.sql.SQLException - - If errors are encountered while fetching the records from the database.
javax.naming.NamingException - - If errors are encountered while getting a connection from the connection pool.

select

static final void select(CategoryBean cb)
                  throws java.sql.SQLException,
                         javax.naming.NamingException
Select the specified record from the categories table. The values selected from the database are used to set the values of the bean fields.

Parameters:
cb - - The java bean instance that represents the record. The primary key value to use to look up the record is obtained from this bean.
Throws:
java.sql.SQLException - - If errors are encountered while fetching the record from the database.
javax.naming.NamingException - - If errors are encountered while getting a connection from the connection pool.

insert

static final int insert(int categoryId,
                        int customerId,
                        java.lang.String menuName,
                        java.lang.String longName,
                        java.lang.String brief,
                        java.lang.String picture,
                        java.lang.String description,
                        int sortOrder)
                 throws java.sql.SQLException,
                        javax.naming.NamingException
Insert a new record into the categories table with the values specified.

Parameters:
categoryId - - The primary key values to use. If this is 0, then the next value from the CATEGORY_ID_SEQUENCE is used.
customerId - - The customer_id value.
menuName - - The menu_name value.
longName - - The long_name value.
brief - - The brief value.
picture - - The picture value.
description - - The description value.
sortOrder - - The sort_order value.
Throws:
java.sql.SQLException - - If database errors are encountered while writing to the database.
javax.naming.NamingException - - If errors are encountered while getting a connection from the connection pool.

update

static final void update(CategoryBean cb)
                  throws java.sql.SQLException,
                         javax.naming.NamingException
Update the values in the categories table with the specified values.

Parameters:
cb - - The java bean that represents a record in the database.
Throws:
java.sql.SQLException - - If database errors are encountered while writing to the database.
javax.naming.NamingException - - If errors are encountered while getting a connection from the connection pool.

delete

static final void delete(int categoryId)
                  throws java.sql.SQLException,
                         javax.naming.NamingException
Delete the record from the database identified by the primary key value specified.

Parameters:
categoryId - - The category_id primary key value.
Throws:
java.sql.SQLException - - If database errors are encountered while writing to the database.
javax.naming.NamingException - - If errors are encountered while getting a connection from the connection pool.

Rakesh API

Copyright © 2002-2005 - Rakesh Vidyadharan