jp.terasoluna.fw.service.thin
Class BLogicMapper

java.lang.Object
  Extend the abovejp.terasoluna.fw.service.thin.AbstractBLogicMapper
      Extend the abovejp.terasoluna.fw.service.thin.BLogicMapper

public class BLogicMapper
extends AbstractBLogicMapper

Class that maps business logic input/output information.

The data between Web tier objects and business logic is mapped based on the BLogicResources generated by BLogicIOPlugIn.
Input from Web tier is from request attribute (request), session attribute (session) and servlet context (application).
Output from business logic is for request attribute (request)and session attribute (session) *Output from business logic to servlet context is not supported.

This class is provided by default as a subclass of AbstractBLogicMapper. However, this function can also be replaced through the BLogicIOPlugIn settings of struts-config.xml.In such a case, it is necessary to create the class that inherits AbstractBLogicMapper or BLogicMapper and maps the business logic input/output information. Implement the process that fetches input value and the process that 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 of blogic-io.xml and the string other than request, session is specified in dest attribute .
Method name of process that fetches input value, 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 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 getValueFromForm() method.
When the destination and fetch source of the value is ActionForm, the nested property name can be specified.

For replacement of the class that maps business logic input/output information and description method of struts-config.xml, refer to BLogicIOPlugIn .

See Also:
AbstractBLogicMapper, BLogicIOPlugIn

Field Summary
private static java.lang.String ERROR_RESOURCES_FILE
          Error code when there were no resource files.
private static org.apache.commons.logging.Log log
          Log class.
 
Constructor Summary
BLogicMapper()
          Constructor.
BLogicMapper(java.lang.String resources)
          Constructor.
 
Method Summary
protected  org.apache.struts.action.ActionForm getActionForm(javax.servlet.http.HttpServletRequest request)
          Fetch ActionForm instance which is stored in request or session.
 java.lang.Object getValueFromApplication(java.lang.String propName, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Fetch the value from servlet context by considering the specified property name as key.
 java.lang.Object getValueFromForm(java.lang.String propName, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Fetch the specified property value from form.
 java.lang.Object getValueFromRequest(java.lang.String propName, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Fetch specified property value from request.
 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.
 void setValueToForm(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 form.
 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.
 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 jp.terasoluna.fw.service.thin.AbstractBLogicMapper
getResults, mapBLogicParams, mapBLogicResult, setParams
 
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.


ERROR_RESOURCES_FILE

private static final java.lang.String ERROR_RESOURCES_FILE
Error code when there were no resource files.

See Also:
Constant field value
Constructor Details

BLogicMapper

public BLogicMapper()
Constructor.


BLogicMapper

public BLogicMapper(java.lang.String resources)
Constructor.

Parameter:
resources - Path of resource
Method Details

getValueFromRequest

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

Specified by:
getValueFromRequest in class AbstractBLogicMapper
Parameter:
propName - Property name
request - HTTP request
response - HTTP response
Returns:
Property value

getValueFromForm

public java.lang.Object getValueFromForm(java.lang.String propName,
                                         javax.servlet.http.HttpServletRequest request,
                                         javax.servlet.http.HttpServletResponse response)
                                  throws PropertyAccessException
Fetch specified property value from form.

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

getValueFromSession

public 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.

Definition:
Class AbstractBLogicMapper in class getValueFromSession
Parameter:
propName - Property name
request - HTTP request
response - HTTP response
Returns:
Property value

setValueToRequest

public 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.

Specified by:
setValueToRequest in class AbstractBLogicMapper
Parameter:
value - Output value
propName - Property name
request - HTTP request
response - HTTP response

setValueToForm

public void setValueToForm(java.lang.Object value,
                           java.lang.String propName,
                           javax.servlet.http.HttpServletRequest request,
                           javax.servlet.http.HttpServletResponse response)
                    throws PropertyAccessException
Store the value in the specified property of form.
If the form is the instance of FormEx, set the modified flag to true.

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

setValueToSession

public 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.

Specified by:
setValueToSession in class AbstractBLogicMapper
Parameter:
value - Output value
propName - Property name
request - HTTP request
response - HTTP response

getActionForm

protected org.apache.struts.action.ActionForm getActionForm(javax.servlet.http.HttpServletRequest request)
Fetch the ActionForm instance stored in request or session.

Parameter:
request - HTTP request
Returns:
ActionForm instance

getValueFromApplication

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

Specified by:
getValueFromApplication in class AbstractBLogicMapper
Parameter:
propName - Property name
request - HTTP request
response - HTTP response
Returns:
Property value