public class BLogicController extends TerasolunaController<Object,Object>
DispatcherServlet
から起動され、
BLogic
インタフェースを実装した業務ロジッククラスを実行する。
業務ロジックの実行は、本クラスが実行するが、 トランザクション管理の責務は、BLogicが受け持つ。 業務ロジック起動時の引数のJavaBeanは、リクエストをバインドしたJavaBean(コマンド)となる。
原則として、サブクラスの作成は不要であり、本クラスを直接利用する。 ただし、プロジェクトごとの要件によって、 業務前処理、後処理が必要な場合は、プロジェクト単位でサブクラスを作成する。
あらかじめTERASOLUNAが提供している リクエストコントローラのベース定義 xmlRequestBLogicExecuteControllerまたは queryRequestBLogicExecuteControllerを継承してBean定義を行うこと。 また、以下のプロパティを設定すること。
属性名 | 必須 | 説明 |
---|---|---|
blogic | ○ | 起動するBLogicのBean名 |
Bean定義ファイル
の設定例】
<bean name="/secure/blogic/max.do"
parent="xmlRequestBLogicExecuteController" scope="singleton">
<property name="blogic" ref="maxBLogic"/>
</bean>
※ xmlRequestBLogicExecuteControllerは、
BLogicを起動するリクエストコントローラの抽象定義。
詳細は、TerasolunaControllerを参照。
BLogic
修飾子とタイプ | フィールドと説明 |
---|---|
protected BLogic<Object,Object> |
blogic
Bean定義ファイルに設定されているBLogic実装クラス。
|
ctxSupport, dataBinderCreator, parameterizedControllerClass, useRequestNameView, viewName
コンストラクタと説明 |
---|
BLogicController() |
修飾子とタイプ | メソッドと説明 |
---|---|
void |
afterPropertiesSet()
DIコンテナによってインスタンス化された直後に呼ばれるメソッド。
|
protected Object |
executeService(Object command)
BLogic#execute()を直接呼び出し、業務ロジックを実行する。
|
protected Type |
getCommandType()
コマンドオブジェクトの型を取得する。
|
void |
setBlogic(BLogic<Object,Object> blogic)
BLogic実装クラスを設定する。
|
void |
setBusinessLogic(BLogic<Object,Object> blogic)
BLogic実装クラスを設定する。
|
createBinder, executeService, getCommand, handle, onBind, onBindAndValidate, postService, preService, setCtxSupport, setDataBinderCreator, setUseRequestNameView, setViewName
bindAndValidate, checkCommand, createCommand, getBindingErrorProcessor, getCommandClass, getCommandName, getMessageCodesResolver, getPropertyEditorRegistrars, getValidator, getValidators, getWebBindingInitializer, initApplicationContext, initBinder, isValidateOnBinding, onBind, prepareBinder, setBindingErrorProcessor, setCommandClass, setCommandName, setMessageCodesResolver, setPropertyEditorRegistrar, setPropertyEditorRegistrars, setValidateOnBinding, setValidator, setValidators, setWebBindingInitializer, suppressBinding, suppressValidation, suppressValidation, suppressValidation, useDirectFieldAccess
handleRequest, isSynchronizeOnSession, setSynchronizeOnSession
applyCacheSeconds, applyCacheSeconds, cacheForSeconds, cacheForSeconds, checkAndPrepare, checkAndPrepare, getCacheSeconds, getSupportedMethods, isRequireSession, isUseCacheControlHeader, isUseCacheControlNoStore, isUseExpiresHeader, preventCaching, setCacheSeconds, setRequireSession, setSupportedMethods, setUseCacheControlHeader, setUseCacheControlNoStore, setUseExpiresHeader
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
public void setBlogic(BLogic<Object,Object> blogic)
blogic
- BLogic実装クラス。public void setBusinessLogic(BLogic<Object,Object> blogic)
blogic
- BLogic実装クラス。public void afterPropertiesSet()
afterPropertiesSet
インタフェース内 org.springframework.beans.factory.InitializingBean
afterPropertiesSet
クラス内 TerasolunaController<Object,Object>
protected Type getCommandType()
BLogic
クラスの
executeメソッドの引数の型を返す。
executeメソッドがオーバーロードされている場合、例外を返す。getCommandType
クラス内 TerasolunaController<Object,Object>
protected Object executeService(Object command) throws Exception
executeService
クラス内 TerasolunaController<Object,Object>
command
- コマンドオブジェクトException
- 業務ロジックからスローされた例外Copyright © 2014. All Rights Reserved.