changeset 116:92affd9467f8

Added warnings to ValidationException.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 12 Jun 2013 14:43:46 +0200
parents 02a4eddc7760
children 92b8b0e1e9fc
files src/main/java/de/intevation/lada/validation/ValidationException.java
diffstat 1 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/validation/ValidationException.java	Wed Jun 12 14:42:07 2013 +0200
+++ b/src/main/java/de/intevation/lada/validation/ValidationException.java	Wed Jun 12 14:43:46 2013 +0200
@@ -1,5 +1,6 @@
 package de.intevation.lada.validation;
 
+import java.util.HashMap;
 import java.util.Map;
 
 /**
@@ -16,6 +17,11 @@
     private Map<String, Integer> errors;
 
     /**
+     * Warnings saved in this exception.
+     */
+    private Map<String, Integer> warnings;
+
+    /**
      * Do not allow an empty ValidationException object. 
      */
     private ValidationException() {
@@ -29,6 +35,21 @@
     public ValidationException(Map<String, Integer> errors) {
         this();
         this.errors = errors;
+        this.warnings = new HashMap<String, Integer>();
+    }
+
+    /**
+     * Create a new instance with errors and warnings.
+     *
+     * @param errors
+     */
+    public ValidationException(
+        Map<String, Integer> errors,
+        Map<String, Integer> warnings
+    ) {
+        this();
+        this.errors = errors;
+        this.warnings = warnings;
     }
 
     /**
@@ -39,4 +60,13 @@
     public Map<String, Integer> getErrors() {
         return errors;
     }
+
+    /**
+     * Getter for the warnings.
+     *
+     * @return
+     */
+    public Map<String, Integer> getWarnings() {
+        return warnings;
+    }
 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)