return Reason.class.isAssignableFrom(candidate);
}
public void validate(Object obj, Errors errors) {
Reason reason=(Reason)obj;
//checking reason name
if(reason.getReasonName().getReasonNameId().equals(new Long(-1))){
errors.rejectValue("reasonName", "reason.noReasonName");
}
//checking defectZone
if(reason.getDefectZone().getDefectZoneId().equals(new Long(-1))){
errors.rejectValue("defectZone", "reason.noDefectZone");
}
//checking defectType
if(reason.getDefectType().getDefectTypeId().equals(new Long(-1))){
errors.rejectValue("defectType", "reason.noDefectType");
}
//checking defectVarity
if(reason.getDefectVarity().getVarityId().equals(new Long(-1))){
errors.rejectValue("defectVarity", "reason.noDefectVarity");
}
//checking constructionType
if(reason.getConstructionType().getConstructionTypeId().equals(new Long(-1))){
errors.rejectValue("constructionType", "reason.noConstructionType");
}
if(!reasonManager.isUniqueReason(reason)){
errors.rejectValue("reasonId","reason.notUnique");