Uploaded image for project: 'Causeway'
  1. Causeway
  2. CAUSEWAY-2419

Less verbose Action Dialog Validation Feedback, if its (just) a Constraint Violation (suppress Category)

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Resolved
    • 2.0.0-M3
    • 2.0.0-M4
    • Viewer Wicket

    Description

      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:

      Code that produces the message

      	@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;
      	}
      

      This problem does not manifest if I do validation on only one of the action parameters, as follows:

      Screenshot:

      Code of validation message:

       

      	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;
      	}
      

       

      Attachments

        1. image-2020-08-05-22-26-25-207.png
          56 kB
          Simon Titheridge
        2. image-2020-08-05-22-29-10-621.png
          46 kB
          Simon Titheridge

        Activity

          People

            hobrom Andi Huber
            stitheridge Simon Titheridge
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: