MyFaces Extensions Validator
  1. MyFaces Extensions Validator
  2. EXTVAL-141

allow group validation triggered via an action-method

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.4
    • Fix Version/s: 2.0.7
    • Component/s: Bean Validation
    • Labels:
      None

      Description

      extval doesn't support the validateBean tag to keep the type-safety of bv-groups (instead @BeanValidation is provided). however, also the tag isn't what users need when it comes to group validation in several cases. with the tag it's just possible to specify groups for input components or disable bv with the disabled attribute.

      a lot of cases just require different actions within a form which should process the whole form in a different manner (= different or no bv-group/s). furthermore, there are several use-cases which require to bypass the validation process e.g. via a special group which isn't used for bv-constraints (see EXTVAL-142). in such cases the usage of the immediate attribute doesn't fit and the usage of the disabled attribute is more like a workaround.

      extval already provides @BeanValidation to 'useGroups' and 'restrictGroups' (optionally for specific views via 'viewIds' and/or specific conditions via 'conditions'). this feature allows to re-use this annotation also for action methods. so it's possible to use it for the scenarios mentioned above as well as EXTVAL-142.

      a simple example:

      @BeanValidation(useGroups = MyGroup.class)
      public String send()

      { //... return "success"; }

      a button which is bound to this action method will remove all configured groups of the current form for the current request, add the groups listed in 'useGroups' and locks the internal context until the invoke application phase to avoid that further groups get added.
      we can also think about just adding the groups and use 'restrictGroups' to remove the groups which shouldn't be used. and only SkipValidation of EXTVAL-141 would trigger the behaviour described before.

        Issue Links

          Activity

          Igor Guimaraes created issue -
          Gerhard Petracek made changes -
          Field Original Value New Value
          Link This issue is depended upon by EXTVAL-142 [ EXTVAL-142 ]
          Gerhard Petracek made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Gerhard Petracek made changes -
          Description @BeanValidation(useGroups = MyGroup.class)
          public String send()
          {
              //...
              return "success";
          }
          extval doesn't support the validateBean tag to keep the type-safety of bv-groups (instead @BeanValidation is provided). however, also the tag isn't what users need when it comes to group validation in several cases. with the tag it's just possible to specify groups for input components or disable bv with the disabled attribute.

          a lot of cases just require different actions within a form which should process the whole form in a different manner (= different or no bv-group/s). furthermore, there are several use-cases which require to bypass the validation process e.g. via a special group which isn't used for bv-constraints (see EXTVAL-142). in such cases the usage of the immediate attribute doesn't fit and the usage of the disabled attribute is more like a workaround.

          extval already provides @BeanValidation to 'useGroups' and 'restrictGroups' (optionally for specific views via 'viewIds' and/or specific conditions via 'conditions'). this feature allows to re-use this annotation also for action methods. so it's possible to use it for the scenarios mentioned above as well as EXTVAL-142.

          a simple example:

          @BeanValidation(useGroups = MyGroup.class)
          public String send()
          {
              //...
              return "success";
          }

          a button which is bound to this action method will remove all configured groups of the current form for the current request, add the groups listed in 'useGroups' and locks the internal context until the invoke application phase to avoid that further groups get added.
          we can also think about just adding the groups and use 'restrictGroups' to remove the groups which shouldn't be used. and only SkipValidation of EXTVAL-141 would trigger the behaviour described before.
          Gerhard Petracek made changes -
          Fix Version/s 2.0.7 [ 12323488 ]
          Hide
          Gerhard Petracek added a comment - - edited

          currently we only support action-methods without parameters as well as std. action-listeners.
          action-methods with parameters might be supported later on, but we can't support multiple methods with the same name but different parameter/s. that's a basic el issue (if a parameter value resolves to null, it isn't possible to determine the type of the parameter).

          "workaround" for parameters:

          • f:attribute + ActionEvent#getComponent#getAttributes#get
            or
          • f:setPropertyActionListener
          Show
          Gerhard Petracek added a comment - - edited currently we only support action-methods without parameters as well as std. action-listeners. action-methods with parameters might be supported later on, but we can't support multiple methods with the same name but different parameter/s. that's a basic el issue (if a parameter value resolves to null, it isn't possible to determine the type of the parameter). "workaround" for parameters: f:attribute + ActionEvent#getComponent#getAttributes#get or f:setPropertyActionListener
          Gerhard Petracek made changes -
          Status In Progress [ 3 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Gerhard Petracek made changes -
          Link This issue relates to EXTVAL-152 [ EXTVAL-152 ]

            People

            • Assignee:
              Gerhard Petracek
              Reporter:
              Igor Guimaraes
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development