|
Rakesh API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbiz.wedoit4u.databeans.CategoryBean
public class CategoryBean
A Java Bean that is used to represent a record in the
categories table. This bean can be used to cache the
contents of a database record, as well as insulate entity beans from
client code. All instance variables are public, except the primary
key column (category_id), which has only a accessor.
All instances of this class are cached in the runtime environment
System.getProperties(), under a property indentified
by the value of CACHE_NAME.
Copyright 2003, Rakesh Vidyadharan
| Field Summary | |
|---|---|
java.lang.String |
brief
The value in the brief 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. |
private int |
categoryId
The value in category_id column. |
int |
customerId
The value in the customer_id column. |
java.lang.String |
description
The value of 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. |
java.lang.String |
longName
The value in the long_name column. |
java.lang.String |
menuName
The value in the menu_name column. |
java.lang.String |
picture
The value in the picture column. |
int |
sortOrder
The value of the sort_order column. |
| Constructor Summary | |
|---|---|
private |
CategoryBean()
Default constructor. |
| Method Summary | |
|---|---|
static CategoryBean |
create(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)
Create a new category record with all the column
values. |
static void |
delete(CategoryBean 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 categories table. |
static java.util.Collection |
findByCustomer(int customerId)
Return a Collection of bean instances that represent
all the records in the categories table that are
associated with the specified customer_id. |
int |
getCategoryId()
Returns the value in category_id column. |
private static java.util.Collection |
getCollection(java.util.Collection list)
Return a Collection of bean instances from the
specified Collection of primary key values. |
static CategoryBean |
getInstance(int categoryId)
Fetch the instance of the bean identified by the primary
key value specified. |
void |
save()
Write back all the values in the bean fields to the database. |
static void |
setInstance(CategoryBean 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 categoryId
category_id column.
public int customerId
customer_id column.
public java.lang.String menuName
menu_name column.
public java.lang.String longName
long_name column.
public java.lang.String brief
brief column.
public java.lang.String picture
picture column.
public java.lang.String description
description column.
public int sortOrder
sort_order column.
| Constructor Detail |
|---|
private CategoryBean()
| Method Detail |
|---|
public static final CategoryBean create(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 CMAException
category record with all the column
values. When creating a temporary instace (for client code)
specify a value of 0 for the customerId
parameter. Creating a new instance of the class also adds the
new instance to the system cache, unless the categoryId value
is 0.
categoryId - - The category_id value.customerId - - The customer_id value.menuName - - The value for the menu_name
column.longName - - The value for the long_name
column.brief - - The value for the brief column.picture - - The value for the picture
column.description - - The value for the description
column.sortOrder - - The value for the sort_order
column.
CMAException - - If an attempt is made to create an instance
of the object that already exists, as identified by the
customerTypeId value.
public void save()
throws CMAException
categories 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 void delete(CategoryBean 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 static final CategoryBean getInstance(int categoryId)
throws CMAException
primary
key value specified.
categoryId - - The category_id value that
uniquely identifies an instance of this object.
CMAException - - If the bean instance is not available in
the system cache.
public static final java.util.Collection findAll()
throws CMAException
Collection of bean instances that represent
all the records in the categories table.
CMAException - - If errors are encountered while fetching
all the bean instances.
public static final java.util.Collection findByCustomer(int customerId)
throws CMAException
Collection of bean instances that represent
all the records in the categories table that are
associated with the specified customer_id.
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 void setInstance(CategoryBean 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 getCategoryId()
category_id column.
|
Rakesh API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||