[ 
https://issues.apache.org/jira/browse/ISIS-1024?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14327666#comment-14327666
 ] 

ASF subversion and git services commented on ISIS-1024:
-------------------------------------------------------

Commit cb26cbe4bc9f6cfccca4f8b06d4c24694ff8b90b in isis's branch 
refs/heads/master from [~danhaywood]
[ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=cb26cbe ]

ISIS-1024: extend programming model to allow imperative validation of 
individual parameters (validateNXxx(...)).

Also:
- invoke per-param validation for all textfield Wicket widgets (previously was 
done only for the String/text datatypes; but it should be safe for other data 
types that are rendered in text field, eg numbers).


> Support imperative validation of a single action parameter argument (as well 
> as of entire parameter args).
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: ISIS-1024
>                 URL: https://issues.apache.org/jira/browse/ISIS-1024
>             Project: Isis
>          Issue Type: New Feature
>          Components: Core
>    Affects Versions: core-1.7.0
>            Reporter: Dan Haywood
>            Assignee: Dan Haywood
>            Priority: Minor
>             Fix For: core-1.8.0
>
>
> (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:
> {code}
>     public LeaseItem newItem(
>             final LeaseItemType type,
>             final Charge charge,
>             final InvoicingFrequency invoicingFrequency,
>             final PaymentMethod paymentMethod,
>             final @Named("Start date") LocalDate startDate,
>             final ApplicationTenancy applicationTenancy) {
>     }
> {code}
> I can write supporting methods for choices and defaults for a single 
> parameter:
> {code}
>     public List<ApplicationTenancy> choices5NewItem() { ... }
>     public ApplicationTenancy default5NewItem() { ... }
> {code}
> However it's not possible to validate an individual parameter arg, instead I 
> have to validate all:
> {code}
>     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;
>     }
> {code}
> I would prefer to be able to write:
> {code}
>     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;
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to