View Javadoc

1   package org.kuali.mobility.database.validators;
2   
3   import org.kuali.mobility.database.entity.DatabaseSchemaOutputForm;
4   import org.springframework.validation.Errors;
5   import org.springframework.validation.Validator;
6   
7   public class DatabaseSchemaOutputFormValidator implements Validator {
8   
9   	@Override
10  	public boolean supports(Class<?> parameter) {
11  		return DatabaseSchemaOutputForm.class.equals(parameter);
12  	}
13  
14  	@Override
15  	public void validate(Object object, Errors errors) {
16  		DatabaseSchemaOutputForm form = (DatabaseSchemaOutputForm) object;
17  //		if (form.getDelimiter() == null || "".equals(form.getDelimiter().trim())) {
18  //			errors.rejectValue("delimiter", "DELIMITER.REQUIRED", "A delimiter is required.");
19  //		}
20  		if (form.getDialectType() == null || "".equals(form.getDialectType().trim())) {
21  			errors.rejectValue("dialectType", "DIALECT.TYPE.REQUIRED", "Selecting a database type is required.");
22  		}
23  	}
24  
25  }