1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kns.util; |
17 | |
|
18 | |
import java.lang.reflect.InvocationTargetException; |
19 | |
import java.security.GeneralSecurityException; |
20 | |
import java.util.ArrayList; |
21 | |
import java.util.HashMap; |
22 | |
import java.util.Iterator; |
23 | |
import java.util.List; |
24 | |
import java.util.Map; |
25 | |
import java.util.Set; |
26 | |
|
27 | |
import org.apache.commons.beanutils.PropertyUtils; |
28 | |
import org.apache.commons.lang.StringUtils; |
29 | |
import org.kuali.rice.core.service.EncryptionService; |
30 | |
import org.kuali.rice.core.util.ClassLoaderUtils; |
31 | |
import org.kuali.rice.kew.util.KEWConstants; |
32 | |
import org.kuali.rice.kim.bo.Person; |
33 | |
import org.kuali.rice.kns.authorization.FieldRestriction; |
34 | |
import org.kuali.rice.kns.bo.BusinessObject; |
35 | |
import org.kuali.rice.kns.bo.BusinessObjectRelationship; |
36 | |
import org.kuali.rice.kns.bo.Inactivateable; |
37 | |
import org.kuali.rice.kns.bo.KualiCode; |
38 | |
import org.kuali.rice.kns.bo.PersistableBusinessObject; |
39 | |
import org.kuali.rice.kns.datadictionary.BusinessObjectEntry; |
40 | |
import org.kuali.rice.kns.datadictionary.FieldDefinition; |
41 | |
import org.kuali.rice.kns.datadictionary.MaintainableCollectionDefinition; |
42 | |
import org.kuali.rice.kns.datadictionary.control.ApcSelectControlDefinition; |
43 | |
import org.kuali.rice.kns.datadictionary.control.ButtonControlDefinition; |
44 | |
import org.kuali.rice.kns.datadictionary.control.ControlDefinition; |
45 | |
import org.kuali.rice.kns.datadictionary.control.CurrencyControlDefinition; |
46 | |
import org.kuali.rice.kns.datadictionary.control.KualiUserControlDefinition; |
47 | |
import org.kuali.rice.kns.datadictionary.control.LinkControlDefinition; |
48 | |
import org.kuali.rice.kns.datadictionary.mask.MaskFormatter; |
49 | |
import org.kuali.rice.kns.document.authorization.MaintenanceDocumentRestrictions; |
50 | |
import org.kuali.rice.kns.exception.UnknownBusinessClassAttributeException; |
51 | |
import org.kuali.rice.kns.inquiry.Inquirable; |
52 | |
import org.kuali.rice.kns.lookup.HtmlData; |
53 | |
import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData; |
54 | |
import org.kuali.rice.kns.lookup.LookupUtils; |
55 | |
import org.kuali.rice.kns.lookup.keyvalues.ApcValuesFinder; |
56 | |
import org.kuali.rice.kns.lookup.keyvalues.IndicatorValuesFinder; |
57 | |
import org.kuali.rice.kns.lookup.keyvalues.KeyValuesFinder; |
58 | |
import org.kuali.rice.kns.lookup.keyvalues.PersistableBusinessObjectValuesFinder; |
59 | |
import org.kuali.rice.kns.lookup.valueFinder.ValueFinder; |
60 | |
import org.kuali.rice.kns.service.BusinessObjectDictionaryService; |
61 | |
import org.kuali.rice.kns.service.BusinessObjectMetaDataService; |
62 | |
import org.kuali.rice.kns.service.DataDictionaryService; |
63 | |
import org.kuali.rice.kns.service.KNSServiceLocator; |
64 | |
import org.kuali.rice.kns.service.KualiModuleService; |
65 | |
import org.kuali.rice.kns.service.ModuleService; |
66 | |
import org.kuali.rice.kns.web.format.FormatException; |
67 | |
import org.kuali.rice.kns.web.format.Formatter; |
68 | |
import org.kuali.rice.kns.web.ui.Field; |
69 | |
import org.kuali.rice.kns.web.ui.PropertyRenderingConfigElement; |
70 | |
import org.kuali.rice.kns.web.ui.Row; |
71 | |
import org.kuali.rice.kns.web.ui.Section; |
72 | |
|
73 | |
|
74 | |
|
75 | |
|
76 | |
|
77 | 0 | public class FieldUtils { |
78 | 0 | private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(FieldUtils.class); |
79 | 0 | private static DataDictionaryService dataDictionaryService = null; |
80 | 0 | private static BusinessObjectMetaDataService businessObjectMetaDataService = null; |
81 | 0 | private static BusinessObjectDictionaryService businessObjectDictionaryService = null; |
82 | 0 | private static KualiModuleService kualiModuleService = null; |
83 | |
|
84 | |
public static void setInquiryURL(Field field, BusinessObject bo, String propertyName) { |
85 | 0 | HtmlData inquiryHref = new AnchorHtmlData(KNSConstants.EMPTY_STRING, KNSConstants.EMPTY_STRING); |
86 | |
|
87 | 0 | Boolean b = getBusinessObjectDictionaryService().noInquiryFieldInquiry(bo.getClass(), propertyName); |
88 | 0 | if (b == null || !b.booleanValue()) { |
89 | 0 | Class<Inquirable> inquirableClass = getBusinessObjectDictionaryService().getInquirableClass(bo.getClass()); |
90 | 0 | Boolean b2 = getBusinessObjectDictionaryService().forceLookupResultFieldInquiry(bo.getClass(), propertyName); |
91 | 0 | Inquirable inq = null; |
92 | |
try { |
93 | 0 | if ( inquirableClass != null ) { |
94 | 0 | inq = inquirableClass.newInstance(); |
95 | |
} else { |
96 | 0 | inq = KNSServiceLocator.getKualiInquirable(); |
97 | 0 | if ( LOG.isDebugEnabled() ) { |
98 | 0 | LOG.debug( "Default Inquirable Class: " + inq.getClass() ); |
99 | |
} |
100 | |
} |
101 | |
|
102 | 0 | inquiryHref = inq.getInquiryUrl(bo, propertyName, null == b2 ? false : b2.booleanValue() ); |
103 | |
|
104 | 0 | } catch ( Exception ex ) { |
105 | 0 | LOG.error("unable to create inquirable to get inquiry URL", ex ); |
106 | 0 | } |
107 | |
} |
108 | |
|
109 | 0 | field.setInquiryURL(inquiryHref); |
110 | 0 | } |
111 | |
|
112 | |
|
113 | |
|
114 | |
|
115 | |
|
116 | |
|
117 | |
|
118 | |
|
119 | |
|
120 | |
|
121 | |
|
122 | |
|
123 | |
|
124 | |
public static void setFieldControl(Class businessObjectClass, String attributeName, boolean convertForLookup, |
125 | |
Field field) { |
126 | 0 | ControlDefinition control = getDataDictionaryService().getAttributeControlDefinition(businessObjectClass, |
127 | |
attributeName); |
128 | 0 | String fieldType = Field.TEXT; |
129 | |
|
130 | 0 | if (control != null) { |
131 | 0 | if (control.isSelect()) { |
132 | 0 | if (control.getScript() != null && control.getScript().length() > 0) { |
133 | 0 | fieldType = Field.DROPDOWN_SCRIPT; |
134 | 0 | field.setScript(control.getScript()); |
135 | |
} else { |
136 | 0 | fieldType = Field.DROPDOWN; |
137 | |
} |
138 | |
} |
139 | |
|
140 | 0 | if (control.isMultiselect()) { |
141 | 0 | fieldType = Field.MULTISELECT; |
142 | |
} |
143 | |
|
144 | 0 | if (control.isApcSelect()) { |
145 | 0 | fieldType = Field.DROPDOWN_APC; |
146 | |
} |
147 | |
|
148 | 0 | if (control.isCheckbox()) { |
149 | 0 | fieldType = Field.CHECKBOX; |
150 | |
} |
151 | |
|
152 | 0 | if (control.isRadio()) { |
153 | 0 | fieldType = Field.RADIO; |
154 | |
} |
155 | |
|
156 | 0 | if (control.isHidden()) { |
157 | 0 | fieldType = Field.HIDDEN; |
158 | |
} |
159 | |
|
160 | 0 | if (control.isKualiUser()) { |
161 | 0 | fieldType = Field.KUALIUSER; |
162 | 0 | KualiUserControlDefinition kualiUserControl = (KualiUserControlDefinition) control; |
163 | 0 | field.setUniversalIdAttributeName(kualiUserControl.getUniversalIdAttributeName()); |
164 | 0 | field.setUserIdAttributeName(kualiUserControl.getUserIdAttributeName()); |
165 | 0 | field.setPersonNameAttributeName(kualiUserControl.getPersonNameAttributeName()); |
166 | |
} |
167 | |
|
168 | 0 | if (control.isWorkflowWorkgroup()) { |
169 | 0 | fieldType = Field.WORKFLOW_WORKGROUP; |
170 | |
} |
171 | |
|
172 | 0 | if (control.isFile()) { |
173 | 0 | fieldType = Field.FILE; |
174 | |
} |
175 | |
|
176 | 0 | if (control.isTextarea() && !convertForLookup) { |
177 | 0 | fieldType = Field.TEXT_AREA; |
178 | |
} |
179 | |
|
180 | 0 | if (control.isLookupHidden()) { |
181 | 0 | fieldType = Field.LOOKUP_HIDDEN; |
182 | |
} |
183 | |
|
184 | 0 | if (control.isLookupReadonly()) { |
185 | 0 | fieldType = Field.LOOKUP_READONLY; |
186 | |
} |
187 | |
|
188 | 0 | if (control.isCurrency()) { |
189 | 0 | fieldType = Field.CURRENCY; |
190 | |
} |
191 | |
|
192 | 0 | if (control.isButton()) { |
193 | 0 | fieldType = Field.BUTTON; |
194 | |
} |
195 | |
|
196 | 0 | if (control.isLink()) { |
197 | 0 | fieldType = Field.LINK; |
198 | |
} |
199 | |
|
200 | 0 | if (Field.CURRENCY.equals(fieldType) && control instanceof CurrencyControlDefinition) { |
201 | 0 | CurrencyControlDefinition currencyControl = (CurrencyControlDefinition) control; |
202 | 0 | field.setStyleClass("amount"); |
203 | 0 | field.setSize(currencyControl.getSize()); |
204 | 0 | field.setFormattedMaxLength(currencyControl.getFormattedMaxLength()); |
205 | |
} |
206 | |
|
207 | |
|
208 | 0 | if (Field.TEXT.equals(fieldType)) { |
209 | 0 | Integer size = control.getSize(); |
210 | 0 | if (size != null) { |
211 | 0 | field.setSize(size.intValue()); |
212 | |
} else { |
213 | 0 | field.setSize(30); |
214 | |
} |
215 | 0 | field.setDatePicker(control.isDatePicker()); |
216 | 0 | field.setRanged(control.isRanged()); |
217 | |
} |
218 | |
|
219 | 0 | if (Field.WORKFLOW_WORKGROUP.equals(fieldType)) { |
220 | 0 | Integer size = control.getSize(); |
221 | 0 | if (size != null) { |
222 | 0 | field.setSize(size.intValue()); |
223 | |
} else { |
224 | 0 | field.setSize(30); |
225 | |
} |
226 | |
} |
227 | |
|
228 | |
|
229 | 0 | if (Field.TEXT_AREA.equals(fieldType)) { |
230 | 0 | Integer rows = control.getRows(); |
231 | 0 | if (rows != null) { |
232 | 0 | field.setRows(rows.intValue()); |
233 | |
} else { |
234 | 0 | field.setRows(3); |
235 | |
} |
236 | |
|
237 | 0 | Integer cols = control.getCols(); |
238 | 0 | if (cols != null) { |
239 | 0 | field.setCols(cols.intValue()); |
240 | |
} else { |
241 | 0 | field.setCols(40); |
242 | |
} |
243 | 0 | field.setExpandedTextArea(control.isExpandedTextArea()); |
244 | |
} |
245 | |
|
246 | |
|
247 | 0 | if (Field.DROPDOWN.equals(fieldType) || Field.RADIO.equals(fieldType) |
248 | |
|| Field.DROPDOWN_SCRIPT.equals(fieldType) || Field.DROPDOWN_APC.equals(fieldType) |
249 | |
|| Field.MULTISELECT.equals(fieldType)) { |
250 | 0 | String keyFinderClassName = control.getValuesFinderClass(); |
251 | |
|
252 | 0 | if (StringUtils.isNotBlank(keyFinderClassName)) { |
253 | |
try { |
254 | 0 | Class keyFinderClass = ClassLoaderUtils.getClass(keyFinderClassName); |
255 | 0 | KeyValuesFinder finder = (KeyValuesFinder) keyFinderClass.newInstance(); |
256 | |
|
257 | 0 | if (finder != null) { |
258 | 0 | if (finder instanceof ApcValuesFinder && control instanceof ApcSelectControlDefinition) { |
259 | 0 | ((ApcValuesFinder) finder).setParameterNamespace(((ApcSelectControlDefinition) control) |
260 | |
.getParameterNamespace()); |
261 | 0 | ((ApcValuesFinder) finder) |
262 | |
.setParameterDetailType(((ApcSelectControlDefinition) control) |
263 | |
.getParameterDetailType()); |
264 | 0 | ((ApcValuesFinder) finder).setParameterName(((ApcSelectControlDefinition) control) |
265 | |
.getParameterName()); |
266 | 0 | } else if (finder instanceof PersistableBusinessObjectValuesFinder) { |
267 | 0 | ((PersistableBusinessObjectValuesFinder) finder) |
268 | |
.setBusinessObjectClass(ClassLoaderUtils.getClass(control |
269 | |
.getBusinessObjectClass())); |
270 | 0 | ((PersistableBusinessObjectValuesFinder) finder).setKeyAttributeName(control |
271 | |
.getKeyAttribute()); |
272 | 0 | ((PersistableBusinessObjectValuesFinder) finder).setLabelAttributeName(control |
273 | |
.getLabelAttribute()); |
274 | 0 | if (control.getIncludeBlankRow() != null) { |
275 | 0 | ((PersistableBusinessObjectValuesFinder) finder).setIncludeBlankRow(control |
276 | |
.getIncludeBlankRow()); |
277 | |
} |
278 | 0 | ((PersistableBusinessObjectValuesFinder) finder).setIncludeKeyInDescription(control |
279 | |
.getIncludeKeyInLabel()); |
280 | |
} |
281 | 0 | field.setFieldValidValues(finder.getKeyValues()); |
282 | 0 | field.setFieldInactiveValidValues(finder.getKeyValues(false)); |
283 | |
} |
284 | 0 | } catch (InstantiationException e) { |
285 | 0 | LOG.error("Unable to get new instance of finder class: " + keyFinderClassName); |
286 | 0 | throw new RuntimeException("Unable to get new instance of finder class: " + keyFinderClassName); |
287 | 0 | } catch (IllegalAccessException e) { |
288 | 0 | LOG.error("Unable to get new instance of finder class: " + keyFinderClassName); |
289 | 0 | throw new RuntimeException("Unable to get new instance of finder class: " + keyFinderClassName); |
290 | 0 | } |
291 | |
} |
292 | |
} |
293 | |
|
294 | 0 | if (Field.CHECKBOX.equals(fieldType) && convertForLookup) { |
295 | 0 | fieldType = Field.RADIO; |
296 | 0 | field.setFieldValidValues(IndicatorValuesFinder.INSTANCE.getKeyValues()); |
297 | |
} |
298 | |
|
299 | |
|
300 | 0 | if (Field.BUTTON.equals(fieldType)) { |
301 | 0 | ButtonControlDefinition buttonControl = (ButtonControlDefinition) control; |
302 | 0 | field.setImageSrc(buttonControl.getImageSrc()); |
303 | 0 | field.setStyleClass(buttonControl.getStyleClass()); |
304 | |
} |
305 | |
|
306 | |
|
307 | 0 | if (Field.LINK.equals(fieldType)) { |
308 | 0 | LinkControlDefinition linkControl = (LinkControlDefinition) control; |
309 | 0 | field.setStyleClass(linkControl.getStyleClass()); |
310 | 0 | field.setTarget(linkControl.getTarget()); |
311 | 0 | field.setHrefText(linkControl.getHrefText()); |
312 | |
} |
313 | |
|
314 | |
} |
315 | |
|
316 | 0 | field.setFieldType(fieldType); |
317 | 0 | } |
318 | |
|
319 | |
|
320 | |
|
321 | |
|
322 | |
|
323 | |
|
324 | |
|
325 | |
|
326 | |
|
327 | |
|
328 | |
public static Field getPropertyField(Class businessObjectClass, String attributeName, boolean convertForLookup) { |
329 | 0 | Field field = new Field(); |
330 | 0 | field.setPropertyName(attributeName); |
331 | 0 | field.setFieldLabel(getDataDictionaryService().getAttributeLabel(businessObjectClass, attributeName)); |
332 | |
|
333 | 0 | setFieldControl(businessObjectClass, attributeName, convertForLookup, field); |
334 | |
|
335 | 0 | Boolean fieldRequired = getBusinessObjectDictionaryService().getLookupAttributeRequired(businessObjectClass, attributeName); |
336 | 0 | if (fieldRequired != null) { |
337 | 0 | field.setFieldRequired(fieldRequired.booleanValue()); |
338 | |
} |
339 | |
|
340 | 0 | Integer maxLength = getDataDictionaryService().getAttributeMaxLength(businessObjectClass, attributeName); |
341 | 0 | if (maxLength != null) { |
342 | 0 | field.setMaxLength(maxLength.intValue()); |
343 | |
} |
344 | |
|
345 | 0 | Boolean upperCase = null; |
346 | |
try { |
347 | 0 | upperCase = getDataDictionaryService().getAttributeForceUppercase(businessObjectClass, attributeName); |
348 | |
} |
349 | 0 | catch (UnknownBusinessClassAttributeException t) { |
350 | |
|
351 | 0 | LOG.warn( "UnknownBusinessClassAttributeException in fieldUtils.getPropertyField() : " + t.getMessage() ); |
352 | 0 | } |
353 | 0 | if (upperCase != null) { |
354 | 0 | field.setUpperCase(upperCase.booleanValue()); |
355 | |
} |
356 | |
|
357 | 0 | if (!businessObjectClass.isInterface()) { |
358 | |
try { |
359 | 0 | field.setFormatter(ObjectUtils.getFormatterWithDataDictionary(businessObjectClass.newInstance(), |
360 | |
attributeName)); |
361 | 0 | } catch (InstantiationException e) { |
362 | 0 | LOG.info("Unable to get new instance of business object class: " + businessObjectClass.getName(), e); |
363 | |
|
364 | 0 | } catch (IllegalAccessException e) { |
365 | 0 | LOG.info("Unable to get new instance of business object class: " + businessObjectClass.getName(), e); |
366 | |
|
367 | 0 | } |
368 | |
} |
369 | |
|
370 | |
|
371 | 0 | field.setBusinessObjectClassName(businessObjectClass.getName()); |
372 | 0 | field.setFieldHelpName(attributeName); |
373 | 0 | field.setFieldHelpSummary(getDataDictionaryService().getAttributeSummary(businessObjectClass, attributeName)); |
374 | |
|
375 | 0 | return field; |
376 | |
} |
377 | |
|
378 | |
|
379 | |
|
380 | |
|
381 | |
|
382 | |
|
383 | |
|
384 | |
|
385 | |
|
386 | |
|
387 | |
|
388 | |
|
389 | |
|
390 | |
public static void setAdditionalDisplayPropertyForCodes(Class businessObjectClass, String attributeName, PropertyRenderingConfigElement field) { |
391 | |
try { |
392 | 0 | BusinessObjectRelationship relationship = getBusinessObjectMetaDataService().getBusinessObjectRelationship( |
393 | |
(BusinessObject) businessObjectClass.newInstance(), attributeName); |
394 | |
|
395 | 0 | if (relationship != null && attributeName.startsWith(relationship.getParentAttributeName()) |
396 | |
&& KualiCode.class.isAssignableFrom(relationship.getRelatedClass())) { |
397 | 0 | field.setAdditionalDisplayPropertyName(relationship.getParentAttributeName() + "." |
398 | |
+ KNSPropertyConstants.NAME); |
399 | |
} |
400 | 0 | } catch (Exception e) { |
401 | 0 | throw new RuntimeException("Cannot get new instance of class to check for KualiCode references: " |
402 | |
+ e.getMessage()); |
403 | 0 | } |
404 | 0 | } |
405 | |
|
406 | |
|
407 | |
|
408 | |
|
409 | |
|
410 | |
|
411 | |
|
412 | |
|
413 | |
public static List wrapFields(List fields) { |
414 | 0 | return wrapFields(fields, KNSConstants.DEFAULT_NUM_OF_COLUMNS); |
415 | |
} |
416 | |
|
417 | |
|
418 | |
|
419 | |
|
420 | |
|
421 | |
|
422 | |
|
423 | |
|
424 | |
public static List<Row> wrapFields(List<Field> fields, int numberOfColumns) { |
425 | |
|
426 | 0 | List<Row> rows = new ArrayList(); |
427 | 0 | List<Field> fieldOnlyList = new ArrayList(); |
428 | |
|
429 | 0 | List<Field> visableFields = getVisibleFields(fields); |
430 | 0 | List<Field> nonVisableFields = getNonVisibleFields(fields); |
431 | |
|
432 | 0 | int fieldsPosition = 0; |
433 | 0 | for (Field element : visableFields) { |
434 | 0 | if (Field.SUB_SECTION_SEPARATOR.equals(element.getFieldType()) || Field.CONTAINER.equals(element.getFieldType())) { |
435 | 0 | fieldsPosition = createBlankSpace(fieldOnlyList, rows, numberOfColumns, fieldsPosition); |
436 | 0 | List fieldList = new ArrayList(); |
437 | 0 | fieldList.add(element); |
438 | 0 | rows.add(new Row(fieldList)); |
439 | 0 | } |
440 | |
else { |
441 | 0 | if (fieldsPosition < numberOfColumns) { |
442 | 0 | fieldOnlyList.add(element); |
443 | 0 | fieldsPosition++; |
444 | |
} |
445 | |
else { |
446 | 0 | rows.add(new Row(new ArrayList(fieldOnlyList))); |
447 | 0 | fieldOnlyList.clear(); |
448 | 0 | fieldOnlyList.add(element); |
449 | 0 | fieldsPosition = 1; |
450 | |
} |
451 | |
} |
452 | |
} |
453 | 0 | createBlankSpace(fieldOnlyList, rows, numberOfColumns, fieldsPosition); |
454 | |
|
455 | |
|
456 | 0 | if(nonVisableFields != null && !nonVisableFields.isEmpty()){ |
457 | 0 | Row nonVisRow = new Row(); |
458 | 0 | nonVisRow.setFields(nonVisableFields); |
459 | 0 | rows.add(nonVisRow); |
460 | |
} |
461 | |
|
462 | |
|
463 | 0 | return rows; |
464 | |
} |
465 | |
|
466 | |
private static List<Field> getVisibleFields(List<Field> fields){ |
467 | 0 | List<Field> rList = new ArrayList<Field>(); |
468 | |
|
469 | 0 | for(Field f: fields){ |
470 | 0 | if(!Field.HIDDEN.equals(f.getFieldType()) && !Field.BLANK_SPACE.equals(f.getFieldType())){ |
471 | 0 | rList.add(f); |
472 | |
} |
473 | |
} |
474 | |
|
475 | 0 | return rList; |
476 | |
} |
477 | |
|
478 | |
private static List<Field> getNonVisibleFields(List<Field> fields){ |
479 | 0 | List<Field> rList = new ArrayList<Field>(); |
480 | |
|
481 | 0 | for(Field f: fields){ |
482 | 0 | if(Field.HIDDEN.equals(f.getFieldType()) || Field.BLANK_SPACE.equals(f.getFieldType())){ |
483 | 0 | rList.add(f); |
484 | |
} |
485 | |
} |
486 | |
|
487 | 0 | return rList; |
488 | |
} |
489 | |
|
490 | |
|
491 | |
|
492 | |
|
493 | |
|
494 | |
|
495 | |
|
496 | |
|
497 | |
|
498 | |
private static int createBlankSpace(List<Field> fieldOnlyList, List<Row> rows, int numberOfColumns, int fieldsPosition) { |
499 | 0 | int fieldOnlySize = fieldOnlyList.size(); |
500 | 0 | if (fieldOnlySize > 0) { |
501 | 0 | for (int i = 0; i < (numberOfColumns - fieldOnlySize); i++) { |
502 | 0 | Field empty = new Field(); |
503 | 0 | empty.setFieldType(Field.BLANK_SPACE); |
504 | |
|
505 | 0 | empty.setPropertyName(Field.BLANK_SPACE); |
506 | 0 | fieldOnlyList.add(empty); |
507 | |
} |
508 | 0 | rows.add(new Row(new ArrayList(fieldOnlyList))); |
509 | 0 | fieldOnlyList.clear(); |
510 | 0 | fieldsPosition = 0; |
511 | |
} |
512 | 0 | return fieldsPosition; |
513 | |
} |
514 | |
|
515 | |
|
516 | |
|
517 | |
|
518 | |
|
519 | |
|
520 | |
|
521 | |
|
522 | |
|
523 | |
public static Field constructContainerField(String name, String label, List fields) { |
524 | 0 | return constructContainerField(name, label, fields, KNSConstants.DEFAULT_NUM_OF_COLUMNS); |
525 | |
} |
526 | |
|
527 | |
|
528 | |
|
529 | |
|
530 | |
|
531 | |
|
532 | |
|
533 | |
|
534 | |
|
535 | |
|
536 | |
public static Field constructContainerField(String name, String label, List fields, int numberOfColumns) { |
537 | 0 | Field containerField = new Field(); |
538 | 0 | containerField.setPropertyName(name); |
539 | 0 | containerField.setFieldLabel(label); |
540 | 0 | containerField.setFieldType(Field.CONTAINER); |
541 | 0 | containerField.setNumberOfColumnsForCollection(numberOfColumns); |
542 | |
|
543 | 0 | List rows = wrapFields(fields, numberOfColumns); |
544 | 0 | containerField.setContainerRows(rows); |
545 | |
|
546 | 0 | return containerField; |
547 | |
} |
548 | |
|
549 | |
|
550 | |
|
551 | |
|
552 | |
|
553 | |
|
554 | |
|
555 | |
|
556 | |
|
557 | |
public static List<Field> populateFieldsFromBusinessObject(List<Field> fields, BusinessObject bo) { |
558 | 0 | List<Field> populatedFields = new ArrayList<Field>(); |
559 | |
|
560 | 0 | if (bo instanceof PersistableBusinessObject) { |
561 | 0 | ((PersistableBusinessObject) bo).refreshNonUpdateableReferences(); |
562 | |
} |
563 | |
|
564 | 0 | for (Iterator<Field> iter = fields.iterator(); iter.hasNext();) { |
565 | 0 | Field element = iter.next(); |
566 | 0 | if (element.containsBOData()) { |
567 | 0 | String propertyName = element.getPropertyName(); |
568 | |
|
569 | |
|
570 | |
|
571 | |
|
572 | 0 | if (isPropertyNested(propertyName) && !isObjectTreeNonNullAllTheWayDown(bo, propertyName) && ((!element.getFieldType().equals(Field.IMAGE_SUBMIT)) && !(element.getFieldType().equals(Field.CONTAINER)) && (!element.getFieldType().equals(Field.QUICKFINDER)))) { |
573 | 0 | element.setPropertyValue(null); |
574 | |
} |
575 | 0 | else if (PropertyUtils.isReadable(bo, propertyName)) { |
576 | 0 | populateReadableField(element, bo); |
577 | |
} |
578 | |
|
579 | 0 | if (StringUtils.isNotBlank(element.getAlternateDisplayPropertyName())) { |
580 | 0 | String alternatePropertyValue = ObjectUtils.getFormattedPropertyValueUsingDataDictionary(bo, element |
581 | |
.getAlternateDisplayPropertyName()); |
582 | 0 | element.setAlternateDisplayPropertyValue(alternatePropertyValue); |
583 | |
} |
584 | |
|
585 | 0 | if (StringUtils.isNotBlank(element.getAdditionalDisplayPropertyName())) { |
586 | 0 | String additionalPropertyValue = ObjectUtils.getFormattedPropertyValueUsingDataDictionary(bo, element |
587 | |
.getAdditionalDisplayPropertyName()); |
588 | 0 | element.setAdditionalDisplayPropertyValue(additionalPropertyValue); |
589 | |
} |
590 | |
} |
591 | 0 | populatedFields.add(element); |
592 | 0 | } |
593 | |
|
594 | 0 | return populatedFields; |
595 | |
} |
596 | |
|
597 | |
public static void populateReadableField(Field field, BusinessObject businessObject){ |
598 | 0 | Object obj = ObjectUtils.getNestedValue(businessObject, field.getPropertyName()); |
599 | 0 | if (obj != null) { |
600 | 0 | String formattedValue = ObjectUtils.getFormattedPropertyValueUsingDataDictionary(businessObject, field.getPropertyName()); |
601 | 0 | field.setPropertyValue(formattedValue); |
602 | |
|
603 | |
|
604 | 0 | if ( field.getFieldType().equals(Field.KUALIUSER) ) { |
605 | |
|
606 | |
try { |
607 | 0 | if ( StringUtils.isNotBlank(field.getUniversalIdAttributeName()) ) { |
608 | 0 | Object principalId = ObjectUtils.getNestedValue(businessObject, field.getUniversalIdAttributeName()); |
609 | 0 | if ( principalId != null ) { |
610 | 0 | field.setUniversalIdValue(principalId.toString()); |
611 | |
} |
612 | |
} |
613 | 0 | if ( StringUtils.isNotBlank(field.getPersonNameAttributeName()) ) { |
614 | 0 | Object personName = ObjectUtils.getNestedValue(businessObject, field.getPersonNameAttributeName()); |
615 | 0 | if ( personName != null ) { |
616 | 0 | field.setPersonNameValue( personName.toString() ); |
617 | |
} |
618 | |
} |
619 | 0 | } catch ( Exception ex ) { |
620 | 0 | LOG.warn( "Unable to get principal ID or person name property in FieldBridge.", ex ); |
621 | 0 | } |
622 | |
} |
623 | |
} |
624 | |
|
625 | 0 | populateSecureField(field, obj); |
626 | 0 | } |
627 | |
|
628 | |
public static void populateSecureField(Field field, Object fieldValue){ |
629 | |
|
630 | |
|
631 | 0 | if (field.isSecure()) { |
632 | |
try { |
633 | 0 | if (fieldValue != null && fieldValue.toString().endsWith(EncryptionService.HASH_POST_PREFIX)) { |
634 | 0 | field.setEncryptedValue(fieldValue.toString()); |
635 | |
} |
636 | |
else { |
637 | 0 | field.setEncryptedValue(KNSServiceLocator.getEncryptionService().encrypt(fieldValue) + EncryptionService.ENCRYPTION_POST_PREFIX); |
638 | |
} |
639 | |
} |
640 | 0 | catch (GeneralSecurityException e) { |
641 | 0 | throw new RuntimeException("Unable to encrypt secure field " + e.getMessage()); |
642 | 0 | } |
643 | |
|
644 | |
} |
645 | 0 | } |
646 | |
|
647 | |
|
648 | |
|
649 | |
|
650 | |
|
651 | |
|
652 | |
|
653 | |
static private boolean isPropertyNested(String propertyName) { |
654 | 0 | return -1 != propertyName.indexOf('.'); |
655 | |
} |
656 | |
|
657 | |
|
658 | |
|
659 | |
|
660 | |
|
661 | |
|
662 | |
|
663 | |
|
664 | |
|
665 | |
static private boolean isObjectTreeNonNullAllTheWayDown(BusinessObject bo, String propertyName) { |
666 | 0 | String[] propertyParts = propertyName.split("\\."); |
667 | |
|
668 | 0 | StringBuffer property = new StringBuffer(); |
669 | 0 | for (int i = 0; i < propertyParts.length - 1; i++) { |
670 | |
|
671 | 0 | property.append((0 == property.length()) ? "" : ".").append(propertyParts[i]); |
672 | |
try { |
673 | 0 | if (null == PropertyUtils.getNestedProperty(bo, property.toString())) { |
674 | 0 | return false; |
675 | |
} |
676 | |
} |
677 | 0 | catch (Throwable t) { |
678 | 0 | LOG.debug("Either getter or setter not specified for property \"" + property.toString() + "\"", t); |
679 | 0 | return false; |
680 | 0 | } |
681 | |
} |
682 | |
|
683 | 0 | return true; |
684 | |
|
685 | |
} |
686 | |
|
687 | |
|
688 | |
|
689 | |
|
690 | |
|
691 | |
|
692 | |
private static boolean containsIntermediateNull(Object bo, String propertyName) { |
693 | 0 | boolean containsNull = false; |
694 | |
|
695 | 0 | if (StringUtils.contains(propertyName, ".")) { |
696 | 0 | String prefix = StringUtils.substringBefore(propertyName, "."); |
697 | 0 | Object propertyValue = ObjectUtils.getPropertyValue(bo, prefix); |
698 | |
|
699 | 0 | if (propertyValue == null) { |
700 | 0 | containsNull = true; |
701 | |
} |
702 | |
else { |
703 | 0 | String suffix = StringUtils.substringAfter(propertyName, "."); |
704 | 0 | containsNull = containsIntermediateNull(propertyValue, suffix); |
705 | |
} |
706 | |
} |
707 | |
|
708 | 0 | return containsNull; |
709 | |
} |
710 | |
|
711 | |
|
712 | |
|
713 | |
|
714 | |
|
715 | |
|
716 | |
|
717 | |
|
718 | |
|
719 | |
public static Map populateBusinessObjectFromMap(BusinessObject bo, Map fieldValues) { |
720 | 0 | return populateBusinessObjectFromMap(bo, fieldValues, ""); |
721 | |
} |
722 | |
|
723 | |
|
724 | |
|
725 | |
|
726 | |
|
727 | |
|
728 | |
|
729 | |
|
730 | |
|
731 | |
|
732 | |
public static Map populateBusinessObjectFromMap(BusinessObject bo, Map<String, ?> fieldValues, String propertyNamePrefix) { |
733 | 0 | Map cachedValues = new HashMap(); |
734 | 0 | MessageMap errorMap = GlobalVariables.getMessageMap(); |
735 | |
|
736 | |
try { |
737 | 0 | for (Iterator<String> iter = fieldValues.keySet().iterator(); iter.hasNext();) { |
738 | 0 | String propertyName = iter.next(); |
739 | |
|
740 | 0 | if (propertyName.endsWith(KNSConstants.CHECKBOX_PRESENT_ON_FORM_ANNOTATION)) { |
741 | |
|
742 | |
|
743 | 0 | if (StringUtils.isNotBlank((String) fieldValues.get(propertyName))) { |
744 | 0 | String checkboxName = StringUtils.removeEnd(propertyName, KNSConstants.CHECKBOX_PRESENT_ON_FORM_ANNOTATION); |
745 | 0 | String checkboxValue = (String) fieldValues.get(checkboxName); |
746 | 0 | if (checkboxValue == null) { |
747 | |
|
748 | 0 | if (PropertyUtils.isWriteable(bo, checkboxName)) { |
749 | 0 | Class type = ObjectUtils.easyGetPropertyType(bo, checkboxName); |
750 | 0 | if (type == Boolean.TYPE || type == Boolean.class) { |
751 | |
|
752 | 0 | ObjectUtils.setObjectProperty(bo, checkboxName, type, "false"); |
753 | |
} |
754 | |
} |
755 | |
} |
756 | 0 | } |
757 | |
|
758 | |
|
759 | |
} |
760 | 0 | else if (PropertyUtils.isWriteable(bo, propertyName) && fieldValues.get(propertyName) != null ) { |
761 | |
|
762 | 0 | Class type = ObjectUtils.easyGetPropertyType(bo, propertyName); |
763 | |
try { |
764 | 0 | Object fieldValue = fieldValues.get(propertyName); |
765 | 0 | ObjectUtils.setObjectProperty(bo, propertyName, type, fieldValue); |
766 | 0 | cachedValues.put(propertyNamePrefix + propertyName, fieldValues.get(propertyName)); |
767 | |
} |
768 | 0 | catch (FormatException e) { |
769 | 0 | cachedValues.put(propertyNamePrefix + propertyName, fieldValues.get(propertyName)); |
770 | 0 | errorMap.putError(propertyNamePrefix + propertyName, e.getErrorKey(), e.getErrorArgs()); |
771 | 0 | } |
772 | |
} |
773 | 0 | } |
774 | |
} |
775 | 0 | catch (IllegalAccessException e) { |
776 | 0 | LOG.error("unable to populate business object" + e.getMessage()); |
777 | 0 | throw new RuntimeException(e.getMessage(), e); |
778 | |
} |
779 | 0 | catch (InvocationTargetException e) { |
780 | 0 | LOG.error("unable to populate business object" + e.getMessage()); |
781 | 0 | throw new RuntimeException(e.getMessage(), e); |
782 | |
} |
783 | 0 | catch (NoSuchMethodException e) { |
784 | 0 | LOG.error("unable to populate business object" + e.getMessage()); |
785 | 0 | throw new RuntimeException(e.getMessage(), e); |
786 | 0 | } |
787 | |
|
788 | 0 | return cachedValues; |
789 | |
} |
790 | |
|
791 | |
|
792 | |
|
793 | |
|
794 | |
|
795 | |
|
796 | |
|
797 | |
|
798 | |
|
799 | |
|
800 | |
|
801 | |
public static Field fixFieldForForm(Field field, List keyFieldNames, String namePrefix, String maintenanceAction, boolean readOnly, MaintenanceDocumentRestrictions auths, String documentStatus, String documentInitiatorPrincipalId) { |
802 | 0 | String propertyName = field.getPropertyName(); |
803 | |
|
804 | 0 | if (field.containsBOData()) { |
805 | |
|
806 | |
|
807 | 0 | if (!propertyName.startsWith(KNSConstants.DISPATCH_REQUEST_PARAMETER)) { |
808 | |
|
809 | 0 | if (field.getPropertyPrefix() == null || field.getPropertyPrefix().equals("")) { |
810 | 0 | field.setPropertyName(namePrefix + propertyName); |
811 | |
} |
812 | |
else { |
813 | 0 | field.setPropertyName(field.getPropertyPrefix() + "." + propertyName); |
814 | |
} |
815 | |
} |
816 | |
|
817 | 0 | if (readOnly) { |
818 | 0 | field.setReadOnly(true); |
819 | |
} |
820 | |
|
821 | |
|
822 | 0 | if ( KNSConstants.MAINTENANCE_EDIT_ACTION.equals(maintenanceAction) ) { |
823 | 0 | if (keyFieldNames.contains(propertyName) ) { |
824 | 0 | field.setReadOnly(true); |
825 | 0 | field.setKeyField(true); |
826 | 0 | } else if ( StringUtils.isNotBlank( field.getUniversalIdAttributeName() ) |
827 | |
&& keyFieldNames.contains(field.getUniversalIdAttributeName() ) ) { |
828 | |
|
829 | |
|
830 | 0 | field.setReadOnly(true); |
831 | 0 | field.setKeyField(true); |
832 | |
} |
833 | |
} |
834 | |
|
835 | |
|
836 | 0 | applyAuthorization(field, maintenanceAction, auths, documentStatus, documentInitiatorPrincipalId); |
837 | |
|
838 | |
|
839 | 0 | if (StringUtils.isNotBlank(field.getFieldConversions())) { |
840 | 0 | String fieldConversions = field.getFieldConversions(); |
841 | 0 | String newFieldConversions = KNSConstants.EMPTY_STRING; |
842 | 0 | String[] conversions = StringUtils.split(fieldConversions, KNSConstants.FIELD_CONVERSIONS_SEPARATOR); |
843 | |
|
844 | 0 | for (int l = 0; l < conversions.length; l++) { |
845 | 0 | String conversion = conversions[l]; |
846 | |
|
847 | 0 | String[] conversionPair = StringUtils.split(conversion, KNSConstants.FIELD_CONVERSION_PAIR_SEPARATOR, 2); |
848 | 0 | String conversionFrom = conversionPair[0]; |
849 | 0 | String conversionTo = conversionPair[1]; |
850 | 0 | conversionTo = KNSConstants.MAINTENANCE_NEW_MAINTAINABLE + conversionTo; |
851 | 0 | newFieldConversions += (conversionFrom + KNSConstants.FIELD_CONVERSION_PAIR_SEPARATOR + conversionTo); |
852 | |
|
853 | 0 | if (l < conversions.length) { |
854 | 0 | newFieldConversions += KNSConstants.FIELD_CONVERSIONS_SEPARATOR; |
855 | |
} |
856 | |
} |
857 | |
|
858 | 0 | field.setFieldConversions(newFieldConversions); |
859 | |
} |
860 | |
|
861 | |
|
862 | 0 | if (StringUtils.isNotBlank(field.getInquiryParameters())) { |
863 | 0 | String inquiryParameters = field.getInquiryParameters(); |
864 | 0 | StringBuilder newInquiryParameters = new StringBuilder(); |
865 | 0 | String[] parameters = StringUtils.split(inquiryParameters, KNSConstants.FIELD_CONVERSIONS_SEPARATOR); |
866 | |
|
867 | 0 | for (int l = 0; l < parameters.length; l++) { |
868 | 0 | String parameter = parameters[l]; |
869 | |
|
870 | 0 | String[] parameterPair = StringUtils.split(parameter, KNSConstants.FIELD_CONVERSION_PAIR_SEPARATOR, 2); |
871 | 0 | String conversionFrom = parameterPair[0]; |
872 | 0 | String conversionTo = parameterPair[1]; |
873 | |
|
874 | |
|
875 | 0 | newInquiryParameters.append(KNSConstants.MAINTENANCE_NEW_MAINTAINABLE).append(conversionFrom); |
876 | |
|
877 | 0 | newInquiryParameters.append(KNSConstants.FIELD_CONVERSION_PAIR_SEPARATOR).append(conversionTo); |
878 | |
|
879 | 0 | if (l < parameters.length - 1) { |
880 | 0 | newInquiryParameters.append(KNSConstants.FIELD_CONVERSIONS_SEPARATOR); |
881 | |
} |
882 | |
} |
883 | |
|
884 | 0 | field.setInquiryParameters(newInquiryParameters.toString()); |
885 | |
} |
886 | |
|
887 | 0 | if (Field.KUALIUSER.equals(field.getFieldType())) { |
888 | |
|
889 | 0 | int suffixIndex = field.getPropertyName().indexOf( field.getUserIdAttributeName() ); |
890 | 0 | if ( suffixIndex != -1 ) { |
891 | 0 | field.setPersonNameAttributeName( field.getPropertyName().substring( 0, suffixIndex ) + field.getPersonNameAttributeName() ); |
892 | 0 | field.setUniversalIdAttributeName( field.getPropertyName().substring( 0, suffixIndex ) + field.getUniversalIdAttributeName() ); |
893 | |
} else { |
894 | 0 | field.setPersonNameAttributeName(namePrefix + field.getPersonNameAttributeName()); |
895 | 0 | field.setUniversalIdAttributeName(namePrefix + field.getUniversalIdAttributeName()); |
896 | |
} |
897 | |
|
898 | |
|
899 | |
} |
900 | |
|
901 | |
|
902 | 0 | if (StringUtils.isNotBlank(field.getLookupParameters())) { |
903 | 0 | String lookupParameters = field.getLookupParameters(); |
904 | 0 | String newLookupParameters = KNSConstants.EMPTY_STRING; |
905 | 0 | String[] conversions = StringUtils.split(lookupParameters, KNSConstants.FIELD_CONVERSIONS_SEPARATOR); |
906 | |
|
907 | 0 | for (int m = 0; m < conversions.length; m++) { |
908 | 0 | String conversion = conversions[m]; |
909 | |
|
910 | 0 | String[] conversionPair = StringUtils.split(conversion, KNSConstants.FIELD_CONVERSION_PAIR_SEPARATOR, 2); |
911 | 0 | String conversionFrom = conversionPair[0]; |
912 | 0 | String conversionTo = conversionPair[1]; |
913 | 0 | conversionFrom = KNSConstants.MAINTENANCE_NEW_MAINTAINABLE + conversionFrom; |
914 | 0 | newLookupParameters += (conversionFrom + KNSConstants.FIELD_CONVERSION_PAIR_SEPARATOR + conversionTo); |
915 | |
|
916 | 0 | if (m < conversions.length) { |
917 | 0 | newLookupParameters += KNSConstants.FIELD_CONVERSIONS_SEPARATOR; |
918 | |
} |
919 | |
} |
920 | |
|
921 | 0 | field.setLookupParameters(newLookupParameters); |
922 | |
} |
923 | |
|
924 | |
|
925 | 0 | if (Field.CONTAINER.equals(field.getFieldType())) { |
926 | 0 | List containerRows = field.getContainerRows(); |
927 | 0 | List fixedRows = new ArrayList(); |
928 | |
|
929 | 0 | for (Iterator iter = containerRows.iterator(); iter.hasNext();) { |
930 | 0 | Row containerRow = (Row) iter.next(); |
931 | 0 | List containerFields = containerRow.getFields(); |
932 | 0 | List fixedFields = new ArrayList(); |
933 | |
|
934 | 0 | for (Iterator iterator = containerFields.iterator(); iterator.hasNext();) { |
935 | 0 | Field containerField = (Field) iterator.next(); |
936 | 0 | containerField = fixFieldForForm(containerField, keyFieldNames, namePrefix, maintenanceAction, readOnly, auths, documentStatus, documentInitiatorPrincipalId); |
937 | 0 | fixedFields.add(containerField); |
938 | 0 | } |
939 | |
|
940 | 0 | fixedRows.add(new Row(fixedFields)); |
941 | 0 | } |
942 | |
|
943 | 0 | field.setContainerRows(fixedRows); |
944 | |
} |
945 | |
} |
946 | 0 | return field; |
947 | |
} |
948 | |
|
949 | |
public static void applyAuthorization(Field field, String maintenanceAction, MaintenanceDocumentRestrictions auths, String documentStatus, String documentInitiatorPrincipalId) { |
950 | 0 | String fieldName = ""; |
951 | 0 | FieldRestriction fieldAuth = null; |
952 | 0 | Person user = GlobalVariables.getUserSession().getPerson(); |
953 | |
|
954 | 0 | if (field.getPropertyName().startsWith(KNSConstants.MAINTENANCE_NEW_MAINTAINABLE)) { |
955 | |
|
956 | 0 | fieldName = field.getPropertyName().substring(KNSConstants.MAINTENANCE_NEW_MAINTAINABLE.length()); |
957 | |
|
958 | |
|
959 | 0 | if (auths.hasRestriction(fieldName)) { |
960 | 0 | fieldAuth = auths.getFieldRestriction(fieldName); |
961 | 0 | if(KNSConstants.MAINTENANCE_NEW_ACTION.equals(maintenanceAction) || KNSConstants.MAINTENANCE_COPY_ACTION.equals(maintenanceAction)){ |
962 | 0 | if((KEWConstants.ROUTE_HEADER_SAVED_CD.equals(documentStatus) || KEWConstants.ROUTE_HEADER_INITIATED_CD.equals(documentStatus)) |
963 | |
&& user.getPrincipalId().equals(documentInitiatorPrincipalId)){ |
964 | |
|
965 | |
|
966 | |
}else{ |
967 | 0 | if(fieldAuth.isPartiallyMasked()){ |
968 | 0 | field.setSecure(true); |
969 | 0 | fieldAuth.setShouldBeEncrypted(true); |
970 | 0 | MaskFormatter maskFormatter = fieldAuth.getMaskFormatter(); |
971 | 0 | String displayMaskValue = maskFormatter.maskValue(field.getPropertyValue()); |
972 | 0 | field.setDisplayMaskValue(displayMaskValue); |
973 | 0 | populateSecureField(field, field.getPropertyValue()); |
974 | 0 | } |
975 | 0 | else if(fieldAuth.isMasked()){ |
976 | 0 | field.setSecure(true); |
977 | 0 | fieldAuth.setShouldBeEncrypted(true); |
978 | 0 | MaskFormatter maskFormatter = fieldAuth.getMaskFormatter(); |
979 | 0 | String displayMaskValue = maskFormatter.maskValue(field.getPropertyValue()); |
980 | 0 | field.setDisplayMaskValue(displayMaskValue); |
981 | 0 | populateSecureField(field, field.getPropertyValue()); |
982 | |
} |
983 | |
} |
984 | |
} |
985 | |
|
986 | 0 | if (KNSConstants.MAINTENANCE_EDIT_ACTION.equals(maintenanceAction) || KNSConstants.MAINTENANCE_NEWWITHEXISTING_ACTION.equals(maintenanceAction)) { |
987 | |
|
988 | 0 | if(fieldAuth.isPartiallyMasked()){ |
989 | 0 | field.setSecure(true); |
990 | 0 | fieldAuth.setShouldBeEncrypted(true); |
991 | 0 | MaskFormatter maskFormatter = fieldAuth.getMaskFormatter(); |
992 | 0 | String displayMaskValue = maskFormatter.maskValue(field.getPropertyValue()); |
993 | 0 | field.setDisplayMaskValue(displayMaskValue); |
994 | 0 | populateSecureField(field, field.getPropertyValue()); |
995 | 0 | } |
996 | 0 | else if(fieldAuth.isMasked()){ |
997 | 0 | field.setSecure(true); |
998 | 0 | fieldAuth.setShouldBeEncrypted(true); |
999 | 0 | MaskFormatter maskFormatter = fieldAuth.getMaskFormatter(); |
1000 | 0 | String displayMaskValue = maskFormatter.maskValue(field.getPropertyValue()); |
1001 | 0 | field.setDisplayMaskValue(displayMaskValue); |
1002 | 0 | populateSecureField(field, field.getPropertyValue()); |
1003 | |
} |
1004 | |
} |
1005 | |
|
1006 | 0 | if (Field.isInputField(field.getFieldType()) || field.getFieldType().equalsIgnoreCase(Field.CHECKBOX)) { |
1007 | |
|
1008 | |
|
1009 | 0 | if (fieldAuth.isReadOnly()) { |
1010 | 0 | if (!field.isReadOnly() && !fieldAuth.isMasked() && !fieldAuth.isPartiallyMasked()) { |
1011 | 0 | field.setReadOnly(true); |
1012 | |
} |
1013 | |
} |
1014 | 0 | else if (fieldAuth.isHidden()) { |
1015 | 0 | if (field.getFieldType() != Field.HIDDEN) { |
1016 | 0 | field.setFieldType(Field.HIDDEN); |
1017 | |
} |
1018 | |
} |
1019 | |
} |
1020 | |
|
1021 | 0 | if(Field.BUTTON.equalsIgnoreCase(field.getFieldType()) && fieldAuth.isHidden()){ |
1022 | 0 | field.setFieldType(Field.HIDDEN); |
1023 | |
} |
1024 | |
|
1025 | |
|
1026 | |
|
1027 | 0 | if (field.isReadOnly() && fieldAuth.isHidden()) { |
1028 | 0 | field.setFieldType(Field.HIDDEN); |
1029 | |
} |
1030 | |
|
1031 | |
} |
1032 | |
|
1033 | |
|
1034 | |
} |
1035 | 0 | else if (field.getPropertyName().startsWith(KNSConstants.MAINTENANCE_OLD_MAINTAINABLE)) { |
1036 | |
|
1037 | 0 | fieldName = field.getPropertyName().substring(KNSConstants.MAINTENANCE_OLD_MAINTAINABLE.length()); |
1038 | |
|
1039 | 0 | if (auths.hasRestriction(fieldName)) { |
1040 | 0 | fieldAuth = auths.getFieldRestriction(fieldName); |
1041 | 0 | if(fieldAuth.isPartiallyMasked()){ |
1042 | 0 | field.setSecure(true); |
1043 | 0 | MaskFormatter maskFormatter = fieldAuth.getMaskFormatter(); |
1044 | 0 | String displayMaskValue = maskFormatter.maskValue(field.getPropertyValue()); |
1045 | 0 | field.setDisplayMaskValue(displayMaskValue); |
1046 | 0 | field.setPropertyValue(displayMaskValue); |
1047 | 0 | populateSecureField(field, field.getPropertyValue()); |
1048 | |
|
1049 | |
} |
1050 | |
|
1051 | 0 | if(fieldAuth.isMasked()){ |
1052 | 0 | field.setSecure(true); |
1053 | 0 | MaskFormatter maskFormatter = fieldAuth.getMaskFormatter(); |
1054 | 0 | String displayMaskValue = maskFormatter.maskValue(field.getPropertyValue()); |
1055 | 0 | field.setDisplayMaskValue(displayMaskValue); |
1056 | 0 | field.setPropertyValue(displayMaskValue); |
1057 | 0 | populateSecureField(field, field.getPropertyValue()); |
1058 | |
} |
1059 | |
|
1060 | 0 | if (fieldAuth.isHidden()) { |
1061 | 0 | field.setFieldType(Field.HIDDEN); |
1062 | |
} |
1063 | |
} |
1064 | |
} |
1065 | 0 | } |
1066 | |
|
1067 | |
|
1068 | |
|
1069 | |
|
1070 | |
|
1071 | |
|
1072 | |
|
1073 | |
|
1074 | |
|
1075 | |
|
1076 | |
|
1077 | |
public static List meshSections(List oldSections, List newSections, List keyFieldNames, String maintenanceAction, boolean readOnly, MaintenanceDocumentRestrictions auths, String documentStatus, String documentInitiatorPrincipalId) { |
1078 | 0 | List meshedSections = new ArrayList(); |
1079 | |
|
1080 | 0 | for (int i = 0; i < newSections.size(); i++) { |
1081 | 0 | Section maintSection = (Section) newSections.get(i); |
1082 | 0 | List sectionRows = maintSection.getRows(); |
1083 | 0 | Section oldMaintSection = (Section) oldSections.get(i); |
1084 | 0 | List oldSectionRows = oldMaintSection.getRows(); |
1085 | 0 | List<Row> meshedRows = new ArrayList(); |
1086 | 0 | meshedRows = meshRows(oldSectionRows, sectionRows, keyFieldNames, maintenanceAction, readOnly, auths, documentStatus, documentInitiatorPrincipalId); |
1087 | 0 | maintSection.setRows(meshedRows); |
1088 | 0 | if (StringUtils.isBlank(maintSection.getErrorKey())) { |
1089 | 0 | maintSection.setErrorKey(MaintenanceUtils.generateErrorKeyForSection(maintSection)); |
1090 | |
} |
1091 | 0 | meshedSections.add(maintSection); |
1092 | |
} |
1093 | |
|
1094 | 0 | return meshedSections; |
1095 | |
} |
1096 | |
|
1097 | |
|
1098 | |
|
1099 | |
|
1100 | |
|
1101 | |
|
1102 | |
|
1103 | |
|
1104 | |
|
1105 | |
|
1106 | |
|
1107 | |
public static List meshRows(List oldRows, List newRows, List keyFieldNames, String maintenanceAction, boolean readOnly, MaintenanceDocumentRestrictions auths, String documentStatus, String documentInitiatorPrincipalId) { |
1108 | 0 | List<Row> meshedRows = new ArrayList<Row>(); |
1109 | |
|
1110 | 0 | for (int j = 0; j < newRows.size(); j++) { |
1111 | 0 | Row sectionRow = (Row) newRows.get(j); |
1112 | 0 | List rowFields = sectionRow.getFields(); |
1113 | 0 | Row oldSectionRow = null; |
1114 | 0 | List oldRowFields = new ArrayList(); |
1115 | |
|
1116 | 0 | if (null != oldRows && oldRows.size() > j) { |
1117 | 0 | oldSectionRow = (Row) oldRows.get(j); |
1118 | 0 | oldRowFields = oldSectionRow.getFields(); |
1119 | |
} |
1120 | |
|
1121 | 0 | List meshedFields = meshFields(oldRowFields, rowFields, keyFieldNames, maintenanceAction, readOnly, auths, documentStatus, documentInitiatorPrincipalId); |
1122 | 0 | if (meshedFields.size() > 0) { |
1123 | 0 | Row meshedRow = new Row(meshedFields); |
1124 | 0 | if (sectionRow.isHidden()) { |
1125 | 0 | meshedRow.setHidden(true); |
1126 | |
} |
1127 | |
|
1128 | 0 | meshedRows.add(meshedRow); |
1129 | |
} |
1130 | |
} |
1131 | |
|
1132 | 0 | return meshedRows; |
1133 | |
} |
1134 | |
|
1135 | |
|
1136 | |
|
1137 | |
|
1138 | |
|
1139 | |
|
1140 | |
|
1141 | |
|
1142 | |
|
1143 | |
|
1144 | |
|
1145 | |
|
1146 | |
public static List meshFields(List oldFields, List newFields, List keyFieldNames, String maintenanceAction, boolean readOnly, MaintenanceDocumentRestrictions auths, String documentStatus, String documentInitiatorPrincipalId) { |
1147 | 0 | List meshedFields = new ArrayList(); |
1148 | |
|
1149 | 0 | List newFieldsToMerge = new ArrayList(); |
1150 | 0 | List oldFieldsToMerge = new ArrayList(); |
1151 | |
|
1152 | 0 | for (int k = 0; k < newFields.size(); k++) { |
1153 | 0 | Field newMaintField = (Field) newFields.get(k); |
1154 | 0 | String propertyName = newMaintField.getPropertyName(); |
1155 | |
|
1156 | 0 | if (Field.IMAGE_SUBMIT.equals(newMaintField.getFieldType())) { |
1157 | 0 | meshedFields.add(newMaintField); |
1158 | |
} |
1159 | 0 | else if (Field.CONTAINER.equals(newMaintField.getFieldType())) { |
1160 | 0 | if (oldFields.size() > k) { |
1161 | 0 | Field oldMaintField = (Field) oldFields.get(k); |
1162 | 0 | newMaintField = meshContainerFields(oldMaintField, newMaintField, keyFieldNames, maintenanceAction, readOnly, auths, documentStatus, documentInitiatorPrincipalId); |
1163 | 0 | } |
1164 | |
else { |
1165 | 0 | newMaintField = meshContainerFields(newMaintField, newMaintField, keyFieldNames, maintenanceAction, readOnly, auths, documentStatus, documentInitiatorPrincipalId); |
1166 | |
} |
1167 | 0 | meshedFields.add(newMaintField); |
1168 | |
} |
1169 | |
else { |
1170 | 0 | newMaintField = FieldUtils.fixFieldForForm(newMaintField, keyFieldNames, KNSConstants.MAINTENANCE_NEW_MAINTAINABLE, maintenanceAction, readOnly, auths, documentStatus, documentInitiatorPrincipalId); |
1171 | |
|
1172 | 0 | if (KNSConstants.MAINTENANCE_EDIT_ACTION.equals(maintenanceAction) || KNSConstants.MAINTENANCE_COPY_ACTION.equals(maintenanceAction)) { |
1173 | 0 | Field oldMaintField = (Field) oldFields.get(k); |
1174 | |
|
1175 | |
|
1176 | |
|
1177 | 0 | if (!StringUtils.equalsIgnoreCase(newMaintField.getPropertyValue(), oldMaintField.getPropertyValue()) |
1178 | |
&& !Field.HIDDEN.equals(newMaintField.getFieldType())) { |
1179 | 0 | newMaintField.setHighlightField(true); |
1180 | |
} |
1181 | |
|
1182 | 0 | oldMaintField = FieldUtils.fixFieldForForm(oldMaintField, keyFieldNames, KNSConstants.MAINTENANCE_OLD_MAINTAINABLE, maintenanceAction, true, auths, documentStatus, documentInitiatorPrincipalId); |
1183 | 0 | oldFieldsToMerge.add(oldMaintField); |
1184 | |
} |
1185 | |
|
1186 | 0 | newFieldsToMerge.add(newMaintField); |
1187 | |
|
1188 | 0 | for (Iterator iter = oldFieldsToMerge.iterator(); iter.hasNext();) { |
1189 | 0 | Field element = (Field) iter.next(); |
1190 | 0 | meshedFields.add(element); |
1191 | 0 | } |
1192 | |
|
1193 | 0 | for (Iterator iter = newFieldsToMerge.iterator(); iter.hasNext();) { |
1194 | 0 | Field element = (Field) iter.next(); |
1195 | 0 | meshedFields.add(element); |
1196 | 0 | } |
1197 | |
} |
1198 | |
} |
1199 | 0 | return meshedFields; |
1200 | |
} |
1201 | |
|
1202 | |
|
1203 | |
|
1204 | |
|
1205 | |
|
1206 | |
|
1207 | |
|
1208 | |
|
1209 | |
|
1210 | |
|
1211 | |
|
1212 | |
|
1213 | |
|
1214 | |
protected static boolean isLookupFieldLevelHelpEnabled(Class businessObjectClass, String attributeName) { |
1215 | 0 | return false; |
1216 | |
} |
1217 | |
|
1218 | |
|
1219 | |
|
1220 | |
|
1221 | |
|
1222 | |
|
1223 | |
|
1224 | |
|
1225 | |
|
1226 | |
|
1227 | |
|
1228 | |
|
1229 | |
|
1230 | |
protected static boolean isLookupFieldLevelHelpDisabled(Class businessObjectClass, String attributeName) { |
1231 | 0 | return false; |
1232 | |
} |
1233 | |
|
1234 | |
public static List createAndPopulateFieldsForLookup(List<String> lookupFieldAttributeList, List<String> readOnlyFieldsList, Class businessObjectClass) throws InstantiationException, IllegalAccessException { |
1235 | 0 | List<Field> fields = new ArrayList<Field>(); |
1236 | 0 | BusinessObjectEntry boe = getDataDictionaryService().getDataDictionary().getBusinessObjectEntry(businessObjectClass.getName()); |
1237 | |
|
1238 | 0 | Map<String, Boolean> isHiddenMap = new HashMap<String, Boolean>(); |
1239 | 0 | Map<String, Boolean> isReadOnlyMap = new HashMap<String, Boolean>(); |
1240 | |
|
1241 | |
|
1242 | |
|
1243 | |
|
1244 | |
|
1245 | 0 | if(boe.hasLookupDefinition()){ |
1246 | 0 | List<FieldDefinition> fieldDefs = boe.getLookupDefinition().getLookupFields(); |
1247 | 0 | for(FieldDefinition field : fieldDefs){ |
1248 | 0 | isReadOnlyMap.put(field.getAttributeName(), Boolean.valueOf(field.isReadOnly())); |
1249 | 0 | isHiddenMap.put(field.getAttributeName(), Boolean.valueOf(field.isHidden())); |
1250 | |
} |
1251 | |
} |
1252 | |
|
1253 | 0 | for( String attributeName : lookupFieldAttributeList ) |
1254 | |
{ |
1255 | 0 | Field field = FieldUtils.getPropertyField(businessObjectClass, attributeName, true); |
1256 | |
|
1257 | 0 | if(field.isDatePicker() && field.isRanged()) { |
1258 | |
|
1259 | 0 | Field newDate = createRangeDateField(field); |
1260 | 0 | fields.add(newDate); |
1261 | |
} |
1262 | |
|
1263 | |
BusinessObject newBusinessObjectInstance; |
1264 | 0 | if (ExternalizableBusinessObjectUtils.isExternalizableBusinessObjectInterface(businessObjectClass)) { |
1265 | 0 | ModuleService moduleService = getKualiModuleService().getResponsibleModuleService(businessObjectClass); |
1266 | 0 | newBusinessObjectInstance = (BusinessObject) moduleService.createNewObjectFromExternalizableClass(businessObjectClass); |
1267 | 0 | } |
1268 | |
else { |
1269 | 0 | newBusinessObjectInstance = (BusinessObject) businessObjectClass.newInstance(); |
1270 | |
} |
1271 | |
|
1272 | 0 | field = LookupUtils.setFieldQuickfinder(newBusinessObjectInstance, attributeName, field, lookupFieldAttributeList); |
1273 | 0 | field = LookupUtils.setFieldDirectInquiry(newBusinessObjectInstance, attributeName, field); |
1274 | |
|
1275 | |
|
1276 | 0 | if (!Field.MULTISELECT.equals(field.getFieldType())) { |
1277 | 0 | field.setMaxLength(100); |
1278 | |
} |
1279 | |
|
1280 | |
|
1281 | 0 | if (attributeName.equals(KNSPropertyConstants.ACTIVE) && Inactivateable.class.isAssignableFrom(businessObjectClass)) { |
1282 | 0 | field.setPropertyValue(KNSConstants.YES_INDICATOR_VALUE); |
1283 | 0 | field.setDefaultValue(KNSConstants.YES_INDICATOR_VALUE); |
1284 | |
} |
1285 | |
|
1286 | 0 | String defaultValue = getBusinessObjectMetaDataService().getLookupFieldDefaultValue(businessObjectClass, attributeName); |
1287 | 0 | if (defaultValue != null) { |
1288 | 0 | field.setPropertyValue(defaultValue); |
1289 | 0 | field.setDefaultValue(defaultValue); |
1290 | |
} |
1291 | |
|
1292 | 0 | Class defaultValueFinderClass = getBusinessObjectMetaDataService().getLookupFieldDefaultValueFinderClass(businessObjectClass, attributeName); |
1293 | |
|
1294 | 0 | if (defaultValueFinderClass != null) { |
1295 | 0 | field.setPropertyValue(((ValueFinder) defaultValueFinderClass.newInstance()).getValue()); |
1296 | 0 | field.setDefaultValue(((ValueFinder) defaultValueFinderClass.newInstance()).getValue()); |
1297 | |
} |
1298 | 0 | if ( (readOnlyFieldsList != null && readOnlyFieldsList.contains(field.getPropertyName())) |
1299 | |
|| ( isReadOnlyMap.containsKey(field.getPropertyName()) && isReadOnlyMap.get(field.getPropertyName()).booleanValue()) |
1300 | |
) { |
1301 | 0 | field.setReadOnly(true); |
1302 | |
} |
1303 | |
|
1304 | 0 | populateQuickfinderDefaultsForLookup(businessObjectClass, attributeName, field); |
1305 | |
|
1306 | 0 | if ((isHiddenMap.containsKey(field.getPropertyName()) && isHiddenMap.get(field.getPropertyName()).booleanValue())) { |
1307 | 0 | field.setFieldType(Field.HIDDEN); |
1308 | |
} |
1309 | |
|
1310 | 0 | boolean triggerOnChange = getBusinessObjectDictionaryService().isLookupFieldTriggerOnChange(businessObjectClass, attributeName); |
1311 | 0 | field.setTriggerOnChange(triggerOnChange); |
1312 | |
|
1313 | 0 | field.setFieldLevelHelpEnabled(isLookupFieldLevelHelpEnabled(businessObjectClass, attributeName)); |
1314 | 0 | field.setFieldLevelHelpDisabled(isLookupFieldLevelHelpDisabled(businessObjectClass, attributeName)); |
1315 | |
|
1316 | 0 | fields.add(field); |
1317 | 0 | } |
1318 | 0 | return fields; |
1319 | |
} |
1320 | |
|
1321 | |
|
1322 | |
|
1323 | |
|
1324 | |
|
1325 | |
|
1326 | |
|
1327 | |
|
1328 | |
|
1329 | |
|
1330 | |
|
1331 | |
private static void populateQuickfinderDefaultsForLookup( |
1332 | |
Class businessObjectClass, String attributeName, Field field) |
1333 | |
throws InstantiationException, IllegalAccessException { |
1334 | |
|
1335 | 0 | String quickfinderParamString = getBusinessObjectMetaDataService().getLookupFieldQuickfinderParameterString(businessObjectClass, attributeName); |
1336 | 0 | Class<? extends ValueFinder> quickfinderParameterFinderClass = |
1337 | |
getBusinessObjectMetaDataService().getLookupFieldQuickfinderParameterStringBuilderClass(businessObjectClass, attributeName); |
1338 | 0 | if (quickfinderParameterFinderClass != null) { |
1339 | 0 | quickfinderParamString = quickfinderParameterFinderClass.newInstance().getValue(); |
1340 | |
} |
1341 | |
|
1342 | 0 | if (!StringUtils.isEmpty(quickfinderParamString)) { |
1343 | 0 | String [] params = quickfinderParamString.split(","); |
1344 | 0 | if (params != null) for (String param : params) { |
1345 | 0 | if (param.contains(KNSConstants.LOOKUP_PARAMETER_LITERAL_DELIMITER)) { |
1346 | 0 | String[] paramChunks = param.split(KNSConstants.LOOKUP_PARAMETER_LITERAL_DELIMITER, 2); |
1347 | 0 | field.appendLookupParameters( |
1348 | |
KNSConstants.LOOKUP_PARAMETER_LITERAL_PREFIX+KNSConstants.LOOKUP_PARAMETER_LITERAL_DELIMITER+ |
1349 | |
paramChunks[1]+":"+paramChunks[0]); |
1350 | |
} |
1351 | |
} |
1352 | |
} |
1353 | 0 | } |
1354 | |
|
1355 | |
|
1356 | |
|
1357 | |
|
1358 | |
|
1359 | |
|
1360 | |
|
1361 | |
public static Field createRangeDateField(Field field) { |
1362 | 0 | Field newDate = (Field)ObjectUtils.deepCopy(field); |
1363 | 0 | newDate.setFieldLabel(newDate.getFieldLabel()+" "+KNSConstants.LOOKUP_DEFAULT_RANGE_SEARCH_LOWER_BOUND_LABEL); |
1364 | 0 | field.setFieldLabel(field.getFieldLabel()+" "+KNSConstants.LOOKUP_DEFAULT_RANGE_SEARCH_UPPER_BOUND_LABEL); |
1365 | 0 | newDate.setPropertyName(KNSConstants.LOOKUP_RANGE_LOWER_BOUND_PROPERTY_PREFIX+newDate.getPropertyName()); |
1366 | 0 | return newDate; |
1367 | |
} |
1368 | |
|
1369 | |
private static Field meshContainerFields(Field oldMaintField, Field newMaintField, List keyFieldNames, String maintenanceAction, boolean readOnly, MaintenanceDocumentRestrictions auths, String documentStatus, String documentInitiatorPrincipalId) { |
1370 | 0 | List resultingRows = new ArrayList(); |
1371 | 0 | resultingRows.addAll(meshRows(oldMaintField.getContainerRows(), newMaintField.getContainerRows(), keyFieldNames, maintenanceAction, readOnly, auths, documentStatus, documentInitiatorPrincipalId)); |
1372 | 0 | Field resultingField = newMaintField; |
1373 | 0 | resultingField.setFieldType(Field.CONTAINER); |
1374 | |
|
1375 | |
|
1376 | 0 | resultingField.setContainerElementName(newMaintField.getContainerElementName()); |
1377 | 0 | resultingField.setContainerDisplayFields(newMaintField.getContainerDisplayFields()); |
1378 | 0 | resultingField.setNumberOfColumnsForCollection(newMaintField.getNumberOfColumnsForCollection()); |
1379 | |
|
1380 | 0 | resultingField.setContainerRows(resultingRows); |
1381 | 0 | List resultingRowsList = newMaintField.getContainerRows(); |
1382 | 0 | if (resultingRowsList.size() > 0) { |
1383 | 0 | List resultingFieldsList = ((Row) resultingRowsList.get(0)).getFields(); |
1384 | 0 | if (resultingFieldsList.size() > 0) { |
1385 | |
|
1386 | |
|
1387 | 0 | String containedFieldName = ((Field) (resultingFieldsList.get(0))).getPropertyName(); |
1388 | 0 | resultingField.setPropertyName(containedFieldName.substring(0, containedFieldName.lastIndexOf('.'))); |
1389 | |
} |
1390 | 0 | } |
1391 | |
else { |
1392 | 0 | resultingField.setPropertyName(oldMaintField.getPropertyName()); |
1393 | |
} |
1394 | 0 | return resultingField; |
1395 | |
} |
1396 | |
|
1397 | |
|
1398 | |
|
1399 | |
|
1400 | |
|
1401 | |
|
1402 | |
|
1403 | |
|
1404 | |
static final public void modifyFieldToSupportMultipleValueLookups(Field field, String parents, MaintainableCollectionDefinition definition) { |
1405 | 0 | field.setMultipleValueLookedUpCollectionName(parents + definition.getName()); |
1406 | 0 | field.setMultipleValueLookupClassName(definition.getSourceClassName().getName()); |
1407 | 0 | field.setMultipleValueLookupClassLabel(getDataDictionaryService().getDataDictionary().getBusinessObjectEntry(definition.getSourceClassName().getName()).getObjectLabel()); |
1408 | 0 | } |
1409 | |
|
1410 | |
|
1411 | |
|
1412 | |
|
1413 | |
|
1414 | |
|
1415 | |
|
1416 | |
|
1417 | |
static final public boolean isCollectionMultipleLookupEnabled(MaintainableCollectionDefinition definition) { |
1418 | 0 | return definition.getSourceClassName() != null && definition.isIncludeMultipleLookupLine(); |
1419 | |
} |
1420 | |
|
1421 | |
|
1422 | |
|
1423 | |
|
1424 | |
|
1425 | |
|
1426 | |
|
1427 | |
|
1428 | |
public static String scrubWhitespace(String s) { |
1429 | 0 | return s.replaceAll("(\\s)(\\s+)", " "); |
1430 | |
} |
1431 | |
|
1432 | |
private static DataDictionaryService getDataDictionaryService() { |
1433 | 0 | if (dataDictionaryService == null) { |
1434 | 0 | dataDictionaryService = KNSServiceLocator.getDataDictionaryService(); |
1435 | |
} |
1436 | 0 | return dataDictionaryService; |
1437 | |
} |
1438 | |
|
1439 | |
private static BusinessObjectMetaDataService getBusinessObjectMetaDataService() { |
1440 | 0 | if (businessObjectMetaDataService == null) { |
1441 | 0 | businessObjectMetaDataService = KNSServiceLocator.getBusinessObjectMetaDataService(); |
1442 | |
} |
1443 | 0 | return businessObjectMetaDataService; |
1444 | |
} |
1445 | |
|
1446 | |
private static BusinessObjectDictionaryService getBusinessObjectDictionaryService() { |
1447 | 0 | if (businessObjectDictionaryService == null) { |
1448 | 0 | businessObjectDictionaryService = KNSServiceLocator.getBusinessObjectDictionaryService(); |
1449 | |
} |
1450 | 0 | return businessObjectDictionaryService; |
1451 | |
} |
1452 | |
|
1453 | |
private static KualiModuleService getKualiModuleService() { |
1454 | 0 | if (kualiModuleService == null) { |
1455 | 0 | kualiModuleService = KNSServiceLocator.getKualiModuleService(); |
1456 | |
} |
1457 | 0 | return kualiModuleService; |
1458 | |
} |
1459 | |
} |