モジュール jp.ecuacion.splib.web
クラス SplibGeneralController<S extends SplibGeneralService>
java.lang.Object
jp.ecuacion.splib.web.controller.SplibBaseController
jp.ecuacion.splib.web.controller.SplibGeneralController<S>
public abstract class SplibGeneralController<S extends SplibGeneralService>
extends SplibBaseController
-
ネストされたクラスの概要
ネストされたクラス修飾子とタイプクラス説明static class通常constructorの引数とする項目だが、数が多いのでmethodChain方式で渡す形とした。static class -
フィールドの概要
フィールド修飾子とタイプフィールド説明protected SplibGeneralController.ControllerContextprotected SplibGeneralController.PrepareSettingsprotected RedirectUrlBean単純にserviceを@Autowiredすると、ConfigController、LoginControllerの使用時に、injection対象が複数存在する、というエラーになる。クラスから継承されたフィールド jp.ecuacion.splib.web.controller.SplibBaseController
request -
コンストラクタの概要
コンストラクタ修飾子コンストラクタ説明SplibGeneralController(String function) functionを指定したconstructor。protectedSplibGeneralController(String function, SplibGeneralController.ControllerContext context) functionを指定したconstructor。 -
メソッドの概要
修飾子とタイプメソッド説明本controllerとペアになる画面htmlの文字列。処理成功時redirectをする場合のredirect先pageのdefault。処理成功時redirectをする場合のredirect先pageのdefault。処理成功時redirectをする場合のredirect先subFunctionのdefault。処理成功時redirectをする場合のredirect先subFunctionのdefault。protected String処理が終わり、最終的にredirectする場合に使用。protected StringgetReturnStringOnSuccess(RedirectUrlBean redirectUrlBean) 処理が終わり、最終的にredirectする場合に使用。protected StringメニューなどからURLを指定された際に表示する処理のreturnとして使用。protected StringメニューなどからURLを指定された際に表示する処理のreturnとして使用。voidprepare(org.springframework.ui.Model model, SplibGeneralController.PrepareSettings settings, SplibGeneralForm... forms) voidprepare(org.springframework.ui.Model model, SplibGeneralForm... forms) voidprepare(org.springframework.ui.Model model, org.springframework.security.core.userdetails.UserDetails loginUser, SplibGeneralController.PrepareSettings settings, SplibGeneralForm... forms) エラー処理などに必要な処理を行う。voidprepare(org.springframework.ui.Model model, org.springframework.security.core.userdetails.UserDetails loginUser, SplibGeneralForm... forms) 現時点でloginUserを具体的に使用しているわけではないので、loginUserの引数がないmethodを呼んでも問題ないが、 未来のため一応実装しておく。prepareForForwardAndGetPath(org.springframework.ui.Model model) 個々のsplibUtilを直接呼び出しても良いのだが、記載を簡便化するため本クラスでメソッド化しておく。prepareForForwardAndGetPath(org.springframework.ui.Model model, String subFunction, String page) 個々のsplibUtilを直接呼び出しても良いのだが、記載を簡便化するため本クラスでメソッド化しておく。prepareForRedirectOrForwardAndGetPath(RedirectUrlPageBean redirectBean, org.springframework.ui.Model model) prepareForSuccessRedirectAndGetPath(org.springframework.ui.Model model) 個々のsplibUtilを直接呼び出しても良いのだが、記載を簡便化するため本クラスでメソッド化しておく。prepareForSuccessRedirectAndGetPath(org.springframework.ui.Model model, String subFunction, String page) 個々のsplibUtilを直接呼び出しても良いのだが、記載を簡便化するため本クラスでメソッド化しておく。voidthrow404()validation errorなどが発生した際はredirectを通常しないので、ボタンを押した際の/...protected void以下を実施。クラスから継承されたメソッド jp.ecuacion.splib.web.controller.SplibBaseController
initBinder
-
フィールド詳細
-
context
-
prepareSettings
-
redirectUrlOnAppExceptionBean
-
rolesAndAuthoritiesBean
-
serviceList
単純にserviceを@Autowiredすると、ConfigController、LoginControllerの使用時に、injection対象が複数存在する、というエラーになる。 使用するserviceがSplibGeneral1FormDoNothingService なのだが、injection対象がこれとSplibGeneral2FormsDoNothingServiceの 2つ存在する、というエラーなのだ。 上記2つのDoNothingServiceは別クラスなので判断ついてもよさそうなのだが、状況的にはそれらのserviceではGenericsのparameterが付与されており、 それによって正しく判断ができていないようだ。pringの不具合かもしれない。 workaroundとして、一旦Listで受け取りgetService()側で選別する形とする。
-
-
コンストラクタの詳細
-
SplibGeneralController
functionを指定したconstructor。 -
SplibGeneralController
protected SplibGeneralController(@Nonnull String function, @NonNull SplibGeneralController.ControllerContext context) functionを指定したconstructor。functionだけは必須なのでconstructorの引数としている。
-
-
メソッドの詳細
-
newContext
-
getPrepareSettings
-
getService
-
getFunction
-
getSubFunction
-
getRootRecordName
-
getRedirectUrlOnAppExceptionBean
-
getReturnStringToShowPage
メニューなどからURLを指定された際に表示する処理のreturnとして使用。htmlページのファイル名ルールを統一化する目的で使用。 -
getReturnStringToShowPage
メニューなどからURLを指定された際に表示する処理のreturnとして使用。 現時点では指定されたpageをそのまま返すだけなので意味はないのだが、今後の追加処理を見込んでmethod化しておく。 現時点では、これは1 htmlファイルに対しcontroller、formが複数ある場合で、 かつcontrollerにはsubFunctionがあるがhtmlファイル名にはsubFunctionがつかない、 という場合にやむなく使用するのみで、それ以外では使用想定はなし。 -
getReturnStringOnSuccess
処理が終わり、最終的にredirectする場合に使用。 -
getReturnStringOnSuccess
処理が終わり、最終的にredirectする場合に使用。 defaultPageへのredirectを簡便にするためのメソッド。 -
prepareForSuccessRedirectAndGetPath
個々のsplibUtilを直接呼び出しても良いのだが、記載を簡便化するため本クラスでメソッド化しておく。 modelは指定すれば引き継ぐ対象となる。引き継ぐ必要がない場合はnullを設定。 -
prepareForSuccessRedirectAndGetPath
public String prepareForSuccessRedirectAndGetPath(org.springframework.ui.Model model, String subFunction, String page) 個々のsplibUtilを直接呼び出しても良いのだが、記載を簡便化するため本クラスでメソッド化しておく。 modelは指定すれば引き継ぐ対象となる。引き継ぐ必要がない場合はnullを設定。 -
prepareForForwardAndGetPath
個々のsplibUtilを直接呼び出しても良いのだが、記載を簡便化するため本クラスでメソッド化しておく。 modelは指定すれば引き継ぐ対象となる。引き継ぐ必要がない場合はnullを設定。 -
prepareForForwardAndGetPath
public String prepareForForwardAndGetPath(org.springframework.ui.Model model, String subFunction, String page) 個々のsplibUtilを直接呼び出しても良いのだが、記載を簡便化するため本クラスでメソッド化しておく。 modelは指定すれば引き継ぐ対象となる。引き継ぐ必要がない場合はnullを設定。 -
prepareForRedirectOrForwardAndGetPath
public String prepareForRedirectOrForwardAndGetPath(RedirectUrlPageBean redirectBean, org.springframework.ui.Model model) -
throw404
@GetMapping("action") public void throw404() throws org.springframework.web.servlet.resource.NoResourceFoundExceptionvalidation errorなどが発生した際はredirectを通常しないので、ボタンを押した際の/.../action のパスがurlに残る。 その画面のactionはpostで受けているのに、そのurlをbrowserのurlバーを指定してenterしてしまう(つまりgetで送信してしまう)ことがままある。 システムエラーになるのはよくないので、その場合は404と同様の処理としてしまう。actionにparameterをつけないと全てここに来てしまうので注意。- 例外:
org.springframework.web.servlet.resource.NoResourceFoundException
-
getDefaultHtmlFileName
本controllerとペアになる画面htmlの文字列。基本は<function>.html。 -
getDefaultSubFunctionOnSuccess
処理成功時redirectをする場合のredirect先subFunctionのdefault。 -
getDefaultSubFunctionOnAppException
処理成功時redirectをする場合のredirect先subFunctionのdefault。 -
getDefaultPageOnSuccess
処理成功時redirectをする場合のredirect先pageのdefault。 -
getDefaultPageOnAppException
処理成功時redirectをする場合のredirect先pageのdefault。 -
prepare
public void prepare(org.springframework.ui.Model model, SplibGeneralForm... forms) throws InputValidationException, jp.ecuacion.lib.core.exception.checked.AppException - 例外:
InputValidationExceptionjp.ecuacion.lib.core.exception.checked.AppException
-
prepare
public void prepare(org.springframework.ui.Model model, SplibGeneralController.PrepareSettings settings, SplibGeneralForm... forms) throws InputValidationException, jp.ecuacion.lib.core.exception.checked.AppException - 例外:
InputValidationExceptionjp.ecuacion.lib.core.exception.checked.AppException
-
prepare
public void prepare(org.springframework.ui.Model model, org.springframework.security.core.userdetails.UserDetails loginUser, SplibGeneralForm... forms) throws InputValidationException, jp.ecuacion.lib.core.exception.checked.AppException 現時点でloginUserを具体的に使用しているわけではないので、loginUserの引数がないmethodを呼んでも問題ないが、 未来のため一応実装しておく。- 例外:
InputValidationExceptionjp.ecuacion.lib.core.exception.checked.AppException
-
prepare
public void prepare(org.springframework.ui.Model model, org.springframework.security.core.userdetails.UserDetails loginUser, SplibGeneralController.PrepareSettings settings, SplibGeneralForm... forms) throws InputValidationException, jp.ecuacion.lib.core.exception.checked.AppException エラー処理などに必要な処理を行う。 本処理は、@XxxMappingにより呼び出されるメソッド全てで呼び出す必要あり。 validation・BLチェック含めエラー発生なし、かつredirect、かつtransactionTokenCheck不要、の場合は厳密にはチェックは不要となる。 が、最低でも引数なしのメソッドは呼ぶ(=transactionTokenCheckは実施)ルールとし、transactionTokenCheckが不要の場合は別途それを設定することとする- 例外:
InputValidationExceptionjp.ecuacion.lib.core.exception.checked.AppException
-
transactionTokenCheck
protected void transactionTokenCheck() throws jp.ecuacion.lib.core.exception.checked.BizLogicAppException以下を実施。 設定項目の値に従ってpulldownの選択肢を動的に変更したい場合など、敢えてvalidation checkをしたくない場面もあるので、 validation checkの要否を持たせている。- transactionToken check
- validation check
- 例外:
jp.ecuacion.lib.core.exception.checked.BizLogicAppException
-