Rakesh API

biz.wedoit4u
Class CMASession

java.lang.Object
  extended by biz.wedoit4u.Session
      extended by biz.wedoit4u.CMASession
Direct Known Subclasses:
PartnerSession

public abstract class CMASession
extends Session

A Java Bean that is used to store sessional information for a CMA user. This class also contains utility methods that are used to abstract business logic away from the presentation layer.

Copyright 2003, Rakesh Vidyadharan and wedoit4u.biz

Version:
$Id: CMASession.java,v 1.3 2004/05/26 11:42:30 rakesh Exp $
Author:
Rakesh Vidyadharan 01st October 2003

Constructor Summary
CMASession()
          The default constructor.
 
Method Summary
 void deleteCategory(javax.servlet.http.HttpServletRequest request)
          Delete a categories record.
 void deleteContent(javax.servlet.http.HttpServletRequest request)
          Delete a contents record.
 void deleteCustomer(javax.servlet.http.HttpServletRequest request)
          Delete a customers record.
 void deleteCustomerStyle(javax.servlet.http.HttpServletRequest request)
          Delete a customer_styles record.
 void deleteCustomerType(javax.servlet.http.HttpServletRequest request)
          Delete a customer_types record.
 void deleteSiteProperty(javax.servlet.http.HttpServletRequest request)
          Delete a site_properties record.
 void deleteStyleClass(javax.servlet.http.HttpServletRequest request)
          Delete a style_classes record.
 CategoryBean editCategory(javax.servlet.http.HttpServletRequest request)
          Create/edit a categories record.
 ContentBean editContent(javax.servlet.http.HttpServletRequest request)
          Create/edit a contents record.
 CustomerBean editCustomer(javax.servlet.http.HttpServletRequest request)
          Create/edit a customers record.
 CustomerStyleBean editCustomerStyle(javax.servlet.http.HttpServletRequest request)
          Create/edit a customer_styles record.
 CustomerTypeBean editCustomerType(int customerTypeId, java.lang.String type, java.lang.String description, int partnerId)
          Create/edit a customer_types record.
 PartnerStyleBean editPartnerStyle(javax.servlet.http.HttpServletRequest request)
          Create/edit a partner_styles record.
 SitePropertyBean editSiteProperty(javax.servlet.http.HttpServletRequest request)
          Create/edit a site_properties record.
 StyleClassBean editStyleClass(javax.servlet.http.HttpServletRequest request)
          Create/edit a style_classes record.
private  CustomerBean[] getCustomerBeans(java.util.Collection collection)
          Iterate through the Collection of entity bean instances of type Customer and create an array of java beans.
 CustomerBean[] getCustomerList()
          Return an Array of java bean instances of type CustomerBean.
 CustomerBean[] getCustomerList(int customerTypeId)
          Return an Array of java bean instances of type CustomerBean that are associated with the specified customer_type_id.
 CustomerStyleBean[] getCustomerStyleList(int customerId)
          Return an Array of java bean instances of type CustomerStyleBean that are associated with the specified customer_id.
 CustomerTypeBean[] getCustomerTypeList(int partnerId)
          Return an Array of java bean instances of type CustomerTypeBean.
 java.lang.String getFormattedDate(java.util.Date date)
          Return a String representation of the specified Date object.
 SitePropertyBean[] getSitePropertyList()
          Return an Array of java bean instances of type SitePropertyBean.
 StyleClassBean[] getStyleClassList()
          Return an Array of java bean instances of type StyleClassBean.
 
Methods inherited from class biz.wedoit4u.Session
getCategoryBeans, getCategoryList, getContentList, getContentList, getUniqueNumber
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CMASession

public CMASession()
The default constructor. Does nothing special.

Method Detail

editPartnerStyle

public PartnerStyleBean editPartnerStyle(javax.servlet.http.HttpServletRequest request)
                                  throws CMAException
Create/edit a partner_styles record.

Note: The primary key columns for the table are foreign keys to the partners and the style_classes table, and hence should exist prior to any records being created in the partner_styles table.

Parameters:
request - - The request from the client that contains the form elements with all the value for the database fields.
Returns:
PartnerStyleBean - The appropriate instance of the java bean that represents a record in the table.
Throws:
CMAException - - If database errors are encountered while creating/editing the database record.

getCustomerTypeList

public CustomerTypeBean[] getCustomerTypeList(int partnerId)
                                       throws CMAException
Return an Array of java bean instances of type CustomerTypeBean.

Parameters:
partnerId - - The partner_id foreign key for which the list of customers are to be retrieved.
Returns:
CustomerTypeBean[] - The array of java bean instances.
Throws:
CMAException - - If Naming or Finder exceptions are encountered while fetching the collection of java beans.
See Also:
CustomerTypeBean.findByPartner( int )

editCustomerType

public CustomerTypeBean editCustomerType(int customerTypeId,
                                         java.lang.String type,
                                         java.lang.String description,
                                         int partnerId)
                                  throws CMAException
