[ 
https://issues.apache.org/jira/browse/ISIS-2419?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andi Huber updated ISIS-2419:
-----------------------------
    Component/s:     (was: Isis Core)
                 Isis Viewer Wicket

> Validate prefix-method on Action has boilerplate text in error message
> ----------------------------------------------------------------------
>
>                 Key: ISIS-2419
>                 URL: https://issues.apache.org/jira/browse/ISIS-2419
>             Project: Isis
>          Issue Type: Improvement
>          Components: Isis Viewer Wicket
>    Affects Versions: 2.0.0-M3
>            Reporter: Simon Titheridge
>            Assignee: Andi Huber
>            Priority: Minor
>              Labels: newbie
>             Fix For: 2.0.0-M4
>
>         Attachments: image-2020-08-05-22-26-25-207.png, 
> image-2020-08-05-22-29-10-621.png
>
>
> If I have an action "update" that is validated in it's entirety by a 
> validation method "validateUpdate" then the error message in the wicket 
> viewer shows unwanted boiler plate wording ("_[violation of some declarative 
> constraint]:_") together with the desired error message.
> *Screenshot of unwanted text:*
> !image-2020-08-05-22-26-25-207.png|width=516,height=332!
> *Code that produces the message*
> {code:java}
>       @Action(semantics = SemanticsOf.NON_IDEMPOTENT)
>       public Task update(
>                       TaskStatus status,
>                       @Parameter(optionality = Optionality.OPTIONAL) String 
> comment) {
>               
>               this.status = status;
>               if (comment != null) {
>                       this.comments = 
> "".concat(this.comments).concat(comment).concat("\n");
>               }
>               return repositoryService.persist(this);
>       }
>       
>       public String validateUpdate(TaskStatus status, String comment) {
>               if (this.status != status) {
>                       if (this.status == TaskStatus.Complete || this.status 
> == TaskStatus.Cancelled) {
>                               return "Can't change status of a task that is 
> Complete or Cancelled";
>                       }
>               }
>               return null;
>       }
> {code}
> This problem does not manifest if I do validation on only one of the action 
> parameters, as follows:
> *Screenshot:*
> *!image-2020-08-05-22-29-10-621.png|width=627,height=358!*
> *Code of validation message:*
>  
> {code:java}
>       public String validate0Update(TaskStatus status) {
>               if (this.status != status) {
>                       if (this.status == TaskStatus.Complete || this.status 
> == TaskStatus.Cancelled) {
>                               return "Can't change status of a task that is 
> Complete or Cancelled";
>                       }
>               }
>               return null;
>       }
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to