1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.widget;
17
18 import java.util.HashMap;
19 import java.util.Map;
20
21 import org.apache.commons.lang.StringUtils;
22 import org.kuali.rice.krad.datadictionary.parse.BeanTag;
23 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
24 import org.kuali.rice.krad.uif.component.Component;
25 import org.kuali.rice.krad.uif.util.LifecycleElement;
26 import org.kuali.rice.krad.uif.util.ScriptUtils;
27 import org.kuali.rice.krad.util.KRADUtils;
28
29
30
31
32
33 @BeanTag(name = "locationSuggest", parent = "Uif-LocationSuggest")
34 public class LocationSuggest extends Suggest {
35 private static final long serialVersionUID = 5940714417896326889L;
36
37 private String baseUrl;
38 private String additionalUrlPathPropertyName;
39 private String hrefPropertyName;
40 private String objectIdPropertyName;
41 private Map<String, String> requestParameterPropertyNames;
42 private Map<String, String> additionalRequestParameters;
43
44
45
46
47
48
49 @Override
50 public void performFinalize(Object model, LifecycleElement parent) {
51 super.performFinalize(model, parent);
52
53 if (requestParameterPropertyNames == null) {
54 requestParameterPropertyNames = new HashMap<String, String>();
55 }
56
57 if (StringUtils.isNotBlank(objectIdPropertyName)) {
58 requestParameterPropertyNames.put(objectIdPropertyName, objectIdPropertyName);
59 }
60 }
61
62
63
64
65 @Override
66 public LocationSuggestPostData getPostData() {
67 return new LocationSuggestPostData(this);
68 }
69
70
71
72
73
74
75
76 @BeanTagAttribute
77 public String getBaseUrl() {
78 return baseUrl;
79 }
80
81
82
83
84
85
86 public void setBaseUrl(String baseUrl) {
87 this.baseUrl = baseUrl;
88 }
89
90
91
92
93
94
95
96
97
98
99
100 @BeanTagAttribute
101 public String getAdditionalUrlPathPropertyName() {
102 return additionalUrlPathPropertyName;
103 }
104
105
106
107
108
109
110 public void setAdditionalUrlPathPropertyName(String additionalUrlPathPropertyName) {
111 this.additionalUrlPathPropertyName = additionalUrlPathPropertyName;
112 }
113
114
115
116
117
118
119
120
121
122
123
124
125 @BeanTagAttribute
126 public String getHrefPropertyName() {
127 return hrefPropertyName;
128 }
129
130
131
132
133
134
135 public void setHrefPropertyName(String hrefPropertyName) {
136 this.hrefPropertyName = hrefPropertyName;
137 }
138
139
140
141
142
143
144
145
146
147
148
149
150 @BeanTagAttribute
151 public String getObjectIdPropertyName() {
152 return objectIdPropertyName;
153 }
154
155
156
157
158
159
160 public void setObjectIdPropertyName(String objectIdPropertyName) {
161 this.objectIdPropertyName = objectIdPropertyName;
162 }
163
164
165
166
167
168
169
170
171
172
173 @BeanTagAttribute
174 public Map<String, String> getRequestParameterPropertyNames() {
175 return requestParameterPropertyNames;
176 }
177
178
179
180
181
182
183 public void setRequestParameterPropertyNames(Map<String, String> requestParameterPropertyNames) {
184 this.requestParameterPropertyNames = requestParameterPropertyNames;
185 }
186
187
188
189
190
191
192
193
194
195
196
197 @BeanTagAttribute
198 public Map<String, String> getAdditionalRequestParameters() {
199 return additionalRequestParameters;
200 }
201
202
203
204
205
206
207 public void setAdditionalRequestParameters(Map<String, String> additionalRequestParameters) {
208 this.additionalRequestParameters = additionalRequestParameters;
209 }
210
211
212
213
214
215
216 public String getRequestParameterPropertyNameJsObject() {
217 if (requestParameterPropertyNames != null && !requestParameterPropertyNames.isEmpty()) {
218 return ScriptUtils.translateValue(requestParameterPropertyNames);
219 } else {
220 return "{}";
221 }
222 }
223
224
225
226
227
228
229 public String getAdditionalRequestParameterString() {
230 if (additionalRequestParameters != null) {
231 return KRADUtils.getRequestStringFromMap(additionalRequestParameters);
232 } else {
233 return "";
234 }
235 }
236
237
238
239
240 public static class LocationSuggestPostData extends SuggestPostData {
241 private static final long serialVersionUID = -4326794621463438438L;
242
243 private String baseUrl;
244 private String additionalUrlPathPropertyName;
245 private String hrefPropertyName;
246 private String objectIdPropertyName;
247 private Map<String, String> requestParameterPropertyNames;
248 private Map<String, String> additionalRequestParameters;
249
250
251
252
253
254
255 public LocationSuggestPostData(LocationSuggest suggest) {
256 super(suggest);
257
258 this.baseUrl = suggest.getBaseUrl();
259 this.additionalUrlPathPropertyName = suggest.getAdditionalUrlPathPropertyName();
260 this.hrefPropertyName = suggest.getHrefPropertyName();
261 this.objectIdPropertyName = suggest.getObjectIdPropertyName();
262 this.requestParameterPropertyNames = suggest.getRequestParameterPropertyNames();
263 this.additionalRequestParameters = suggest.getAdditionalRequestParameters();
264 }
265
266
267
268
269 public String getBaseUrl() {
270 return baseUrl;
271 }
272
273
274
275
276 public String getAdditionalUrlPathPropertyName() {
277 return additionalUrlPathPropertyName;
278 }
279
280
281
282
283 public String getHrefPropertyName() {
284 return hrefPropertyName;
285 }
286
287
288
289
290 public String getObjectIdPropertyName() {
291 return objectIdPropertyName;
292 }
293
294
295
296
297 public Map<String, String> getRequestParameterPropertyNames() {
298 return requestParameterPropertyNames;
299 }
300
301
302
303
304 public Map<String, String> getAdditionalRequestParameters() {
305 return additionalRequestParameters;
306 }
307 }
308 }