View Javadoc

1   /*
2    * Copyright 2011 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.datadictionary;
17  
18  import org.kuali.rice.krad.datadictionary.AttributeDefinition;
19  import org.kuali.student.r2.common.datadictionary.infc.AttributeDefinitionInfc;
20  
21  /**
22   *
23   * @author nwright
24   */
25  public class Student2RiceAttributeDefinitionConverter {
26  
27      private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(Student2RiceAttributeDefinitionConverter.class);
28  
29      public AttributeDefinition convert(AttributeDefinitionInfc student) {
30          AttributeDefinition rice = new AttributeDefinition();
31          rice.setName(student.getName());
32          rice.setChildEntryName(student.getChildEntryName());
33          rice.setDataType(student.getDataType());
34          rice.setRequired(student.getIsRequired());
35  //        rice.setMinOccurs(student.getMinOccurs());
36  //        rice.setMaxOccurs(student.getMaxOccurs());
37          rice.setMinLength(student.getMinLength());
38          rice.setMaxLength(student.getMaxLength());
39          rice.setForceUppercase(student.getIsForceUppercase());
40          rice.setShortLabel(student.getShortLabel());
41          rice.setSummary(student.getSummary());
42          rice.setLabel(student.getLabel());
43          rice.setDescription(student.getDescription());
44          rice.setExclusiveMin(student.getExclusiveMin());
45          rice.setInclusiveMax(student.getInclusiveMax());
46          rice.setDisplayLabelAttribute(student.getDisplayLabelAttribute());
47          rice.setUnique(student.getIsUnique());
48          rice.setCustomValidatorClass(student.getCustomValidatorClass());
49          if (student.getFormatterClass() != null) {
50              rice.setFormatterClass(student.getFormatterClass());
51          }
52          if (student.getValidCharactersConstraint() != null) {
53              rice.setValidCharactersConstraint(new Student2RiceValidCharactersConstraintConverter().convert(student.getValidCharactersConstraint()));
54          }
55          return rice;
56      }
57  }