package org.ovirt.engine.core.bll;

import org.ovirt.engine.core.dal.VdcBllMessages;

/**
 * Used to represent the validation result for a "Can Do Action" validation operation, which can either return that the
 * validation succeeded, or that it failed with a specific message.<br>
 * This result can then be parsed by "Can Do Action" to decide if it should proceed or not.
 */
public class ValidationResult {

    /**
     * Indicates if the validation succeeded or failed.
     */
    private boolean valid;

    /**
     * In case the validation succeeded it is <code>null</code>, otherwise it contains the validation failure message.
     */
    private VdcBllMessages message;

    /**
     * Default validation result is success with no message.
     */
    public ValidationResult() {
        valid = true;
    }

    /**
     * Validation result for failure with a given message.
     *
     * @param message
     *            The validation failure message.
     */
    public ValidationResult(VdcBllMessages message) {
        this.message = message;
    }

    /**
     * @return Did the validation succeed or not?
     */
    public boolean isValid() {
        return valid;
    }

    /**
     * @return <code>null</code> in case the validation succeeded, otherwise the validation failure message
     */
    public VdcBllMessages getMessage() {
        return message;
    }
}

@@ -378,16 +378,22 @@
 %0Apublic 
+final 
 class Va
@@ -414,108 +414,8 @@
  %7B%0A%0A
-    /**%0A     * Indicates if the validation succeeded or failed.%0A     */%0A    private boolean valid;%0A%0A
     
@@ -557,16 +557,22 @@
 private 
+final 
 VdcBllMe
@@ -709,20 +709,18 @@
     
-valid = true
+this(null)
 ;%0A  
@@ -928,24 +928,140 @@
  message) %7B%0A
+        if(message == null) %7B%0A            throw new IllegalArgumentException(%22message must not be null%22);%0A        %7D%0A
         this
@@ -1199,21 +1199,31 @@
  return 
-valid
+message == null
 ;%0A    %7D%0A

simplify ValidationResult