Rakesh API

biz.wedoit4u
Class AdminSession

java.lang.Object
  extended by biz.wedoit4u.Session
      extended by biz.wedoit4u.AdminSession

public abstract class AdminSession
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: AdminSession.java,v 1.2 2004/05/26 11:42:29 rakesh Exp $
Author:
Rakesh Vidyadharan 01st October 2003

Constructor Summary
AdminSession()
          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 deleteCustomerType(javax.servlet.http.HttpServletRequest request)
          Delete a customer_types record.
 void deletePartner(javax.servlet.http.HttpServletRequest request)
          Delete a partners 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.
 CustomerTypeBean editCustomerType(javax.servlet.http.HttpServletRequest request)
          Create/edit a customer_types record.
 PartnerBean editPartner(javax.servlet.http.HttpServletRequest request)
          Create/edit a partners 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.
 CategoryBean[] getCategoryList()
          Return an Array of java bean instances of type CategoryBean that represents all the records in the categories table.
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.
 CustomerTypeBean[] getCustomerTypeList()
          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.
 PartnerBean[] getPartnerList()
          Return an Array of java bean instances of type PartnerBean.
 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

AdminSession

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

Method Detail

getPartnerList

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

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

editPartner

public PartnerBean editPartner(javax.servlet.http.HttpServletRequest request)
                        throws CMAException
Create/edit a partners record. If the specified partner_id is 0 then a new record is created in the partner table. If the specified partner_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:
PartnerBean - 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:
PartnerBean.create( int, String, String, char, Date, String, String, String, String, String ), SitePropertyBean.create( int )

deletePartner

public void deletePartner(javax.servlet.http.HttpServletRequest request)
                   throws CMAException
Delete a partners record. The database record as well as the associated PartnerBean 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:
PartnerBean.delete( PartnerBean )

getCustomerTypeList

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

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.findAll()

editCustomerType

public CustomerTypeBean editCustomerType(javax.servlet.http.HttpServletRequest request)
                                  throws CMAException
Create/edit a customer_types 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:
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 )

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 )

getCategoryList

public CategoryBean[] getCategoryList()
                               throws CMAException
Return an Array of java bean instances of type CategoryBean that represents all the records in the categories table.

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

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 )

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