Create/edit a customer_types record. If the specified customer_type_id is 0 then a new record is created. If the specified customer_type_id exists in the database, then the associated record is updated, otherwise, a new record is created with the specified value.

Parameters:
customerTypeId - - The customer_type_id value that is to be edited. If 0 add a new record.
type - - The name for the customer type.
description - - The description for the customer type.
partnerId - - The partner_id foreign key value for the customer type record.
Returns:
CustomerTypeBean - The appropriate instance of the java bean that represents a record in the table.
Throws:
CMAException - - If database errors are encountered while creating/editing the database record.

deleteCustomerType

public void deleteCustomerType(javax.servlet.http.HttpServletRequest request)
                        throws CMAException
Delete a customer_types record. The database record as well as the associated CustomerTypeBean instance are deleted.

Parameters:
request - - The request from the client that contains the form elements with all the value for the database fields.
Throws:
CMAException - - If database errors are encountered while deleting the database record.
See Also:
CustomerTypeBean.delete( CustomerTypeBean )

getCustomerList

public CustomerBean[] getCustomerList()
                               throws CMAException
Return an Array of java bean instances of type CustomerBean.

Returns:
CustomerBean[] - The array of java bean instances.
Throws:
CMAException - - If Naming or Finder exceptions are encoutered while fetching the collection of entity beans.
See Also:
CustomerBean.findAll(), getCustomerBeans( Collection )

getCustomerList

public CustomerBean[] getCustomerList(int customerTypeId)
                               throws CMAException
Return an Array of java bean instances of type CustomerBean that are associated with the specified customer_type_id.

Parameters:
customerTypeId - - The customer_type_id foreign key value to filter by.
Returns:
CustomerBean[] - The array of java bean instances.
Throws:
CMAException - - If Naming or Finder exceptions are encoutered while fetching the collection of entity beans.
See Also:
CustomerBean.findByCustomerType( int ), getCustomerBeans( Collection )

getCustomerBeans

private CustomerBean[] getCustomerBeans(java.util.Collection collection)
                                 throws CMAException
Iterate through the Collection of entity bean instances of type Customer and create an array of java beans.

Parameters:
collection - - The collection of entity bean instances.
Returns:
CustomerBean[] - The array of java bean.
Throws:
CMAException - - If errors are encountered while fetching the java bean instances.

editCustomer

public CustomerBean editCustomer(javax.servlet.http.HttpServletRequest request)
                          throws CMAException
Create/edit a customers record. If the specified customer_id is 0 then a new record is created in the customer table and and associated record in the site_properties tables. If the specified customer_id exists in the database, then the associated record is updated, otherwise, a new record is created with the specified primary key value.

Parameters:
request - - The request from the client that contains the form elements with all the value for the database fields.
Returns:
CustomerBean - The appropriate instance of the java bean that represents a record in the table.
Throws:
CMAException - - If database errors are encountered while creating/editing the database record.
See Also:
CustomerBean.create( int, String, String, String, String, char, Date, Date, int ), SitePropertyBean.create( int )

deleteCustomer

public void deleteCustomer(javax.servlet.http.HttpServletRequest request)
                    throws CMAException
Delete a customers record. The database record as well as the associated CustomerBean instance are deleted.

Parameters:
request - - The request from the client that contains the form elements with all the value for the database fields.
Throws:
CMAException - - If database errors are encountered while deleting the database record.
See Also:
CustomerBean.delete( CustomerBean )

editCategory

public CategoryBean editCategory(javax.servlet.http.HttpServletRequest request)
                          throws CMAException
Create/edit a categories record. If the specified category_id is 0 then a new record is created. If the specified category_id exists in the database, then the associated record is updated, otherwise, a new record is created with the specified value.

Parameters:
request - - The request from the client that contains the form elements with all the value for the database fields.
Returns:
CategoryBean - The appropriate instance of the java bean that represents a record in the table.
Throws:
CMAException - - If database errors are encountered while creating/editing the database record.

deleteCategory

public void deleteCategory(javax.servlet.http.HttpServletRequest request)
                    throws CMAException
Delete a categories record. The database record as well as the associated CategoryBean instance are deleted.

Parameters:
request - - The request from the client that contains the form elements with all the value for the database fields.
Throws:
CMAException - - If database errors are encountered while deleting the database record.
See Also:
CategoryBean.delete( CategoryBean )

editContent

public ContentBean editContent(javax.servlet.http.HttpServletRequest request)
                        throws CMAException
Create/edit a contents record. If the specified content_id is 0 then a new record is created. If the specified content_id exists in the database, then the associated record is updated, otherwise, a new record is created with the specified value.

Parameters:
request - - The request from the client that contains the form elements with all the value for the database fields.
Returns:
ContentBean - The appropriate instance of the java bean that represents a record in the table.
Throws:
CMAException - - If database errors are encountered while creating/editing the database record.

deleteContent

public void deleteContent(javax.servlet.http.HttpServletRequest request)
                   throws CMAException
