|
Rakesh API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbiz.wedoit4u.databeans.CustomerBean
public class CustomerBean
A java bean that represents a record in the customers
table. This bean is used to cache the values read
from the database, and to make modifications you need to the bean
fields, and then send it back to the database for updating the
associated record. All instances of this class are cached into a
Map object that is stored in the
System.getProperties() object under a property with
name CACHE_NAME. All instances variables are public except
the primary key column customer_id.
Copyright 2003, Rakesh Vidyadharan
| Field Summary | |
|---|---|
java.util.Date |
activationDate
The value in the activation_date column. |
char |
active
The value in the active column. |
private static java.util.Map |
cache
The Map that is used to cache instances
of this bean. |
static java.lang.String |
CACHE_NAME
A constant that denotes the name of the system property at which all instances of this class are cached. |
java.util.Date |
creationDate
The value in the creation_date column. |
private int |
customerId
The value in the customer_id column. |
int |
customerTypeId
The value in the customer_type_id column. |
java.lang.String |
domain
The value in the domain column. |
java.lang.String |
email
The value in the email column. |
java.util.Date |
expirationDate
The value in the expiration_date column. |
private static java.lang.Object |
lockObject
An object that is used to synchronise modifications
to the system cache of instances of these beans. |
java.lang.String |
password
The value in the password column. |
java.lang.String |
username
The value in the username column. |
| Constructor Summary | |
|---|---|
private |
CustomerBean()
Default constructor. |
| Method Summary | |
|---|---|
static CustomerBean |
create(int customerId,
java.lang.String username,
java.lang.String password,
java.lang.String email,
java.lang.String domain,
char active,
java.util.Date activationDate,
java.util.Date expirationDate,
int customerTypeId)
Create a new customers record with the values
specified for all the columns in the table. |
static void |
delete(CustomerBean cb)
Delete the specified instance of this class from the system cache as well as from the database. |
static java.util.Collection |
findAll()
Return a Collection of bean instances that represent
all the records in the customers table. |
static java.util.Collection |
findByCustomerType(int customerTypeId)
Return a Collection of bean instances that represent
all the records in the customers table that are
associated with the specified customer_type_id. |
private static java.util.Collection |
getCollection(java.util.Collection list)
Return a Collection of bean instances from the
specified Collection of primary key values. |
int |
getCustomerId()
Returns customerId. |
static CustomerBean |
getInstance(int customerId)
Fetch the instance of the bean from the system cache indentified by the primary key column customerId. |
static CustomerBean |
getInstance(java.lang.String username,
java.lang.String password)
Return the bean instance identified by the username
and password values specified. |
void |
save()
Write back all the values in the bean fields to the database. |
static void |
setInstance(CustomerBean ctb)
Add the specified bean instance to the system cache. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final java.lang.Object lockObject
synchronise modifications
to the system cache of instances of these beans.
private static final java.util.Map cache
Map that is used to cache instances
of this bean.
public static final java.lang.String CACHE_NAME
private int customerId
customer_id column.
public java.lang.String username
username column.
public java.lang.String password
password column.
public java.lang.String email
email column.
public java.lang.String domain
domain column.
public char active
active column.
public java.util.Date creationDate
creation_date column.
public java.util.Date activationDate
activation_date column.
public java.util.Date expirationDate
expiration_date column.
public int customerTypeId
customer_type_id column.
| Constructor Detail |
|---|
private CustomerBean()
| Method Detail |
|---|
public static final CustomerBean create(int customerId,
java.lang.String username,
java.lang.String password,
java.lang.String email,
java.lang.String domain,
char active,
java.util.Date activationDate,
java.util.Date expirationDate,
int customerTypeId)
throws CMAException
customers record with the values
specified for all the columns in the table. If you wish
to use the database sequence to generate the customer_id value,
specify a value of 0 for the customer_id.
Creating a new instance will also add the new instance of the
system cache, unless the customerId value specified is
0.
customerId - - The customer_id value.username - - The username value.password - - The password value.email - - The email value. This
may be null.domain - - The domain value. This
may be null.active - - The active value.activationDate - - The activation_date
value.expirationDate - - The expiration_date
value.customerTypeId - - The customer_type_id
value.
CMAException - - If an attempt is made to create an instance
of the object that already exists, as identified by the
customerTypeId value.
public static final void delete(CustomerBean cb)
throws CMAException
cb - - The bean instance that is to be removed.
CMAException - - If errors are encountered while removing
the associated record in the database.
public void save()
throws CMAException
customers table are
updated with the values in the bean fields.
CMAException - - If errors are encountered while writing
the values to the database.
public static final CustomerBean getInstance(int customerId)
throws CMAException
customerId.
customerId - - The primary key value based upon which
to find the appropriate bean instance.
CMAException - - If the appropriate bean instance is not
found.
public static final java.util.Collection findAll()
throws CMAException
Collection of bean instances that represent
all the records in the customers table.
CMAException - - If errors are encountered while fetching
all the bean instances.
public static final java.util.Collection findByCustomerType(int customerTypeId)
throws CMAException
Collection of bean instances that represent
all the records in the customers table that are
associated with the specified customer_type_id.
customerTypeId - - The customer_type_id
foreign key.
CMAException - - If errors are encountered while fetching
all the bean instances.
private static final java.util.Collection getCollection(java.util.Collection list)
throws CMAException
Collection of bean instances from the
specified Collection of primary key values.
list - - The Collection of primary key values.
CMAException - - If errors are encountered while fetching
the bean instances.
public static final CustomerBean getInstance(java.lang.String username,
java.lang.String password)
throws CMAException
username
and password values specified.
username - - The username value.password - - The password value.
CMAException - - If errors are encountered while fetching
the bean instance.public static final void setInstance(CustomerBean ctb)
Map
interface in that, if an entry with the same key already exists,
then that entry is replaced, or a new one created. This method
uses the lockObject to synchronise
modifications to the Map cache.
ctb - - The instance that is being added to
the system cache.public final int getCustomerId()
customerId.
|
Rakesh API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||