1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.rice.kns.datadictionary;
18
19 import java.util.ArrayList;
20 import java.util.List;
21
22 import org.apache.commons.lang.StringUtils;
23 import org.kuali.rice.kns.inquiry.Inquirable;
24 import org.kuali.rice.kns.inquiry.InquiryAuthorizer;
25 import org.kuali.rice.kns.inquiry.InquiryPresentationController;
26
27
28
29
30
31
32
33
34
35
36 public class InquiryDefinition extends DataDictionaryDefinitionBase {
37 private static final long serialVersionUID = -2506403061297774668L;
38
39 protected String title;
40 protected List<InquirySectionDefinition> inquirySections = new ArrayList<InquirySectionDefinition>();
41 protected Class<? extends Inquirable> inquirableClass;
42 protected Class<? extends InquiryPresentationController> presentationControllerClass;
43 protected Class<? extends InquiryAuthorizer> authorizerClass;
44
45 protected boolean translateCodes = true;
46
47 public InquiryDefinition() {
48 }
49
50
51 public String getTitle() {
52 return title;
53 }
54
55
56
57
58
59
60 public void setTitle(String title) {
61 if (StringUtils.isBlank(title)) {
62 throw new IllegalArgumentException("invalid (blank) title");
63 }
64
65 this.title = title;
66 }
67
68
69
70
71
72 public List<InquirySectionDefinition> getInquirySections() {
73 return inquirySections;
74 }
75
76
77
78
79
80
81 public FieldDefinition getFieldDefinition(String fieldName) {
82 for (InquirySectionDefinition section : inquirySections ) {
83 for (FieldDefinition field : section.getInquiryFields() ) {
84 if (field.getAttributeName().equals(fieldName)) {
85 return field;
86 }
87 }
88 }
89
90 return null;
91 }
92
93
94
95
96
97
98 public void completeValidation(Class rootBusinessObjectClass, Class otherBusinessObjectClass) {
99 for ( InquirySectionDefinition inquirySection : inquirySections ) {
100 inquirySection.completeValidation(rootBusinessObjectClass, null);
101 }
102 }
103
104 public InquirySectionDefinition getInquirySection( String sectionTitle ) {
105 for ( InquirySectionDefinition inquirySection : inquirySections ) {
106 if ( inquirySection.getTitle().equals(sectionTitle) ) {
107 return inquirySection;
108 }
109 }
110 return null;
111 }
112
113
114
115
116
117 public String toString() {
118 return "InquiryDefinition '" + getTitle() + "'";
119 }
120
121
122 public Class<? extends Inquirable> getInquirableClass() {
123 return inquirableClass;
124 }
125
126
127
128
129
130
131
132
133
134
135
136 public void setInquirableClass(Class<? extends Inquirable> inquirableClass) {
137 this.inquirableClass = inquirableClass;
138 }
139
140
141
142
143
144 public void setInquirySections(List<InquirySectionDefinition> inquirySections) {
145 this.inquirySections = inquirySections;
146 }
147
148
149 public Class<? extends InquiryPresentationController> getPresentationControllerClass() {
150 return this.presentationControllerClass;
151 }
152
153
154 public void setPresentationControllerClass(
155 Class<? extends InquiryPresentationController> presentationControllerClass) {
156 this.presentationControllerClass = presentationControllerClass;
157 }
158
159
160 public Class<? extends InquiryAuthorizer> getAuthorizerClass() {
161 return this.authorizerClass;
162 }
163
164
165 public void setAuthorizerClass(
166 Class<? extends InquiryAuthorizer> authorizerClass) {
167 this.authorizerClass = authorizerClass;
168 }
169
170
171 public boolean isTranslateCodes() {
172 return this.translateCodes;
173 }
174
175
176 public void setTranslateCodes(boolean translateCodes) {
177 this.translateCodes = translateCodes;
178 }
179
180 }