Class SplibGeneralController.ControllerContext

java.lang.Object
jp.ecuacion.splib.web.controller.SplibGeneralController.ControllerContext
Enclosing class:
SplibGeneralController<S extends SplibGeneralService>

public static class SplibGeneralController.ControllerContext extends Object
Stores controller properties.

Since properties are many, the properties are passed not by the constructor, but by method chains.

  • Method Details

    • functionKinds

      public SplibGeneralController.ControllerContext functionKinds(String... functionKinds)
      Stores functionKind and returns ControllerContext.
      Parameters:
      functionKinds - functionKinds
    • functionKinds

      public String[] functionKinds()
      Returns functionKinds.

      functionKind designates a kind of functions.
      It's used for paths of html files. If the default url path is /public/account/page and functionKind is master-maintenance, the resultant URL would be /public/master-maintenance/account/page.

      You can specify multiple clasification strings like "master-maintenance", "account-related-master".

      Returns:
      functionKinds functionKinds
    • function

      @Nonnull public SplibGeneralController.ControllerContext function(String function)
      Stores function and returns ControllerContext.

      See function().

      Parameters:
      function - function
      Returns:
      ControllerContext
    • function

      @Nonnull public String function()
      Returns a name that describes its functionality.

      It is used for the prefix of various classes such as form and record, and the "xxx" part of URLs such as /account/xxx/search.
      It is not possible to have the same function name for multiple functions.

      It is recommended to use the same name as the entity name, such as "accGroup". (Due to implementation, the entity name is given to the function name and each class, which makes it easier to understand)
      However, in reality, there can be multiple screens in which the same entity is mainly used. In that case you can change the name, like "accGroupManagement" and "accGroupReference".

      It is not possible to specify the same function in different Controllers. The value of this field is also passed to the html side and used with the same parameter name.

      Returns:
      function
    • subFunction

      @Nonnull public SplibGeneralController.ControllerContext subFunction(@RequireNonnull String subFunction)
      Stores subFunction and returns ControllerContext.

      See subFunction().

      Parameters:
      subFunction - subFunction
      Returns:
      ControllerContext
    • subFunction

      @Nonnull public String subFunction()
      Returns a name that classifies the functions specified in function field.

      It is used when a function includes a series of functions such as search-list-edit, the name for each function (edit).

      It cannot be null. Even if not specified, it's "" by default.

      There is usually no problem in not specifying it unless there are multiple controllers with the same function.

      Returns:
      subFunction
    • htmlFilenamePostfix

      @Nonnull public SplibGeneralController.ControllerContext htmlFilenamePostfix(String htmlFilenamePostfix)
      Stores htmlFilenamePostfix and returns ControllerContext.

      See htmlFilenamePostfix().

      Parameters:
      htmlFilenamePostfix - htmlFilenamePostfix
      Returns:
      ControllerContext
    • htmlFilenamePostfix

      @Nullable public String htmlFilenamePostfix()
      Returns a html filename linked to the controller.

      Normally, an html filename is specified as function + capitalize(subFunction). But if there are multiple controllers on one screen (= means "for one html file"), the subFunction of each controller and the postfix of the html file name may be different.
      In that case, specify postfix with htmlFilePostfix.
      The filename would be function + capitalize(htmlFilenamePostfix).

      It may be null. In that case SplibGeneralController.getDefaultHtmlPageName() takes care.

      Returns:
      htmlFilenamePostfix
    • mainRootRecordName

      @Nonnull public SplibGeneralController.ControllerContext mainRootRecordName(String rootRecordName)
      Stores rootRecordName and returns ControllerContext.

      See mainRootRecordName().

      Parameters:
      rootRecordName - rootRecordName
      Returns:
      ControllerContext
    • mainRootRecordName

      @Nonnull public String mainRootRecordName()
      Returns a rootRecordName linked to the controller.

      The Field name of the record directly defined in the form normally uses the corresponding entity name.
      Especially when you use the list-edit template, there is a rule that only one record is kept under the form, so it is recommended to make it the same as the entity name.
      (In list-edit template, other patterns are not supported as they are not necessary and have not been implemented before.)

      On the java side, recordName is used for automatic completion when it is troublesome to write it every time.
      The value of this field is also passed to the template on the html side and used with the same parameter name.

      In the case of page-general, the record may not exist. In that case, rootRecordName field stored in the controller becomes null. If not set, the value which is same as function is returned.

      Returns:
      rootRecordName