public boolean supports(Class aClass) {
return (ObjectExpertType.class.isAssignableFrom(aClass));
}
public void validate(Object o, Errors errors) {
ObjectExpertType expertType=(ObjectExpertType)o;
if (expertType.getAppointment()==null || expertType.getDefinition()==null || expertType.getExpertName()==null ||
expertType.getAppointment().trim().equals("") || expertType.getDefinition().trim().equals("") || expertType.getExpertName().trim().equals("")){
if (expertType.getDefinition()==null || expertType.getDefinition().trim().equals("")){
errors.rejectValue("definition", "objectExpertType.error.definition");
}
if (expertType.getAppointment()==null || expertType.getAppointment().trim().equals("")){
errors.rejectValue("appointment", "objectExpertType.error.appointment");
}
if (expertType.getExpertName()==null || expertType.getExpertName().trim().equals("")){
errors.rejectValue("expertName", "objectExpertType.error.expertName");
}
}else{
if (objectExpertTypeManager.objectExpertTypeExist(expertType) && expertType.getExpertId()==null){
errors.rejectValue("expertId", "objectExpertType.error");
}
}
}