jp.terasoluna.fw.service.thin
Class AbstractBLogicMapper

java.lang.Object
  Extend the abovejp.terasoluna.fw.service.thin.AbstractBLogicMapper
Direct known subclasses:
BLogicMapper

public abstract class AbstractBLogicMapper
extends java.lang.Object

Abstract class that maps input/output information of business logic.

This is the abstract class wherein the functions that maps the data between Web tier objects and business logic based on the BLogicResources retaining business logic input/output information, are aggregated. All classes that map business logic input/output information are implemented by inheriting this class. Following two are the primary functions of AbstractBLogicMapper

BLogicMapper is provided by default as a subclass of AbstractBLogicMapper. However, this function can also be replaced. In such a case, it is necessary to create the class that inherits AbstractBLogicMapper or BLogicMapper and maps business logic input/output information. Implement the process that fetches input values and reflects output value in the extended business logic input/output information mapping class when the string other than request,session, application is specified in source attribute and the string other than request, session is specified in dest attribute of blogic-io.xml.
Method name of the process that fetches input values, is a string which is specified in "getValueFrom" + source attribute. When "factory" is specified in source attribute, method name becomes getValueFromFactory. Arguments are common across all methods that fetch input value. Arguments are same as getValueFromForm() method.
Method name of the process that reflects output value, is a string specified in "setValueTo" + dest attribute. When "factory" is specified in dest attribute, method name becomes getValueToFactory. Arguments are common across all methods that reflect output value. Arguments are same as getValueToForm() method.
request, session and application which are supported by default BLogicMapper are for the respective request attributes, session attributes and servlet context attributes.

Refer to BLogicIOPlugIn, for the replacement of the class that maps business logic input/output information and description method of struts-config.xml when Struts is used.

See Also:
BLogicMapper, BLogicIOPlugIn, BLogicResult, BLogicIO, BLogicProperty, BLogicResources, AbstractBLogicAction, BLogicAction

Field Summary
private static java.lang.String ERROR_BEAN_CREATE
          Error code when failed to generate JavaBean entered in business logic.
private static java.lang.String ERROR_BEAN_NOTNULL
          Error code when io was null in the result but the value fetched in result.getResultObject() was not null.
private static java.lang.String ERROR_DEST
          Error code when there were errors in the specifications of the destination where output value is set.
private static java.lang.String ERROR_GETPROPERTY
          Error code when unable to fetch property value from JavaBean.
private static java.lang.String ERROR_GETVALUE
          Error code when unable to fetch the values from the instance of input source.
private static java.lang.String ERROR_SETPROPERTY
          Error code when unable to set property values in JavaBean.
private static java.lang.String ERROR_SETVALUE
          Error code when unable to reflect the values in the instance of output destination.
private static java.lang.String ERROR_SOURCE
          Error code when there were errors in the specifications of the source from where input value is fetched.
private static org.apache.commons.logging.Log log
          Log class.
private static java.lang.String NULL_RESULT_KEY
          Error code when BLogicResult is null.
 
Constructor Summary
AbstractBLogicMapper()
           
 
Method Summary
protected  void getResults(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, BLogicIO io, java.lang.Object bean)
          Perform Mapping in blogic-result of blogic-io.
