Details
-
New Feature
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
core-1.7.0
-
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; }