1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.r2.common.datadictionary;
17
18 import java.util.ArrayList;
19 import java.util.List;
20 import org.kuali.rice.krad.datadictionary.AttributeDefinition;
21 import org.kuali.rice.krad.datadictionary.DataObjectEntry;
22 import org.kuali.student.r2.common.datadictionary.infc.AttributeDefinitionInfc;
23 import org.kuali.student.r2.common.datadictionary.infc.DictionaryEntry;
24
25
26
27
28
29 public class Student2RiceDictionaryEntryConverter {
30
31 private static org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(Student2RiceDictionaryEntryConverter.class);
32
33 public DataObjectEntry convert(DictionaryEntry student) {
34 DataObjectEntry rice = new DataObjectEntry ();
35 try {
36 rice.setDataObjectClass(Class.forName(student.getObjectClass()));
37 } catch (ClassNotFoundException ex) {
38 throw new IllegalArgumentException (student.getObjectClass(), ex);
39 }
40 rice.setName(student.getName());
41 rice.setObjectLabel(student.getObjectLabel());
42 rice.setObjectDescription(student.getObjectDescription());
43 rice.setTitleAttribute(student.getTitleAttribute());
44 rice.setPrimaryKeys(student.getPrimaryKeys());
45 if (student.getAttributes() != null) {
46 List<AttributeDefinition> list = new ArrayList(student.getAttributes().size());
47 for (AttributeDefinitionInfc ad : student.getAttributes()) {
48 list.add(new Student2RiceAttributeDefinitionConverter ().convert(ad));
49 }
50 rice.setAttributes (list);
51 }
52 return rice;
53 }
54 }