Rakesh API

biz.wedoit4u.databeans
Class CustomerStyleBean

java.lang.Object
  extended by biz.wedoit4u.databeans.CustomerStyleBean
All Implemented Interfaces:
java.io.Serializable

public class CustomerStyleBean
extends java.lang.Object
implements java.io.Serializable

A Java Bean that represents a record in the customer_styles 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 style_class_id.

Copyright 2003, Rakesh Vidyadharan

Version:
$Id: CustomerStyleBean.java,v 1.2 2004/05/26 11:42:31 rakesh Exp $
Author:
Rakesh Vidyadharan on 16th September 2003
See Also:
Serialized Form

Field Summary
 java.lang.String backgroundColor
          The value in the background_color column.
 java.lang.String borderStyle
          The value in the border_style column.
 java.lang.String borderWidth
          The value in the border_width 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.lang.String color
          The value in the color column.
private  int customerId
          The value in the customer_id column.
 java.lang.String fontFamily
          The value in the font_family column.
 java.lang.String fontSize
          The value in the font_size column.
 java.lang.String fontWeight
          The value in the font_weight column.
 java.lang.String height
          The value in the height column.
private static java.lang.Object lockObject
          An object that is used to synchronise modifications to the system cache of instances of these beans.
 int paddingBottom
          The value in the padding_bottom column.
 int paddingLeft
          The value in the padding_left column.
 int paddingRight
          The value in the padding_right column.
 int paddingTop
          The value in the padding_top column.
private  int styleClassId
          The value in the style_class_id column.
 java.lang.String textAlign
          The value in the text_align column.
 java.lang.String textDecoration
          The value in the text_decoration column.
 java.lang.String verticalAlign
          The value in the vertical_align column.
 java.lang.String width
          The value in the width column.
 
Constructor Summary
private CustomerStyleBean()
          The default constructor.
 
Method Summary
static CustomerStyleBean create(int styleClassId, int customerId, java.lang.String color, java.lang.String fontFamily, java.lang.String fontWeight, java.lang.String fontSize, java.lang.String backgroundColor, java.lang.String textAlign, java.lang.String verticalAlign, java.lang.String width, java.lang.String height, java.lang.String borderStyle, java.lang.String borderWidth, int paddingTop, int paddingLeft, int paddingRight, int paddingBottom, java.lang.String textDecoration)
          Create a new instance of the bean that may be used to create a corresponding record in the customer_styles table.
static void delete(CustomerStyleBean sab)
          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_styles table.
static java.util.Collection findByCustomer(int customerId)
          Return a Collection of bean instances that represent all the records in the customer_styles table that are associated with the specified customer_id.
 int getCustomerId()
          Returns customerId.
static CustomerStyleBean getInstance(CustomerStylesPK pk)
          Fetch the instance of the bean identified by the primary key value specified.
 int getStyleClassId()
          Returns styleClassId.
 void save()
          Write back all the values in the bean fields to the database.
static void setInstance(CustomerStyleBean sab)
          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

lockObject

private static final java.lang.Object lockObject
An object that is used to synchronise modifications to the system cache of instances of these beans.


cache

private static final java.util.Map cache
The Map that is used to cache instances of this bean.


CACHE_NAME

public static final java.lang.String CACHE_NAME
A constant that denotes the name of the system property at which all instances of this class are cached.

See Also:
Constant Field Values

styleClassId

private int styleClassId
The value in the style_class_id column. This column is part of the compound primary key for this table.


customerId

private int customerId
The value in the customer_id column. This column is part of the compound primary key for this table.


color

public java.lang.String color
The value in the color column.


fontFamily

public java.lang.String fontFamily
The value in the font_family column.


fontWeight

public java.lang.String fontWeight
The value in the font_weight column.


fontSize

public java.lang.String fontSize
The value in the font_size column.


backgroundColor

public java.lang.String backgroundColor
The value in the background_color column.


textAlign

public java.lang.String textAlign
The value in the text_align column.


verticalAlign

public java.lang.String verticalAlign
The value in the vertical_align column.


width

public java.lang.String width
The value in the width column.


height

public java.lang.String height
The value in the height column.


borderStyle

public java.lang.String borderStyle
The value in the border_style column.


borderWidth

public java.lang.String borderWidth
The value in the border_width column.


paddingTop

public int paddingTop
The value in the padding_top column.


paddingLeft

