raimund@711: /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz raimund@711: * Software engineering by Intevation GmbH raimund@711: * raimund@711: * This file is Free Software under the GNU GPL (v>=3) raimund@711: * and comes with ABSOLUTELY NO WARRANTY! Check out raimund@711: * the documentation coming with IMIS-Labordaten-Application for details. raimund@711: */ raimund@570: package de.intevation.lada.validation.rules.probe; raimund@570: raimund@570: import de.intevation.lada.model.land.LProbe; raimund@570: import de.intevation.lada.validation.Violation; raimund@570: import de.intevation.lada.validation.annotation.ValidationRule; raimund@570: import de.intevation.lada.validation.rules.Rule; raimund@570: raimund@711: /** raimund@711: * Validation rule for probe. raimund@711: * Validates if the field "test" was set. raimund@711: * raimund@711: * @author Raimund Renkert raimund@711: */ raimund@570: @ValidationRule("Probe") raimund@570: public class HasTestdatensatz implements Rule { raimund@570: raimund@570: @Override raimund@570: public Violation execute(Object object) { raimund@570: LProbe probe = (LProbe)object; raimund@570: if (probe.getTest() == null || raimund@570: probe.getTest().equals("")) { raimund@570: Violation violation = new Violation(); raimund@570: violation.addError("test", 631); raimund@570: return violation; raimund@570: } raimund@570: return null; raimund@570: } raimund@570: }