Uploaded image for project: 'Isis'
  1. Isis
  2. ISIS-1024

Support imperative validation of a single action parameter argument (as well as of entire parameter args).

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: core-1.7.0
    • Fix Version/s: core-1.8.0
    • Component/s: Core
    • Labels:
      None

      Description

      (Did this feature get removed accidentally somehow, or was I imagining it?)

      Require imperative validation on action parameters (ActionParameterValidationFacet implementing ValidatingInteractionAdvisor).

      To explain; I have an action:

          public LeaseItem newItem(
                  final LeaseItemType type,
                  final Charge charge,
                  final InvoicingFrequency invoicingFrequency,
                  final PaymentMethod paymentMethod,
                  final @Named("Start date") LocalDate startDate,
                  final ApplicationTenancy applicationTenancy) {
          }
      

      I can write supporting methods for choices and defaults for a single parameter:

          public List<ApplicationTenancy> choices5NewItem() { ... }
          public ApplicationTenancy default5NewItem() { ... }
      

      However it's not possible to validate an individual parameter arg, instead I have to validate all:

          public String validateNewItem(final LeaseItemType type,
                                         final Charge charge,
                                         final InvoicingFrequency invoicingFrequency,
                                         final PaymentMethod paymentMethod,
                                         final @Named("Start date") LocalDate startDate,
                                         final ApplicationTenancy applicationTenancy) {
              return !getApplicationTenancy().getChildren().contains(applicationTenancy)
                      ? String.format(
                          "Application tenancy '%s' is not valid for this lease (having application tenancy path '%s')",
                          applicationTenancy.getPath(),
                          getApplicationTenancyPath())
                      : null;
          }
      

      I would prefer to be able to write:

          public String validate5NewItem(final ApplicationTenancy applicationTenancy) {
              return !getApplicationTenancy().getChildren().contains(applicationTenancy)
                      ? String.format(
                          "Application tenancy '%s' is not valid for this lease (having application tenancy path '%s')",
                          applicationTenancy.getPath(),
                          getApplicationTenancyPath())
                      : null;
          }
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              danhaywood Dan Haywood
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: