|
Rakesh API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbiz.wedoit4u.databeans.ContentBean
public class ContentBean
The implementation of the entity bean that represents a record in the
contents 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 (content_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 |
body
The value in the body column. |
java.lang.String |
brief
The value in the picture 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. |
int |
categoryId
The value in the category_id column. |
private int |
contentId
The value in the content_id column. |
java.util.Date |
creationDate
The value in the creation_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.util.Date |
modificationDate
The value in the modification_date column. |
java.lang.String |
picture
The value in the picture column. |
java.lang.String |
title
The value in the title column. |
| Constructor Summary | |
|---|---|
private |
ContentBean()
Default constructor. |
| Method Summary | |
|---|---|
static ContentBean |
create(int contentId,
int categoryId,
java.lang.String title,
java.lang.String brief,
java.lang.String picture,
java.lang.String body)
Create a new record in the content table with all
the columns specified. |
static void |
delete(ContentBean 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 |
findByCategory(int categoryId)
Return a Collection of bean instances that represent
all the records in the categories table that are
associated with the specified category_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 |
getContentId()
Returns contentId. |
static ContentBean |
getInstance(int contentId)
Fetch the bean instance uniquely identified by the primary
key value specified from the system cache. |
void |
save()
Write back all the values in the bean fields to the database. |
static void |
setInstance(ContentBean 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 contentId
content_id column.
public int categoryId
category_id column.
public java.lang.String title
title column.
public java.lang.String brief
picture column.
public java.lang.String picture
picture column.
public java.lang.String body
body column.
public java.util.Date creationDate
creation_date column.
public java.util.Date modificationDate
modification_date column.
| Constructor Detail |
|---|
private ContentBean()
| Method Detail |
|---|
public static final ContentBean create(int contentId,
int categoryId,
java.lang.String title,
java.lang.String brief,
java.lang.String picture,
java.lang.String body)
throws CMAException
content table with all
the columns specified. When creating a temporary instace (for
client code) specify a value of 0 for the
contentId parameter. Creating a new instance of the
class also adds the new instance to the system cache, unless the
contentId value is 0.
contentId - - The new primary key value to use.categoryId - - The category_id to use
for the new content.title - - The title value to set.brief - - The brief value to set.picture - - The picture value to set.body - - The body value to set.
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
contents 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(ContentBean 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 ContentBean getInstance(int contentId)
throws CMAException
primary
key value specified from the system cache.
contentId - - The content_id primary key
value.
CMAException - - If the specified bean instance does not
exist in the 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 findByCategory(int categoryId)
throws CMAException
Collection of bean instances that represent
all the records in the categories table that are
associated with the specified category_id.
categoryId - - The category_id value.
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(ContentBean 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 getContentId()
contentId.
|
Rakesh API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||