Delete a contents record. The database record as well as the associated ContentBean instance are deleted.

Parameters:
request - - The request from the client that contains the form elements with all the value for the database fields.
Throws:
CMAException - - If database errors are encountered while deleting the database record.
See Also:
ContentBean.delete( ContentBean )

getSitePropertyList

public SitePropertyBean[] getSitePropertyList()
                                       throws CMAException
Return an Array of java bean instances of type SitePropertyBean.

Returns:
SitePropertyBean[] - The array of java bean instances.
Throws:
CMAException - - If Naming or Finder exceptions are encountered while fetching the collection of java beans.
See Also:
SitePropertyBean.findAll()

editSiteProperty

public SitePropertyBean editSiteProperty(javax.servlet.http.HttpServletRequest request)
                                  throws CMAException
Create/edit a site_properties record. If the specified customer_type_id is 0 then a new record is created. The the specified customer_type_id exists in the database, then the associated record is updated, otherwise, a new record is created with the specified value.

Parameters:
request - - The request from the client that contains the form elements with all the value for the database fields.
Returns:
SitePropertyBean - The appropriate instance of the java bean that represents a record in the table.
Throws:
CMAException - - If database errors are encountered while creating/editing the database record.

deleteSiteProperty

public void deleteSiteProperty(javax.servlet.http.HttpServletRequest request)
                        throws CMAException
Delete a site_properties record. The database record as well as the associated SitePropertyBean instance are deleted.

Parameters:
request - - The request from the client that contains the form elements with all the value for the database fields.
Throws:
CMAException - - If database errors are encountered while deleting the database record.
See Also:
SitePropertyBean.delete( SitePropertyBean )

getStyleClassList

public StyleClassBean[] getStyleClassList()
                                   throws CMAException
Return an Array of java bean instances of type StyleClassBean.

Returns:
StyleClassBean[] - The array of java bean instances.
Throws:
CMAException - - If Naming or Finder exceptions are encountered while fetching the collection of java beans.
See Also:
StyleClassBean.findAll()

editStyleClass

public StyleClassBean editStyleClass(javax.servlet.http.HttpServletRequest request)
                              throws CMAException
Create/edit a style_classes record. If the specified style_class_id is 0 then a new record is created. The the specified style_class_id exists in the database, then the associated record is updated, otherwise, a new record is created with the specified value.

Parameters:
request - - The request from the client that contains the form elements with all the value for the database fields.
Returns:
StyleClassBean - The appropriate instance of the java bean that represents a record in the table.
Throws:
CMAException - - If database errors are encountered while creating/editing the database record.

deleteStyleClass

public void deleteStyleClass(javax.servlet.http.HttpServletRequest request)
                      throws CMAException
Delete a style_classes record. The database record as well as the associated StyleClassBean instance are deleted.

Parameters:
request - - The request from the client that contains the form elements with all the value for the database fields.
Throws:
CMAException - - If database errors are encountered while deleting the database record.
See Also:
StyleClassBean.delete( StyleClassBean )

getCustomerStyleList

public CustomerStyleBean[] getCustomerStyleList(int customerId)
                                         throws CMAException
Return an Array of java bean instances of type CustomerStyleBean that are associated with the specified customer_id.

Parameters:
customerId - - The customer_id for which the bean instances are to be fetched.
Returns:
CustomerStyleBean[] - The array of java bean instances.
Throws:
CMAException - - If Naming or Finder exceptions are encountered while fetching the collection of java beans.
See Also:
CustomerStyleBean.findByCustomer( int )

editCustomerStyle

public CustomerStyleBean editCustomerStyle(javax.servlet.http.HttpServletRequest request)
                                    throws CMAException
Create/edit a customer_styles record.

Note: The primary key columns for the table are foreign keys to the customers and the style_classes table, and hence should exist prior to any records being created in the customer_styles table.

Parameters:
request - - The request from the client that contains the form elements with all the value for the database fields.
Returns:
CustomerStyleBean - The appropriate instance of the java bean that represents a record in the table.
Throws:
CMAException - - If database errors are encountered while creating/editing the database record.

deleteCustomerStyle

public void deleteCustomerStyle(javax.servlet.http.HttpServletRequest request)
                         throws CMAException
Delete a customer_styles record. The database record as well as the associated CustomerStyleBean instance are deleted.

Parameters:
request - - The request from the client that contains the form elements with all the value for the database fields.
Throws:
CMAException - - If database errors are encountered while deleting the database record.
See Also:
CustomerStyleBean.delete( CustomerStyleBean )

getFormattedDate

public java.lang.String getFormattedDate(java.util.Date date)
Return a String representation of the specified Date object. The representation is in SQL Timestamp format. This method returns an empty String if errors are encountered while using the DateFormatter session bean.

Parameters:
date - - The date to format.
Returns:
String - The formatted date, or an empty String if the Date is null.
See Also:
DateFormatter.getSQLTimestamp( Date )

Rakesh API

Copyright © 2002-2005 - Rakesh Vidyadharan