public int paddingLeft
The value in the padding_left column.


paddingRight

public int paddingRight
The value in the padding_right column.


paddingBottom

public int paddingBottom
The value in the padding_bottom column.


textDecoration

public java.lang.String textDecoration
The value in the text_decoration column.

Constructor Detail

CustomerStyleBean

private CustomerStyleBean()
The default constructor. Cannot be directly instantiated.

Method Detail

create

public static final CustomerStyleBean create(int styleClassId,
                                             int customerId,
                                             java.lang.String color,
                                             java.lang.String fontFamily,
                                             java.lang.String fontWeight,
                                             java.lang.String fontSize,
                                             java.lang.String backgroundColor,
                                             java.lang.String textAlign,
                                             java.lang.String verticalAlign,
                                             java.lang.String width,
                                             java.lang.String height,
                                             java.lang.String borderStyle,
                                             java.lang.String borderWidth,
                                             int paddingTop,
                                             int paddingLeft,
                                             int paddingRight,
                                             int paddingBottom,
                                             java.lang.String textDecoration)
                                      throws CMAException
Create a new instance of the bean that may be used to create a corresponding record in the customer_styles table.

Note: The compound primary key components styleClassId and customerId are both foreign key references to the style_classes.style_class_id and customers.customer_id columns.

Parameters:
styleClassId - - The primary key value to use.
customerId - - The primary key value to use.
color - - The color style attribute.
fontFamily - - The font-family style attribute.
fontWeight - - The font-weight style attribute.
fontSize - - The font-size style attribute.
backgroundColor - - The background-color style attribute.
textAlign - - The text-align style attribute.
verticalAlign - - The vertical-align style attribute.
width - - The width style attribute.
height - - The height style attribute.
borderStyle - - The border-style style attribute.
borderWidth - - The border-width style attribute.
paddingTop - - The padding-top style attribute.
paddingLeft - - The padding-left style attribute.
paddingRight - - The padding-right style attribute.
paddingBottom - - The padding-bottom style attribute.
textDecoration - - The text-decoration style attribute.
Throws:
CMAException - - If an attempt is made to create an instance of the object that already exists, as identified by the styleClassId value.

delete

public static final void delete(CustomerStyleBean sab)
                         throws CMAException
Delete the specified instance of this class from the system cache as well as from the database.

Parameters:
sab - - The bean instance that is to be removed.
Throws:
CMAException - - If errors are encountered while removing the associated record in the database.
See Also:
CustomerStyleHelper.delete( int, int )

save

public void save()
          throws CMAException
Write back all the values in the bean fields to the database. All the columns in the customer_styles table are updated with the values in the bean fields.

Throws:
CMAException - - If errors are encountered while writing the values to the database.

findAll

public static final java.util.Collection findAll()
                                          throws CMAException
Return a Collection of bean instances that represent all the records in the customer_styles table.

Returns:
Collection - The collection of java bean instances.
Throws:
CMAException - - If errors are encountered while fetching all the bean instances.

findByCustomer

public static final java.util.Collection findByCustomer(int customerId)
                                                 throws CMAException
Return a Collection of bean instances that represent all the records in the customer_styles table that are associated with the specified customer_id.

Parameters:
customerId - - The customer_id for which all associated records are to be fetched.
Returns:
Collection - The collection of java bean instances.
Throws:
CMAException - - If errors are encountered while fetching all the bean instances.

getInstance

public static final CustomerStyleBean getInstance(CustomerStylesPK pk)
                                           throws CMAException
Fetch the instance of the bean identified by the primary key value specified. If the bean instance does not exist in the cache, try to fetch it from the database.

Parameters:
pk - - The object representing the compound primary key columns for this table.
Returns:
CustomerStyleBean - The appropriate bean instance.
Throws:
CMAException - - If the specified bean instance is not available in the system cache.

setInstance

public static final void setInstance(CustomerStyleBean sab)
Add the specified bean instance to the system cache. This method follows the general contract provided by the 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.

Parameters:
sab - - The instance that is being added to the system cache.

getStyleClassId

public final int getStyleClassId()
Returns styleClassId.

Returns:
int - The value/reference of/to styleClassId.

getCustomerId

public final int getCustomerId()
Returns customerId.

Returns:
int - The value/reference of/to customerId.

Rakesh API

Copyright © 2002-2005 - Rakesh Vidyadharan