IT.CappuccinoNet  
StrutsCX v0.9
   

com.cappuccinonet.strutscx.prototype.business
Class InfoDelegate

java.lang.Object
  |
  +--com.cappuccinonet.strutscx.prototype.business.InfoDelegate

public class InfoDelegate
extends java.lang.Object

Business Delegate for the Info Domain. It shields the Persistence Framework from the Web-Client and mirrors the methods of the corresponding Facade on the integration tier. Depending on the user input it delegates to the InfoEJBFacade, InfoCastorFacade or any other persistence mechanism available.

Using a Business Delegate has the following advantages:

  1. reduced coupling between client and business tier
  2. could caching services for better performance
  3. client development could start using fake data.
FUTURE ENHANCEMENTS: Implementation of a Lookup Service; this would be too much overhead for this small example.

Version:
v0.4, 2002.10.15
Author:
Bernhard Woehrlin, IT.CappuccinoNet.com

Field Summary
private  InfoDAO infoDAO
           
private  java.lang.String languages
           
private static org.apache.log4j.Logger logger
          The Logger we use to log JDK 1.4 conform.
private  java.lang.String persisttype
           
private  java.lang.String THIS_CLASS
          A String with this Classname used for system messages
 
Constructor Summary
InfoDelegate(javax.servlet.ServletConfig config, java.lang.String persisttype, java.lang.String languages)
          Constructor for InfoDelegate.
 
Method Summary
 void delete(InfoPresentationVO presentationVO)
          Deletes the given entry in the data source.
 java.util.Collection findByLocale(java.util.Locale locale)
          Contacts the appropriate Facade to find a datasource entries of a specific locale.
 InfoPresentationVO findByPrimaryKey(int primaryKey, java.util.Locale locale)
          Contacts the appropriate Facade to find a datasource entry by primary key.
 InfoPresentationVO insert()
          Returns an new InfoPresentationVO filled with default values.
private  InfoPresentationVO prepareForClient(InfoIntegrationVO integrationVO)
          This method does nothing more than reading Values from the InfoIntegrationVO and writes it into the InfoPresentationVO.
private  InfoIntegrationVO prepareForPersistence(InfoPresentationVO presentationVO)
          This method does nothing more than reading Values from the InfoPresentationVO and writes it into the InfoIntegrationVO.
 void update(InfoPresentationVO presentationVO)
          Updates values of the integration tier with values of the presentation tier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

THIS_CLASS

private java.lang.String THIS_CLASS
A String with this Classname used for system messages


logger

private static org.apache.log4j.Logger logger
The Logger we use to log JDK 1.4 conform.


persisttype

private java.lang.String persisttype

languages

private java.lang.String languages

infoDAO

private InfoDAO infoDAO
Constructor Detail

InfoDelegate

public InfoDelegate(javax.servlet.ServletConfig config,
                    java.lang.String persisttype,
                    java.lang.String languages)
Constructor for InfoDelegate. Here we decide which persistence type we will use and contact an appropriate Facade in the integration tier. Therefore we use two parameters:
  1. a String with the type of persistence we do want to show - this is special for the StrutsCX Info Prototype; usually persistence should not be of interest for the client.
  2. the langaugaes we do want to persist. This information comes out of a String in the properties.xml.

Parameters:
config -
persisttype - FOR FUTURE USE WITH client switch for persist type!
languages -
Method Detail

insert

public InfoPresentationVO insert()
Returns an new InfoPresentationVO filled with default values.

Returns:
InfoPresentationVO

delete

public void delete(InfoPresentationVO presentationVO)
Deletes the given entry in the data source.

Parameters:
presentationVO -

findByLocale

public java.util.Collection findByLocale(java.util.Locale locale)
Contacts the appropriate Facade to find a datasource entries of a specific locale.

Parameters:
locale -
Returns:
Collection

findByPrimaryKey

public InfoPresentationVO findByPrimaryKey(int primaryKey,
                                           java.util.Locale locale)
Contacts the appropriate Facade to find a datasource entry by primary key.

Parameters:
primaryKey -
locale -
Returns:
InfoPresentationVO

update

public void update(InfoPresentationVO presentationVO)
Updates values of the integration tier with values of the presentation tier.

Parameters:
presentationVO -

prepareForClient

private InfoPresentationVO prepareForClient(InfoIntegrationVO integrationVO)
This method does nothing more than reading Values from the InfoIntegrationVO and writes it into the InfoPresentationVO.

Returns:
InfoPresentationVO

prepareForPersistence

private InfoIntegrationVO prepareForPersistence(InfoPresentationVO presentationVO)
This method does nothing more than reading Values from the InfoPresentationVO and writes it into the InfoIntegrationVO.

Parameters:
presentationVO -
Returns:
InfoIntegrationVO

IT.CappuccinoNet  
StrutsCX v0.9
   

© 2003, IT.CappuccinoNet.com - compiled 20030211:2244