Rakesh API

biz.wedoit4u
Class CSSGenerator

java.lang.Object
  extended by biz.wedoit4u.CSSGenerator

public final class CSSGenerator
extends java.lang.Object

Generate a full CSS string from the values in the style_attributes table for a specified customer. The CSS values may be retrieved as a regular Java String, or be written out to a file for use in a web server.

Copyright 2003, Rakesh Vidyadharan and wedoit4u.biz

Version:
$Id: CSSGenerator.java,v 1.3 2004/05/26 11:42:30 rakesh Exp $
Author:
Rakesh Vidyadharan 16th November 2003

Field Summary
private  java.lang.String cssContents
          String that holds the entire CSS contents for the customer identified by customerId.
private  int customerId
          The customer for whom the CSS contents are being generated.
 
Constructor Summary
CSSGenerator(int customerId)
          Create a new instance of the class for the specified customer.
 
Method Summary
 java.lang.String getCssContents()
          Returns cssContents.
private  void loadCSSContents()
          Fetch all the style attributes associated with the customer, and populate the cssContents instance variable.
 void writeToFile(java.lang.String fileName)
          Write the contents of cssContents to the file specified.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

customerId

private int customerId
The customer for whom the CSS contents are being generated. Maps to the customer_id value.


cssContents

private java.lang.String cssContents
String that holds the entire CSS contents for the customer identified by customerId.

Constructor Detail

CSSGenerator

public CSSGenerator(int customerId)
             throws CMAException
Create a new instance of the class for the specified customer. Initialises the customerId instance variable, and then fetches all the style attributes associated with that customer. Populates the cssContents value using loadCSSContents().

Parameters:
customerId - - The customer_id value to use to generate the CSS contents.
Throws:
CMAException - - If errors are encountered while fetching the associated style classes for the customer.
Method Detail

loadCSSContents

private void loadCSSContents()
                      throws CMAException
Fetch all the style attributes associated with the customer, and populate the cssContents instance variable.

Throws:
CMAException - - If errors are encountered while fetching the associated style classes for the customer.

writeToFile

public void writeToFile(java.lang.String fileName)
                 throws java.io.FileNotFoundException
Write the contents of cssContents to the file specified.

Parameters:
fileName - - The fully qualified name of the file (ie. the file with full path - absolute or relative desired) to which the CSS contents are to be written.
Throws:
java.io.FileNotFoundException - - If the specified file could not be opened for read/write

getCssContents

public final java.lang.String getCssContents()
Returns cssContents.

Returns:
String - The value/reference of/to cssContents.

Rakesh API

Copyright © 2002-2005 - Rakesh Vidyadharan