|
Rakesh API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbiz.wedoit4u.databeans.CustomerTypeBean
public class CustomerTypeBean
A Java Bean that represents a record in the customer_types
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_type_id
and the foreign key column partner_id.
Copyright 2003, Rakesh Vidyadharan
| Field Summary | |
|---|---|
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. |
private int |
customerTypeId
The value in the customer_type_id column. |
java.lang.String |
description
The value in the description column. |
private static java.lang.Object |
lockObject
An object that is used to synchronise modifications
to the system cache of instances of these beans. |
private int |
partnerId
The value in the partner_id foreign key column. |
java.lang.String |
type
The value in the type column. |
| Constructor Summary | |
|---|---|
private |
CustomerTypeBean()
The default constructor. |
| Method Summary | |
|---|---|
static CustomerTypeBean |
create(int customerTypeId,
java.lang.String type,
java.lang.String description,
int partnerId)
Create a new instance of the bean that may be used to create a corresponding record in the customer_types table. |
static void |
delete(CustomerTypeBean 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 customer_types table. |
static java.util.Collection |
findByPartner(int partnerId)
Return a Collection of bean instances that represent
all the records in the customer_types table that
belong to the specified partner. |
int |
getCustomerTypeId()
Returns customerTypeId. |
static CustomerTypeBean |
getInstance(int customerTypeId)
Fetch the instance of the bean identified by the primary
key value specified. |
int |
getPartnerId()
Returns partnerId. |
void |
save()
Write back all the values in the bean fields to the database. |
static void |
setInstance(CustomerTypeBean ctb)
Add the specified bean instance to the system cache. |
(package private) void |
setPartnerId(int partnerId)
Set partnerId. |
| 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 customerTypeId
customer_type_id column.
public java.lang.String type
type column.
public java.lang.String description
description column.
private int partnerId
partner_id foreign key column.
| Constructor Detail |
|---|
private CustomerTypeBean()
| Method Detail |
|---|
public static final CustomerTypeBean create(int customerTypeId,
java.lang.String type,
java.lang.String description,
int partnerId)
throws CMAException
customer_types table.
If you wish the database sequence value be used to populate
the customer_type_id value, then specify a value
of 0 for customerTypeId. All new instances
created are added to the system cache, unless they are created
with a customerId value of 0.
customerTypeId - - The primary key value to use.type - - The code name used to identify the customer
type.description - - A detailed description about the
type of customer that is being created.partnerId - - The foreign key to the partner table.
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(CustomerTypeBean 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.CustomerTypeHelper.delete( int )
public void save()
throws CMAException
customer_types 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 java.util.Collection findAll()
throws CMAException
Collection of bean instances that represent
all the records in the customer_types table.
CMAException - - If errors are encountered while fetching
all the bean instances.
public static final java.util.Collection findByPartner(int partnerId)
throws CMAException
Collection of bean instances that represent
all the records in the customer_types table that
belong to the specified partner.
partnerId - - The partner_id foreign key
value.
CMAException - - If errors are encountered while fetching
all the bean instances.
public static final CustomerTypeBean getInstance(int customerTypeId)
throws CMAException
primary
key value specified. If the bean instance does not exist
in the cache, try to fetch it from the database.
customerTypeId - - The customer_type_id
value based upon which to fetch the instance.
CMAException - - If the specified bean instance is not
available in the system cache.public static final void setInstance(CustomerTypeBean 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 getCustomerTypeId()
customerTypeId.
public final int getPartnerId()
partnerId.
final void setPartnerId(int partnerId)
partnerId.
partnerId - - The value to set.
|
Rakesh API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||