view src/main/java/de/intevation/lada/validation/Violation.java @ 534:23130e40e5b7

Added interfaces classes and annotations used for validation.
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 24 Feb 2015 10:52:14 +0100
parents
children deb3fec601ed
line wrap: on
line source
/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
 * Software engineering by Intevation GmbH
 *
 * This file is Free Software under the GNU GPL (v>=3)
 * and comes with ABSOLUTELY NO WARRANTY! Check out
 * the documentation coming with IMIS-Labordaten-Application for details.
 */
package de.intevation.lada.validation;

import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
 */
public class Violation {

    private Map<String, Integer> warnings;

    private Map<String, Integer> errors;

    public Violation() {
        this.warnings = new HashMap<String, Integer>();
        this.errors = new HashMap<String, Integer>();
    }

    public Map<String, Integer> getWarnings() {
        return this.warnings;
    }

    public Map<String, Integer> getErrors() {
        return this.errors;
    }

    public void addWarning(String key, Integer value) {
        this.warnings.put(key, value);
    }

    public void addError(String key, Integer value) {
        this.errors.put(key, value);
    }

    public void addWarnings(Map<String, Integer> warnings) {
        this.warnings.putAll(warnings);
    }

    public void addErrors(Map<String, Integer> errors) {
        this.errors.putAll(errors);
    }

    public boolean hasWarnings() {
        return this.warnings.size() > 0;
    }

    public boolean hasErrors() {
        return this.errors.size() > 0;
    }
}
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)