public void validate(Object obj, Errors errors) {
System.out.println("validate");
ConstructionDefectZone constructionDefect = (ConstructionDefectZone) obj;
if (constructionDefect.getDangerCategory().getDangerCategoryId()
.equals(-1)) {
errors.rejectValue("dangerCategory.dangerCategoryId",
"constructionDefect.noDangerCategory");
}
if (constructionDefect.getDefectType().getDefectTypeId().equals(-1)) {
errors.rejectValue("defectType.defectTypeId",
"constructionDefect.noDefectType");
} else {
// checking if all defect parameters were filled
List defectParameterList = constructionDefect.getDefectParameters();
for (int i = 0; i < defectParameterList.size(); i++) {
DefectParameterZone defectParameter = (DefectParameterZone) defectParameterList
.get(i);
if (defectParameter.getParameterValue() == 0.0 // ||
// defectParameter.getParameterValueSecond()
// == 0.0
) {
errors.rejectValue("defectParameters[" + i + "]",
"constructionDefect.noDefectParameterValue");
}
}
}
if (constructionDefect.getDefectVarity().getVarityId().equals(-1)) {
errors.rejectValue("defectVarity.varityId",
"constructionDefect.noDefectVarity");
}
if (constructionDefect.getDefectZone().getDefectZoneId().equals(-1)) {
errors.rejectValue("defectZone.defectZoneId",
"constructionDefect.noDefectZone");
}
// if ((constructionDefect.getFile()==null ||