Dan Haywood created ISIS-1024:
---------------------------------

             Summary: 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