1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kns.datadictionary.exporter;
17
18 import java.util.Iterator;
19
20 import org.kuali.rice.kns.datadictionary.BusinessObjectEntry;
21 import org.kuali.rice.kns.datadictionary.FieldDefinition;
22 import org.kuali.rice.kns.datadictionary.InquiryDefinition;
23 import org.kuali.rice.kns.datadictionary.InquirySectionDefinition;
24
25
26
27
28
29
30 public class InquiryMapBuilder {
31
32
33
34
35 public InquiryMapBuilder() {
36 }
37
38
39
40
41
42
43
44 public ExportMap buildInquiryMap(BusinessObjectEntry entry) {
45 try {
46 ExportMap inquiryMap = null;
47
48 if (entry.hasInquiryDefinition()) {
49 InquiryDefinition inquiryDefinition = entry.getInquiryDefinition();
50 inquiryMap = new ExportMap("inquiry");
51
52 inquiryMap.set("title", inquiryDefinition.getTitle());
53
54 inquiryMap.set(buildInquiryFieldsMap(inquiryDefinition));
55 }
56
57 return inquiryMap;
58 } catch ( Exception ex ) {
59 throw new RuntimeException( "Unable to build inquiry Map for " + entry, ex );
60 }
61 }
62
63 private ExportMap buildInquiryFieldsMap(InquiryDefinition inquiryDefinition) {
64 ExportMap inquiryFieldsMap = new ExportMap("inquiryFields");
65
66 for (Iterator i = inquiryDefinition.getInquirySections().iterator(); i.hasNext();) {
67 InquirySectionDefinition inquirySection = (InquirySectionDefinition) i.next();
68 for (Iterator iter = inquirySection.getInquiryFields().iterator(); iter.hasNext();) {
69 FieldDefinition FieldDefinition = (FieldDefinition) iter.next();
70 inquiryFieldsMap.set(MapperUtils.buildFieldMap(FieldDefinition));
71 }
72 }
73
74 return inquiryFieldsMap;
75 }
76 }