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.FieldDefinition; |
21 | |
import org.kuali.rice.kns.datadictionary.InquiryDefinition; |
22 | |
import org.kuali.rice.kns.datadictionary.InquirySectionDefinition; |
23 | |
import org.kuali.rice.kns.datadictionary.BusinessObjectEntry; |
24 | |
import org.kuali.rice.krad.datadictionary.exporter.ExportMap; |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
@Deprecated |
32 | |
public class InquiryMapBuilder { |
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | 0 | public InquiryMapBuilder() { |
38 | 0 | } |
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
public ExportMap buildInquiryMap(BusinessObjectEntry entry) { |
47 | |
try { |
48 | 0 | ExportMap inquiryMap = null; |
49 | |
|
50 | 0 | if (entry.hasInquiryDefinition()) { |
51 | 0 | InquiryDefinition inquiryDefinition = entry.getInquiryDefinition(); |
52 | 0 | inquiryMap = new ExportMap("inquiry"); |
53 | |
|
54 | 0 | inquiryMap.set("title", inquiryDefinition.getTitle()); |
55 | |
|
56 | 0 | inquiryMap.set(buildInquiryFieldsMap(inquiryDefinition)); |
57 | |
} |
58 | |
|
59 | 0 | return inquiryMap; |
60 | 0 | } catch ( Exception ex ) { |
61 | 0 | throw new RuntimeException( "Unable to build inquiry Map for " + entry, ex ); |
62 | |
} |
63 | |
} |
64 | |
|
65 | |
private ExportMap buildInquiryFieldsMap(InquiryDefinition inquiryDefinition) { |
66 | 0 | ExportMap inquiryFieldsMap = new ExportMap("inquiryFields"); |
67 | |
|
68 | 0 | for (Iterator i = inquiryDefinition.getInquirySections().iterator(); i.hasNext();) { |
69 | 0 | InquirySectionDefinition inquirySection = (InquirySectionDefinition) i.next(); |
70 | 0 | for (Iterator iter = inquirySection.getInquiryFields().iterator(); iter.hasNext();) { |
71 | 0 | FieldDefinition FieldDefinition = (FieldDefinition) iter.next(); |
72 | 0 | inquiryFieldsMap.set(MapperUtils.buildFieldMap(FieldDefinition)); |
73 | 0 | } |
74 | 0 | } |
75 | |
|
76 | 0 | return inquiryFieldsMap; |
77 | |
} |
78 | |
} |