1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kns_2_4_M2.datadictionary;
17
18 import java.util.ArrayList;
19 import java.util.HashMap;
20 import java.util.List;
21 import java.util.Map;
22
23 import org.kuali.rice.krad.bo.BusinessObject;
24 import org.kuali.rice.krad.datadictionary.exception.DuplicateEntryException;
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43 @Deprecated
44 public class InquiryCollectionDefinition extends FieldDefinition implements CollectionDefinitionI {
45 private static final long serialVersionUID = 2257743293609536893L;
46
47 protected Class<? extends BusinessObject> businessObjectClass;
48
49 protected Integer numberOfColumns = 1;
50
51 protected Map<String,FieldDefinition> inquiryFieldMap = new HashMap<String, FieldDefinition>();
52 protected Map<String,InquiryCollectionDefinition> inquiryCollectionMap = new HashMap<String, InquiryCollectionDefinition>();
53 protected Map<String,FieldDefinitionI> summaryFieldMap = new HashMap<String, FieldDefinitionI>();
54 protected List<FieldDefinition> inquiryFields = new ArrayList<FieldDefinition>();
55 protected List<InquiryCollectionDefinition> inquiryCollections = new ArrayList<InquiryCollectionDefinition>();
56 protected List<FieldDefinition> summaryFields = new ArrayList<FieldDefinition>();
57
58 protected String summaryTitle;
59
60
61 public InquiryCollectionDefinition() {}
62
63 public Class<? extends BusinessObject> getBusinessObjectClass() {
64 return businessObjectClass;
65 }
66
67
68
69
70
71 public void setBusinessObjectClass(Class<? extends BusinessObject> businessObjectClass) {
72 this.businessObjectClass = businessObjectClass;
73 }
74
75 public Integer getNumberOfColumns() {
76 return numberOfColumns;
77 }
78
79
80
81
82
83
84
85
86
87 public void setNumberOfColumns(Integer numberOfColumns) {
88 this.numberOfColumns = numberOfColumns;
89 }
90
91 public String getName() {
92 return getAttributeName();
93 }
94
95 public List<? extends CollectionDefinitionI> getCollections() {
96 return inquiryCollections;
97 }
98
99 public List<? extends FieldDefinitionI> getFields() {
100 return inquiryFields;
101 }
102
103 public boolean getIncludeAddLine() {
104 return false;
105 }
106
107 public boolean isAlwaysAllowCollectionDeletion() {
108 return false;
109 }
110
111 public boolean hasSummaryField(String key) {
112 return summaryFieldMap.containsKey(key);
113 }
114
115
116
117
118
119 public void setSummaryTitle(String summaryTitle) {
120 this.summaryTitle = summaryTitle;
121 }
122
123 public String getSummaryTitle() {
124 return this.summaryTitle;
125 }
126
127 public List<FieldDefinition> getInquiryFields() {
128 return this.inquiryFields;
129 }
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170 public void setInquiryFields(List<FieldDefinition> inquiryFields) {
171 inquiryFieldMap.clear();
172 for ( FieldDefinition inquiryField : inquiryFields ) {
173 if (inquiryField == null) {
174 throw new IllegalArgumentException("invalid (null) inquiryField");
175 }
176
177 String itemName = inquiryField.getAttributeName();
178 if (inquiryFieldMap.containsKey(itemName)) {
179 throw new DuplicateEntryException(
180 "duplicate itemName entry for item '" + itemName + "'");
181 }
182
183 inquiryFieldMap.put(itemName, inquiryField);
184 }
185
186 this.inquiryFields = inquiryFields;
187 }
188
189 public List<InquiryCollectionDefinition> getInquiryCollections() {
190 return inquiryCollections;
191 }
192
193
194
195
196
197 public void setInquiryCollections(List<InquiryCollectionDefinition> inquiryCollections) {
198 inquiryCollectionMap.clear();
199 for ( InquiryCollectionDefinition inquiryCollection : inquiryCollections ) {
200 if (inquiryCollection == null) {
201 throw new IllegalArgumentException(
202 "invalid (null) inquiryCollection");
203 }
204
205 String fieldName = inquiryCollection.getName();
206 if (inquiryCollectionMap.containsKey(fieldName)) {
207 throw new DuplicateEntryException(
208 "duplicate fieldName entry for field '" + fieldName + "'");
209 }
210
211 inquiryCollectionMap.put(fieldName, inquiryCollection);
212 }
213 this.inquiryCollections = inquiryCollections;
214 }
215
216 public List<FieldDefinition> getSummaryFields() {
217 return this.summaryFields;
218 }
219
220
221
222
223
224
225
226
227
228
229
230
231 public void setSummaryFields(List<FieldDefinition> summaryFields) {
232 summaryFieldMap.clear();
233 for ( FieldDefinition inquiryField : summaryFields ) {
234 if (inquiryField == null) {
235 throw new IllegalArgumentException("invalid (null) summaryField");
236 }
237
238 String itemName = inquiryField.getAttributeName();
239 if (summaryFieldMap.containsKey(itemName)) {
240 throw new DuplicateEntryException(
241 "duplicate itemName entry for item '" + itemName + "'");
242 }
243
244 summaryFieldMap.put(itemName, inquiryField);
245 }
246 this.summaryFields = summaryFields;
247 }
248
249
250 }