Rakesh API

biz.wedoit4u.databeans
Class PartnerHelper

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

final class PartnerHelper
extends java.lang.Object

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

Copyright 2004, Rakesh Vidyadharan and wedoit4u.biz

Version:
$Id: PartnerHelper.java,v 1.3 2004/05/26 11:42:32 rakesh Exp $
Author:
Rakesh Vidyadharan 1st January 2004

Field Summary
(package private) static java.lang.String ALL_PARTNERS
          The statement that is executed to fetch all the records from the partners table.
(package private) static java.lang.String DELETE_PARTNERS
          The delete statement to be executed to delete a record in the partners table identified by the primary key value.
(package private) static java.lang.String FIND_BY_USERNAME_AND_PASSWORD
          The statement that is executed to fetch the matching record from the partner table for the specified username value.
(package private) static java.lang.String INSERT_PARTNERS
          The statement that is executed to insert a new record into the partners table.
(package private) static java.lang.String PARTNER_ID_SEQUENCE
          The sequence set in the database for the partner_id primary key column.
(package private) static java.lang.String SELECT_PARTNERS
          The statement that is executed to fetch a specific record from the partners table.
(package private) static java.lang.String UPDATE_PARTNERS
          The update statement to be executed to update a record in the partners table.
 
Constructor Summary
private PartnerHelper()
          Default constructor.
 
Method Summary
(package private) static void delete(int partnerId)
          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 partners table.
(package private) static int findByUsernameAndPassword(java.lang.String username, java.lang.String password)
          Select the record from the partners table that has the specified username and password values.
(package private) static int insert(int partnerId, java.lang.String username, java.lang.String password, char active, java.util.Date expirationDate, java.lang.String partnerName, java.lang.String description, java.lang.String email, java.lang.String telephone, java.lang.String mobilePhone)
          Insert a new record into the partners table with the values specified.
(package private) static void select(PartnerBean pb)
          Select the specified record from the partners table.
(package private) static void update(PartnerBean pb)
          Update the values in the partners 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

PARTNER_ID_SEQUENCE

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

See Also:
Constant Field Values

ALL_PARTNERS

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

See Also:
Constant Field Values

FIND_BY_USERNAME_AND_PASSWORD

static final java.lang.String FIND_BY_USERNAME_AND_PASSWORD
The statement that is executed to fetch the matching record from the partner table for the specified username value.

See Also:
Constant Field Values

INSERT_PARTNERS

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

See Also:
Constant Field Values

SELECT_PARTNERS

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

See Also:
Constant Field Values

UPDATE_PARTNERS

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

See Also:
Constant Field Values

DELETE_PARTNERS

static final java.lang.String DELETE_PARTNERS
The delete statement to be executed to delete a record in the partners table identified by the primary key value.

See Also:
Constant Field Values
Constructor Detail

PartnerHelper

private PartnerHelper()
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 partners 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.

findByUsernameAndPassword

static final int findByUsernameAndPassword(java.lang.String username,
                                           java.lang.String password)
                                    throws java.sql.SQLException,
                                           javax.naming.NamingException
Select the record from the partners table that has the specified username and password values.

Parameters:
username - - The username value.
password - - The username value.
Returns:
int - The partner_id value.
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.

select

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

Parameters:
pb - - 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 partnerId,
                        java.lang.String username,
                        java.lang.String password,
                        char active,
                        java.util.Date expirationDate,
                        java.lang.String partnerName,
                        java.lang.String description,
                        java.lang.String email,
                        java.lang.String telephone,
                        java.lang.String mobilePhone)
                 throws java.sql.SQLException,
                        javax.naming.NamingException
Insert a new record into the partners table with the values specified.

Parameters:
partnerId - - The primary key values to use. If this is 0, then the next value from the PARTNER_ID_SEQUENCE is used.
username - - The username value.
password - - The password value.
active - - The active value.
expirationDate - - The expiration_date value.
partnerName - - The partner_name value.
description - - The description value.
email - - The email value.
telephone - - The telephone value.
mobilePhone - - The mobile_phone 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(PartnerBean pb)
                  throws java.sql.SQLException,
                         javax.naming.NamingException
Update the values in the partners table with the specified values.

Parameters:
pb - - 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 partnerId)
                  throws java.sql.SQLException,
                         javax.naming.NamingException
Delete the record from the database identified by the primary key value specified.

Parameters:
partnerId - - The partner_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