Rakesh API

biz.wedoit4u.databeans
Class PartnerStyleBean

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

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

A Java Bean that represents a record in the partner_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 columns style_class_id and partner_id.

Copyright 2004, Rakesh Vidyadharan

Version:
$Id: PartnerStyleBean.java,v 1.2 2004/05/26 11:42:32 rakesh Exp $
Author:
Rakesh Vidyadharan on 03rd March 2004
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.
 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 partnerId
          The value in the partner_id 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 PartnerStyleBean()
          The default constructor.
 
Method Summary
static PartnerStyleBean create(int styleClassId, int partnerId, 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 style_attributes table.
static void delete(PartnerStyleBean 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 style_attributes table.
static java.util.Collection findByPartner(int partnerId)
          Return a Collection of bean instances that represent all the records in the style_attributes table that are associated with the specified partner_id.
static PartnerStyleBean getInstance(PartnerStylesPK pk)
          Fetch the instance of the bean identified by the primary key value specified.
 int getPartnerId()
          Returns partnerId.
 int getStyleClassId()
          Returns styleClassId.
 void save()
          Write back all the values in the bean fields to the database.
static void setInstance(PartnerStyleBean 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.


partnerId

private int partnerId
The value in the partner_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

PartnerStyleBean

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

Method Detail

create

public static final PartnerStyleBean create(int styleClassId,
                                            int partnerId,
                                            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 style_attributes table.

Note: The compound primary key components styleClassId and partnerId are both foreign key references to the style_classes.style_class_id and partners.partner_id columns.

Parameters:
styleClassId - - The primary key value to use.
partnerId - - 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(PartnerStyleBean 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:
PartnerStyleHelper.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 style_attributes 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 style_attributes table.

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

findByPartner

public static final java.util.Collection findByPartner(int partnerId)
                                                throws CMAException
Return a Collection of bean instances that represent all the records in the style_attributes table that are associated with the specified partner_id.

Parameters:
partnerId - - The partner_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 PartnerStyleBean getInstance(PartnerStylesPK 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:
PartnerStyleBean - The appropriate bean instance.
Throws:
CMAException - - If the specified bean instance is not available in the system cache.

setInstance

public static final void setInstance(PartnerStyleBean 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.

getPartnerId

public final int getPartnerId()
Returns partnerId.

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

Rakesh API

Copyright © 2002-2005 - Rakesh Vidyadharan