Class SplibGeneralController<S extends SplibGeneralService>
- Type Parameters:
S- SplibGeneralService
- Direct Known Subclasses:
SplibGeneral1FormController, SplibGeneral2FormsController
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classStores controller properties. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SplibGeneralController.ControllerContextStoresControllerContext.Returns parameter list needed to add when the response is redirect to the original page.protected ReturnUrlBeanIs set If you want to redirect whenAppExceptionoccurs.Stores a list of services.Fields inherited from class SplibBaseController
request -
Constructor Summary
ConstructorsModifierConstructorDescriptionSplibGeneralController(String function) Constructs a new instance withfunction.protectedSplibGeneralController(String function, SplibGeneralController.ControllerContext context) Constructs a new instance withfunctionandControllerContext. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdds html parameter with no value when the request redirects to the same page.protected voidaddParamToParamListOnRedirectToSelf(String key, String value) Adds html parameter when the request redirects to the same page.Provides the defaultpagevalue as the part of the redirecting URL after the server procedure finished with error.Provides the defaultsubFunctionvalue as the part of the redirecting URL after the server procedure finished successfully.Provides the defaultsubFunctionvalue as the part of the redirecting URL after the server procedure finished with error.Provides the defaultsubFunctionvalue as the part of the redirecting URL after the server procedure finished successfully.Returns default html filename corresponding to the controller.String[]protected StringReturns the redirect URL which redirects to the same page with success message.Returns a service instance.Constructs a new instance and returns it.voidprepare(org.springframework.ui.Model model, SplibGeneralForm... forms) Carries out the procedure that is needed after the service procedure ended or the service throws exceptions.voidprepare(org.springframework.ui.Model model, org.springframework.security.core.userdetails.UserDetails loginUser, SplibGeneralForm... forms) Carries out the procedure that is needed after the service procedure ended or the service throws exceptions.redirectToSamePageTakingOverModel(org.springframework.ui.Model model) Returns the redirect URL which redirects to the same page and takes overmodelto the transitioned page.redirectToSamePageTakingOverModel(org.springframework.ui.Model model, boolean showsSuccessMessage) Returns the redirect URL which redirects to the same page and takes overmodelto the transitioned page.Methods inherited from class SplibBaseController
initBinder
-
Field Details
-
context
StoresControllerContext. -
rolesAndAuthoritiesBean
-
serviceList
Stores a list of services.If you simply @Autowire the service, you will get an error that there are multiple injection targets when using ConfigController or LoginController.
The service used isSplibGeneral1FormDoNothingService, but the error is that there are two injection targets: this and SplibGeneral2FormsDoNothingService.
The above two DoNothingServices are different classes, so it seems that the right service can be selected but cannot.
Generics parameters have been assigned to those services, so it seems that the judgment cannot be made correctly.
It may be a problem with spring. As a workaround, we will first receive it as a List and select it on the getService() side. -
redirectUrlOnAppExceptionBean
Is set If you want to redirect whenAppExceptionoccurs.It may be
nullif you don't want to redirect.BizLogicRedirectAppExceptionredirect settings is priotized over this settings. -
paramListOnRedirectToSelf
-
-
Constructor Details
-
SplibGeneralController
Constructs a new instance withfunction.- Parameters:
function- function
-
SplibGeneralController
protected SplibGeneralController(@Nonnull String function, @NonNull SplibGeneralController.ControllerContext context) Constructs a new instance withfunctionandControllerContext.- Parameters:
function- functioncontext- context
-
-
Method Details
-
newContext
Constructs a new instance and returns it.- Returns:
- ControllerContext
-
getService
Returns a service instance.See
ControllerContext.serviceList.- Returns:
- service
-
getFunctionKinds
-
getFunction
-
getSubFunction
-
getRootRecordName
-
getRedirectUrlOnAppExceptionBean
-
addParamToParamListOnRedirectToSelf
Adds html parameter with no value when the request redirects to the same page.- Parameters:
key- key
-
addParamToParamListOnRedirectToSelf
-
getParamListOnRedirectToSelf
-
getRedirectUrlOnSuccess
Returns the redirect URL which redirects to the same page with success message.This is a utility method to use redirect easily without understanding
ReturnUrlBean. It's also allowed to useReturnUrlBeandirectly from apps.- Returns:
- URL
-
redirectToSamePageTakingOverModel
Returns the redirect URL which redirects to the same page and takes overmodelto the transitioned page.This is a utility method to use redirect easily without understanding
ReturnUrlBean. It's also allowed to useReturnUrlBeandirectly from apps.- Parameters:
model- model- Returns:
- URL
-
redirectToSamePageTakingOverModel
public String redirectToSamePageTakingOverModel(org.springframework.ui.Model model, boolean showsSuccessMessage) Returns the redirect URL which redirects to the same page and takes overmodelto the transitioned page.This is a utility method to use redirect easily without understanding
ReturnUrlBean. It's also allowed to useReturnUrlBeandirectly from apps.- Parameters:
model- modelshowsSuccessMessage- showsSuccessMessage- Returns:
- URL
-
getDefaultHtmlPageName
Returns default html filename corresponding to the controller.Basically
<function>.html.
IfsubFunctionis set, it becomes<function> + capitalize(<subFuction>).html.
IfhtmlFilenamePostfixis set, it becomes<function> + capitalize(<htmlFilenamePostfix>).html.
(not<function> + capitalize(<subFunction>) + capitalize(<htmlFilenamePostfix>).html)- Returns:
- html filename
-
getDefaultDestSubFunctionOnNormalEnd
Provides the defaultsubFunctionvalue as the part of the redirecting URL after the server procedure finished successfully.In this class
context.subFunction()is set as the default return value, but for instance in "edit" controller class, "searchList" is set because after insert or update a record, going back to the list screen seems to be normal.- Returns:
- default subFunction value
-
getDefaultDestSubFunctionOnAbnormalEnd
Provides the defaultsubFunctionvalue as the part of the redirecting URL after the server procedure finished with error.In this class
context.subFunction()is set as the default return value, but for instance in "edit" controller class, "searchList" is set because after insert or update a record, going back to the list screen seems to be normal.- Returns:
- default subFunction value
-
getDefaultDestPageOnNormalEnd
Provides the defaultsubFunctionvalue as the part of the redirecting URL after the server procedure finished successfully.In this class
"page"is set as the default return value.- Returns:
- default subFunction value
-
getDefaultDestPageOnAbnormalEnd
Provides the defaultpagevalue as the part of the redirecting URL after the server procedure finished with error.In this class
"page"is set as the default return value.- Returns:
- default subFunction value
-
prepare
public void prepare(org.springframework.ui.Model model, SplibGeneralForm... forms) throws jp.ecuacion.lib.core.exception.checked.AppException Carries out the procedure that is needed after the service procedure ended or the service throws exceptions.All the method with
@XxxMappingneeds to call this method at the first line of the method.
validation・BLチェック含めエラー発生なし、かつredirect、かつtransactionTokenCheck不要、の場合は厳密にはチェックは不要となる。 が、最低でも引数なしのメソッドは呼ぶ(=transactionTokenCheckは実施)ルールとし、transactionTokenCheckが不要の場合は別途それを設定することとする- Parameters:
model- modelforms- forms- Throws:
jp.ecuacion.lib.core.exception.checked.AppException- AppException
-
prepare
public void prepare(org.springframework.ui.Model model, org.springframework.security.core.userdetails.UserDetails loginUser, SplibGeneralForm... forms) throws jp.ecuacion.lib.core.exception.checked.AppException Carries out the procedure that is needed after the service procedure ended or the service throws exceptions. エラー処理などに必要な処理を行う。 本処理は、@XxxMappingにより呼び出されるメソッド全てで呼び出す必要あり。- Parameters:
model- modelloginUser- loginUserforms- forms- Throws:
jp.ecuacion.lib.core.exception.checked.AppException- AppException
-