View Javadoc

1   /*
2    * To change this template, choose Tools | Templates
3    * and open the template in the editor.
4    */
5   
6   package org.kuali.student.r2.common.datadictionary;
7   
8   import java.util.List;
9   import org.kuali.student.r2.common.dto.ContextInfo;
10  import org.kuali.student.r2.common.dto.ValidationResultInfo;
11  import org.kuali.student.r2.common.exceptions.InvalidParameterException;
12  import org.kuali.student.r2.common.exceptions.MissingParameterException;
13  import org.kuali.student.r2.common.exceptions.OperationFailedException;
14  import org.kuali.student.r2.common.exceptions.PermissionDeniedException;
15  
16  /**
17   *
18   * @author nwright
19   */
20  public interface DataDictionaryValidator {
21  
22      public static enum ValidationType {
23          FULL_VALIDATION, SKIP_REQUREDNESS_VALIDATIONS;
24  
25          public static ValidationType fromString (String str)
26            throws InvalidParameterException {
27              for (ValidationType vt : ValidationType.values()) {
28                  if (vt.name().equals(str)) {
29                      return vt;
30                  }
31              }
32              throw new InvalidParameterException ("validationType");
33          }
34      }
35  
36      /**
37       * Generic validation interface used to implement the individual validateXXXX (xxxxx) methods
38       * 
39       * This is not supposed to remotable because it's object is an Object.
40       *
41       * @param validationType, FULL_VALIDATION or SKIP_REQUIREDNESS_VALIDATIONS
42       * @param info object to be validated
43       * @param context of user and locale information
44       * @return list of validation results
45       */
46      public List<ValidationResultInfo> validate (ValidationType validationType, Object info, ContextInfo context)
47        throws OperationFailedException, MissingParameterException, InvalidParameterException, PermissionDeniedException;
48  }