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