View Javadoc
1   /*
2    * Copyright 2007 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 1.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl1.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.student.r2.common.validator;
17  
18  import java.util.List;
19  import java.util.Stack;
20  
21  import org.kuali.student.r1.common.dictionary.dto.ObjectStructureDefinition;
22  import org.kuali.student.r1.common.dictionary.dto.FieldDefinition;
23  import org.kuali.student.r2.common.dto.ContextInfo;
24  import org.kuali.student.r2.common.dto.ValidationResultInfo;
25  
26  /**
27   * This is an abstract class that allows the sub implementations an option to reference
28   * ValidatorFactory. Any custom validator code that requires validatorFactory should
29   * extend this abstract class.
30   * 
31   * @author Kuali Rice Team (kuali-rice@googlegroups.com)
32   * 
33   */
34  
35  // This class is a special case, this class/equivelent doesn't exist in R2 
36  // packages and is a common and has methods used in both R1 and R2 packages, 
37  // this class was duplicated to R2 and modified to work with R2 services
38  // BaseAbstractValidator, BaseAbstractValidator, Validator, ValidatorFactory
39  
40  public abstract class BaseAbstractValidator implements Validator {
41  
42      protected ValidatorFactory validatorFactory;
43    
44      public ValidatorFactory getValidatorFactory() {
45          return validatorFactory;
46      }
47  
48      public void setValidatorFactory(ValidatorFactory validatorFactory) {
49          this.validatorFactory = validatorFactory;
50      }
51  
52      /**
53       * @see org.kuali.student.r1.common.validator.Validator#validateObject(java.lang.Object, org.kuali.student.common.dictionary.dto.ObjectStructureDefinition)
54       */
55      @Override
56      public abstract List<ValidationResultInfo> validateObject(Object o, ObjectStructureDefinition objStructure, ContextInfo contextInfo);
57  
58      /**
59       * @see org.kuali.student.r1.common.validator.Validator#validateObject(org.kuali.student.common.dictionary.dto.FieldDefinition, java.lang.Object, org.kuali.student.common.dictionary.dto.ObjectStructureDefinition, java.util.Stack)
60       */
61      @Override
62      public abstract List<ValidationResultInfo> validateObject(FieldDefinition field, Object o, ObjectStructureDefinition objStructure, Stack<String> elementStack, ContextInfo contextInfo);
63  }