abstract  java.lang.Object getValueFromApplication(java.lang.String propName, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Fetch specified property value from servlet context.
abstract  java.lang.Object getValueFromRequest(java.lang.String propName, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Fetch specified property value from request.
abstract  java.lang.Object getValueFromSession(java.lang.String propName, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Fetch the value from the session by considering the specified property name as key.
 java.lang.Object mapBLogicParams(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, BLogicIO io)
          Map the value stored in Web tier objects with JavaBean.
 void mapBLogicResult(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, BLogicIO io, BLogicResult result)
          Store the values in web tier objects according to BLogicIO.
protected  java.lang.Object setParams(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, BLogicIO io)
          Map the values stored in Web tier objects with JavaBean on the basis of JavaBean name which is the business logic input information .
abstract  void setValueToRequest(java.lang.Object value, java.lang.String propName, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Store the value in the specified property of request.
abstract  void setValueToSession(java.lang.Object value, java.lang.String propName, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Store the value in session by considering the specified property name as key.
 
Method inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Details

log

private static org.apache.commons.logging.Log log
Log class.


NULL_RESULT_KEY

private static final java.lang.String NULL_RESULT_KEY
Error code when BLogicResult was null.

See Also:
Constant field value

ERROR_SOURCE

private static final java.lang.String ERROR_SOURCE
Error code when there were errors in the specifications of the source from where input value is fetched.

See Also:
Constant field value

ERROR_DEST

private static final java.lang.String ERROR_DEST
Error code when there were errors in the specifications of the destination where output value is set.

See Also:
Constant field value

ERROR_BEAN_CREATE

private static final java.lang.String ERROR_BEAN_CREATE
Error code when failed to generate JavaBean entered in business logic.

See Also:
Constant field value

ERROR_GETPROPERTY

private static final java.lang.String ERROR_GETPROPERTY
Error code when unable to fetch the property values from JavaBean.

See Also:
Constant field value

ERROR_SETPROPERTY

private static final java.lang.String ERROR_SETPROPERTY
Error code when unable to set property value in JavaBean.

See Also:
Constant field value

ERROR_GETVALUE

private static final java.lang.String ERROR_GETVALUE
Error code when unable to fetch the value from instance of input source.

See Also:
Constant field value

ERROR_SETVALUE

private static final java.lang.String ERROR_SETVALUE
Error code when unable to reflect the value in instance of output destination.

See Also:
Constant field value

ERROR_BEAN_NOTNULL

private static final java.lang.String ERROR_BEAN_NOTNULL
Error code when io was null in the result but the value fetched in result.getResultObject() was not null.

See Also:
Constant field value
Constructor Details

AbstractBLogicMapper

public AbstractBLogicMapper()
Method Details

mapBLogicParams

public java.lang.Object mapBLogicParams(javax.servlet.http.HttpServletRequest request,
                                        javax.servlet.http.HttpServletResponse response,
                                        BLogicIO io)
Map the value stored in Web tier object with JavaBean.

Parameter:
request - HTTP request
response - HTTP response
io - Business logic input/output information
Returns:
Returns null when JavaBean having all the parameters stored in Web tier, is not specified in io.

setParams

protected java.lang.Object setParams(javax.servlet.http.HttpServletRequest request,
                                     javax.servlet.http.HttpServletResponse response,
                                     BLogicIO io)
Map the values stored in Web tier objects with JavaBean based on JavaBean name which is the business logic input information. Map blogic-params of blogic-io.

Parameter:
request -
response -
io -
Returns:
JavaBean which is the business logic inputinformation

getValueFromRequest

public abstract java.lang.Object getValueFromRequest(java.lang.String propName,
                                                     javax.servlet.http.HttpServletRequest request,
                                                     javax.servlet.http.HttpServletResponse response)
Fetch specified property value from request.

Parameter:
propName - Property name
request - HTTP request
response - HTTP response
Returns:
Property value

getValueFromSession

public abstract java.lang.Object getValueFromSession(java.lang.String propName,
                                                     javax.servlet.http.HttpServletRequest request,
                                                     javax.servlet.http.HttpServletResponse response)
Fetch the value from session by considering the specified property name as key.

Parameter:
propName - Property name
request - HTTP request
response - HTTP response
Returns:
Property value

mapBLogicResult

public void mapBLogicResult(javax.servlet.http.HttpServletRequest request,
                            javax.servlet.http.HttpServletResponse response,
                            BLogicIO io,
                            BLogicResult result)
Store the values in web tier objects according to BLogicIO.

Parameter:
request - HTTP request
response - HTTP response
io - Business logic input/output information
result - Business logic outputinformation

getResults

protected void getResults(javax.servlet.http.HttpServletRequest request,
                          javax.servlet.http.HttpServletResponse response,
                          BLogicIO io,
                          java.lang.Object bean)
Perform Mapping in blogic-result of blogic-io.

Parameter:
request -
response -
io -
bean -

setValueToRequest

public abstract void setValueToRequest(java.lang.Object value,
                                       java.lang.String propName,
                                       javax.servlet.http.HttpServletRequest request,
                                       javax.servlet.http.HttpServletResponse response)
Store the values in specified property of request.

Parameter:
value - Output value
propName - Property name
request - HTTP request
response - HTTP response

setValueToSession

public abstract void setValueToSession(java.lang.Object value,
                                       java.lang.String propName,
                                       javax.servlet.http.HttpServletRequest request,
                                       javax.servlet.http.HttpServletResponse response)
Store the values in session by considering the specified property name as key.

Parameter:
value - Output value
propName - Property name
request - HTTP request
response - HTTP response

getValueFromApplication

public abstract java.lang.Object getValueFromApplication(java.lang.String propName,
                                                         javax.servlet.http.HttpServletRequest request,
                                                         javax.servlet.http.HttpServletResponse response)
Fetch the specified property value from servlet context.

Parameter:
propName - Property name
request - HTTP request
response - HTTP response
Returns:
Property value