1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kns.maintenance; |
17 | |
|
18 | |
import org.apache.commons.beanutils.PropertyUtils; |
19 | |
import org.apache.commons.lang.StringUtils; |
20 | |
import org.kuali.rice.core.api.encryption.EncryptionService; |
21 | |
import org.kuali.rice.core.web.format.FormatException; |
22 | |
import org.kuali.rice.kim.api.services.KimApiServiceLocator; |
23 | |
import org.kuali.rice.kns.datadictionary.MaintainableCollectionDefinition; |
24 | |
import org.kuali.rice.kns.datadictionary.MaintainableFieldDefinition; |
25 | |
import org.kuali.rice.kns.datadictionary.MaintainableItemDefinition; |
26 | |
import org.kuali.rice.kns.datadictionary.MaintainableSectionDefinition; |
27 | |
import org.kuali.rice.kns.document.MaintenanceDocument; |
28 | |
import org.kuali.rice.kns.document.authorization.FieldRestriction; |
29 | |
import org.kuali.rice.kns.document.authorization.MaintenanceDocumentRestrictions; |
30 | |
import org.kuali.rice.kns.lookup.LookupUtils; |
31 | |
import org.kuali.rice.kns.service.BusinessObjectAuthorizationService; |
32 | |
import org.kuali.rice.kns.service.BusinessObjectMetaDataService; |
33 | |
import org.kuali.rice.kns.service.KNSServiceLocator; |
34 | |
import org.kuali.rice.kns.service.MaintenanceDocumentDictionaryService; |
35 | |
import org.kuali.rice.kns.util.FieldUtils; |
36 | |
import org.kuali.rice.kns.util.InactiveRecordsHidingUtils; |
37 | |
import org.kuali.rice.kns.util.MaintenanceUtils; |
38 | |
import org.kuali.rice.kns.web.ui.Section; |
39 | |
import org.kuali.rice.kns.web.ui.SectionBridge; |
40 | |
import org.kuali.rice.krad.bo.BusinessObject; |
41 | |
import org.kuali.rice.krad.bo.DataObjectRelationship; |
42 | |
import org.kuali.rice.krad.bo.PersistableBusinessObject; |
43 | |
import org.kuali.rice.krad.datadictionary.AttributeSecurity; |
44 | |
import org.kuali.rice.krad.datadictionary.exception.UnknownBusinessClassAttributeException; |
45 | |
import org.kuali.rice.krad.document.authorization.MaintenanceDocumentPresentationController; |
46 | |
import org.kuali.rice.krad.valuefinder.ValueFinder; |
47 | |
import org.kuali.rice.krad.maintenance.MaintainableImpl; |
48 | |
import org.kuali.rice.krad.service.BusinessObjectDictionaryService; |
49 | |
import org.kuali.rice.krad.service.DataDictionaryService; |
50 | |
import org.kuali.rice.krad.service.DocumentHelperService; |
51 | |
import org.kuali.rice.krad.service.KRADServiceLocator; |
52 | |
import org.kuali.rice.krad.service.KRADServiceLocatorWeb; |
53 | |
import org.kuali.rice.krad.service.ModuleService; |
54 | |
import org.kuali.rice.krad.service.PersistenceStructureService; |
55 | |
import org.kuali.rice.krad.util.GlobalVariables; |
56 | |
import org.kuali.rice.krad.util.KRADConstants; |
57 | |
import org.kuali.rice.krad.util.KRADPropertyConstants; |
58 | |
import org.kuali.rice.krad.util.MessageMap; |
59 | |
import org.kuali.rice.krad.util.ObjectUtils; |
60 | |
|
61 | |
import java.beans.PropertyDescriptor; |
62 | |
import java.lang.reflect.InvocationTargetException; |
63 | |
import java.security.GeneralSecurityException; |
64 | |
import java.util.ArrayList; |
65 | |
import java.util.Collection; |
66 | |
import java.util.HashMap; |
67 | |
import java.util.HashSet; |
68 | |
import java.util.Iterator; |
69 | |
import java.util.List; |
70 | |
import java.util.Map; |
71 | |
import java.util.Set; |
72 | |
|
73 | |
|
74 | |
|
75 | |
|
76 | |
@Deprecated |
77 | |
public class KualiMaintainableImpl extends MaintainableImpl implements Maintainable { |
78 | |
private static final long serialVersionUID = 4814145799502207182L; |
79 | |
|
80 | 0 | private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(KualiMaintainableImpl.class); |
81 | |
|
82 | |
protected PersistableBusinessObject businessObject; |
83 | |
|
84 | 0 | protected Map<String, PersistableBusinessObject> newCollectionLines = new HashMap<String, PersistableBusinessObject>(); |
85 | 0 | protected Map<String, Boolean> inactiveRecordDisplay = new HashMap<String, Boolean>(); |
86 | |
|
87 | |
|
88 | 0 | protected Set<String> newCollectionLineNames = new HashSet<String>(); |
89 | |
|
90 | |
protected transient PersistenceStructureService persistenceStructureService; |
91 | |
protected transient BusinessObjectDictionaryService businessObjectDictionaryService; |
92 | |
protected transient org.kuali.rice.kim.service.PersonService personService; |
93 | |
protected transient BusinessObjectMetaDataService businessObjectMetaDataService; |
94 | |
protected transient BusinessObjectAuthorizationService businessObjectAuthorizationService; |
95 | |
protected transient DocumentHelperService documentHelperService; |
96 | |
protected transient MaintenanceDocumentDictionaryService maintenanceDocumentDictionaryService; |
97 | |
|
98 | |
|
99 | |
|
100 | |
|
101 | |
public KualiMaintainableImpl() { |
102 | 0 | super(); |
103 | 0 | } |
104 | |
|
105 | |
|
106 | |
|
107 | |
|
108 | |
|
109 | |
|
110 | |
public KualiMaintainableImpl(PersistableBusinessObject businessObject) { |
111 | 0 | super(); |
112 | 0 | this.businessObject = businessObject; |
113 | 0 | super.setDataObject(businessObject); |
114 | 0 | } |
115 | |
|
116 | |
|
117 | |
|
118 | |
|
119 | |
|
120 | |
@SuppressWarnings("unchecked") |
121 | |
public Map populateBusinessObject(Map<String, String> fieldValues, MaintenanceDocument maintenanceDocument, |
122 | |
String methodToCall) { |
123 | 0 | fieldValues = decryptEncryptedData(fieldValues, maintenanceDocument, methodToCall); |
124 | 0 | Map newFieldValues = null; |
125 | 0 | newFieldValues = getPersonService().resolvePrincipalNamesToPrincipalIds(getBusinessObject(), fieldValues); |
126 | |
|
127 | 0 | Map cachedValues = FieldUtils.populateBusinessObjectFromMap(getBusinessObject(), newFieldValues); |
128 | 0 | performForceUpperCase(newFieldValues); |
129 | |
|
130 | 0 | return cachedValues; |
131 | |
} |
132 | |
|
133 | |
|
134 | |
|
135 | |
|
136 | |
|
137 | |
|
138 | |
|
139 | |
|
140 | |
|
141 | |
|
142 | |
|
143 | |
|
144 | |
protected Map<String, String> decryptEncryptedData(Map<String, String> fieldValues, |
145 | |
MaintenanceDocument maintenanceDocument, String methodToCall) { |
146 | |
try { |
147 | 0 | MaintenanceDocumentRestrictions auths = KNSServiceLocator.getBusinessObjectAuthorizationService() |
148 | |
.getMaintenanceDocumentRestrictions(maintenanceDocument, |
149 | |
GlobalVariables.getUserSession().getPerson()); |
150 | 0 | for (Iterator<String> iter = fieldValues.keySet().iterator(); iter.hasNext();) { |
151 | 0 | String fieldName = iter.next(); |
152 | 0 | String fieldValue = (String) fieldValues.get(fieldName); |
153 | |
|
154 | 0 | if (fieldValue != null && !"".equals(fieldValue) |
155 | |
&& fieldValue.endsWith(EncryptionService.ENCRYPTION_POST_PREFIX)) { |
156 | 0 | if (shouldFieldBeEncrypted(maintenanceDocument, fieldName, auths, methodToCall)) { |
157 | 0 | String encryptedValue = fieldValue; |
158 | |
|
159 | |
|
160 | 0 | encryptedValue = StringUtils.stripEnd(encryptedValue, EncryptionService.ENCRYPTION_POST_PREFIX); |
161 | 0 | String decryptedValue = getEncryptionService().decrypt(encryptedValue); |
162 | |
|
163 | 0 | fieldValues.put(fieldName, decryptedValue); |
164 | 0 | } |
165 | |
else |
166 | 0 | throw new RuntimeException("The field value for field name " + fieldName |
167 | |
+ " should not be encrypted."); |
168 | |
} |
169 | 0 | else if (fieldValue != null && !"".equals(fieldValue) |
170 | |
&& shouldFieldBeEncrypted(maintenanceDocument, fieldName, auths, methodToCall)) |
171 | 0 | throw new RuntimeException("The field value for field name " + fieldName + " should be encrypted."); |
172 | 0 | } |
173 | |
} |
174 | 0 | catch (GeneralSecurityException e) { |
175 | 0 | throw new RuntimeException("Unable to decrypt secure data: " + e.getMessage()); |
176 | 0 | } |
177 | |
|
178 | 0 | return fieldValues; |
179 | |
} |
180 | |
|
181 | |
|
182 | |
|
183 | |
|
184 | |
|
185 | |
|
186 | |
|
187 | |
|
188 | |
|
189 | |
|
190 | |
|
191 | |
|
192 | |
|
193 | |
|
194 | |
|
195 | |
|
196 | |
|
197 | |
|
198 | |
|
199 | |
|
200 | |
protected boolean shouldFieldBeEncrypted(MaintenanceDocument maintenanceDocument, String fieldName, |
201 | |
MaintenanceDocumentRestrictions auths, String methodToCall) { |
202 | 0 | if ("refresh".equals(methodToCall) && fieldName != null) { |
203 | 0 | fieldName = fieldName.replaceAll("\\[[0-9]*+\\]", ""); |
204 | 0 | fieldName = fieldName.replaceAll("^add\\.", ""); |
205 | 0 | Map<String, AttributeSecurity> fieldNameToAttributeSecurityMap = MaintenanceUtils |
206 | |
.retrievePropertyPathToAttributeSecurityMappings(getDocumentTypeName()); |
207 | 0 | AttributeSecurity attributeSecurity = fieldNameToAttributeSecurityMap.get(fieldName); |
208 | 0 | return attributeSecurity != null && attributeSecurity.hasRestrictionThatRemovesValueFromUI(); |
209 | |
} |
210 | |
else { |
211 | 0 | return false; |
212 | |
} |
213 | |
} |
214 | |
|
215 | |
|
216 | |
|
217 | |
|
218 | |
|
219 | |
|
220 | |
|
221 | |
|
222 | |
public List getSections(MaintenanceDocument document, Maintainable oldMaintainable) { |
223 | 0 | List<Section> sections = new ArrayList<Section>(); |
224 | 0 | sections.addAll(getCoreSections(document, oldMaintainable)); |
225 | |
|
226 | 0 | return sections; |
227 | |
} |
228 | |
|
229 | |
|
230 | |
|
231 | |
|
232 | |
|
233 | |
|
234 | |
|
235 | |
|
236 | |
|
237 | |
|
238 | |
public List<Section> getCoreSections(MaintenanceDocument document, Maintainable oldMaintainable) { |
239 | 0 | List<Section> sections = new ArrayList<Section>(); |
240 | 0 | MaintenanceDocumentRestrictions maintenanceRestrictions = KNSServiceLocator |
241 | |
.getBusinessObjectAuthorizationService().getMaintenanceDocumentRestrictions(document, |
242 | |
GlobalVariables.getUserSession().getPerson()); |
243 | |
|
244 | 0 | MaintenanceDocumentPresentationController maintenanceDocumentPresentationController = (MaintenanceDocumentPresentationController) getDocumentHelperService() |
245 | |
.getDocumentPresentationController(document); |
246 | 0 | Set<String> conditionallyRequiredFields = maintenanceDocumentPresentationController |
247 | |
.getConditionallyRequiredPropertyNames(document); |
248 | |
|
249 | 0 | List<MaintainableSectionDefinition> sectionDefinitions = getMaintenanceDocumentDictionaryService() |
250 | |
.getMaintainableSections(getDocumentTypeName()); |
251 | |
try { |
252 | |
|
253 | 0 | for (Iterator iter = sectionDefinitions.iterator(); iter.hasNext();) { |
254 | 0 | MaintainableSectionDefinition maintSectionDef = (MaintainableSectionDefinition) iter.next(); |
255 | |
|
256 | 0 | List<String> displayedFieldNames = new ArrayList<String>(); |
257 | 0 | if (!maintenanceRestrictions.isHiddenSectionId(maintSectionDef.getId())) { |
258 | |
|
259 | 0 | for (Iterator iter2 = maintSectionDef.getMaintainableItems().iterator(); iter2.hasNext();) { |
260 | 0 | MaintainableItemDefinition item = (MaintainableItemDefinition) iter2.next(); |
261 | 0 | if (item instanceof MaintainableFieldDefinition) { |
262 | 0 | displayedFieldNames.add(((MaintainableFieldDefinition) item).getName()); |
263 | |
} |
264 | 0 | } |
265 | |
|
266 | 0 | Section section = SectionBridge |
267 | |
.toSection(maintSectionDef, getBusinessObject(), this, oldMaintainable, |
268 | |
getMaintenanceAction(), displayedFieldNames, conditionallyRequiredFields); |
269 | 0 | if (maintenanceRestrictions.isReadOnlySectionId(maintSectionDef.getId())) { |
270 | 0 | section.setReadOnly(true); |
271 | |
} |
272 | |
|
273 | |
|
274 | 0 | sections.add(section); |
275 | |
} |
276 | |
|
277 | 0 | } |
278 | |
|
279 | |
} |
280 | 0 | catch (InstantiationException e) { |
281 | 0 | LOG.error("Unable to create instance of object class" + e.getMessage()); |
282 | 0 | throw new RuntimeException("Unable to create instance of object class" + e.getMessage()); |
283 | |
} |
284 | 0 | catch (IllegalAccessException e) { |
285 | 0 | LOG.error("Unable to create instance of object class" + e.getMessage()); |
286 | 0 | throw new RuntimeException("Unable to create instance of object class" + e.getMessage()); |
287 | 0 | } |
288 | |
|
289 | 0 | return sections; |
290 | |
} |
291 | |
|
292 | |
|
293 | |
|
294 | |
|
295 | |
|
296 | |
public void saveBusinessObject() { |
297 | 0 | getBusinessObjectService().linkAndSave(businessObject); |
298 | 0 | } |
299 | |
|
300 | |
|
301 | |
|
302 | |
|
303 | |
public String getMaintainableTitle() { |
304 | 0 | return getMaintenanceDocumentDictionaryService().getMaintenanceLabel(getDocumentTypeName()); |
305 | |
} |
306 | |
|
307 | |
@Override |
308 | |
public void setupNewFromExisting(MaintenanceDocument document, Map<String, String[]> parameters) { |
309 | 0 | } |
310 | |
|
311 | |
|
312 | |
|
313 | |
|
314 | |
public boolean isBoNotesEnabled() { |
315 | 0 | return super.isNotesEnabled(); |
316 | |
} |
317 | |
|
318 | |
|
319 | |
|
320 | |
|
321 | |
|
322 | |
|
323 | |
public void refresh(String refreshCaller, Map fieldValues, MaintenanceDocument document) { |
324 | 0 | String referencesToRefresh = (String) fieldValues.get(KRADConstants.REFERENCES_TO_REFRESH); |
325 | 0 | refreshReferences(referencesToRefresh); |
326 | 0 | } |
327 | |
|
328 | |
protected void refreshReferences(String referencesToRefresh) { |
329 | 0 | PersistenceStructureService persistenceStructureService = getPersistenceStructureService(); |
330 | 0 | if (StringUtils.isNotBlank(referencesToRefresh)) { |
331 | 0 | String[] references = StringUtils.split(referencesToRefresh, KRADConstants.REFERENCES_TO_REFRESH_SEPARATOR); |
332 | 0 | for (String reference : references) { |
333 | 0 | if (StringUtils.isNotBlank(reference)) { |
334 | 0 | if (reference.startsWith(KRADConstants.ADD_PREFIX + ".")) { |
335 | |
|
336 | 0 | reference = reference.substring(KRADConstants.ADD_PREFIX.length() + 1); |
337 | |
|
338 | 0 | String boToRefreshName = StringUtils.substringBeforeLast(reference, "."); |
339 | 0 | String propertyToRefresh = StringUtils.substringAfterLast(reference, "."); |
340 | 0 | if (StringUtils.isNotBlank(propertyToRefresh)) { |
341 | 0 | PersistableBusinessObject addlineBO = getNewCollectionLine(boToRefreshName); |
342 | 0 | Class addlineBOClass = addlineBO.getClass(); |
343 | 0 | if (LOG.isDebugEnabled()) { |
344 | 0 | LOG.debug("Refresh this \"new\"/add object for the collections: " + reference); |
345 | |
} |
346 | 0 | if (persistenceStructureService.hasReference(addlineBOClass, propertyToRefresh) |
347 | |
|| persistenceStructureService.hasCollection(addlineBOClass, propertyToRefresh)) { |
348 | 0 | addlineBO.refreshReferenceObject(propertyToRefresh); |
349 | |
} |
350 | |
else { |
351 | 0 | if (getDataDictionaryService().hasRelationship(addlineBOClass.getName(), |
352 | |
propertyToRefresh)) { |
353 | |
|
354 | |
|
355 | 0 | Object possibleBO = ObjectUtils.getPropertyValue(addlineBO, propertyToRefresh); |
356 | 0 | if (possibleBO != null && possibleBO instanceof PersistableBusinessObject) { |
357 | 0 | ((PersistableBusinessObject) possibleBO).refresh(); |
358 | |
} |
359 | |
} |
360 | |
} |
361 | 0 | } |
362 | |
else { |
363 | 0 | LOG.error("Error: unable to refresh this \"new\"/add object for the collections: " |
364 | |
+ reference); |
365 | |
} |
366 | 0 | } |
367 | 0 | else if (ObjectUtils.isNestedAttribute(reference)) { |
368 | 0 | Object nestedObject = ObjectUtils.getNestedValue(getBusinessObject(), |
369 | |
ObjectUtils.getNestedAttributePrefix(reference)); |
370 | 0 | if (nestedObject instanceof Collection) { |
371 | |
|
372 | |
|
373 | |
|
374 | |
|
375 | |
|
376 | |
} |
377 | 0 | else if (nestedObject instanceof PersistableBusinessObject) { |
378 | 0 | String propertyToRefresh = ObjectUtils.getNestedAttributePrimitive(reference); |
379 | 0 | if (persistenceStructureService.hasReference(nestedObject.getClass(), propertyToRefresh) |
380 | |
|| persistenceStructureService.hasCollection(nestedObject.getClass(), |
381 | |
propertyToRefresh)) { |
382 | 0 | if (LOG.isDebugEnabled()) { |
383 | 0 | LOG.debug("Refeshing " + ObjectUtils.getNestedAttributePrefix(reference) + " " |
384 | |
+ ObjectUtils.getNestedAttributePrimitive(reference)); |
385 | |
} |
386 | 0 | ((PersistableBusinessObject) nestedObject).refreshReferenceObject(propertyToRefresh); |
387 | |
} |
388 | |
else { |
389 | |
|
390 | |
|
391 | 0 | Object possibleBO = ObjectUtils.getPropertyValue(nestedObject, propertyToRefresh); |
392 | 0 | if (possibleBO != null && possibleBO instanceof PersistableBusinessObject) { |
393 | 0 | if (getDataDictionaryService().hasRelationship(possibleBO.getClass().getName(), |
394 | |
propertyToRefresh)) { |
395 | 0 | ((PersistableBusinessObject) possibleBO).refresh(); |
396 | |
} |
397 | |
} |
398 | |
} |
399 | 0 | } |
400 | |
else { |
401 | 0 | LOG.warn("Expected that a referenceToRefresh (" |
402 | |
+ reference |
403 | |
+ ") would be a PersistableBusinessObject or Collection, but instead, it was of class " |
404 | |
+ nestedObject.getClass().getName()); |
405 | |
} |
406 | 0 | } |
407 | |
else { |
408 | 0 | if (LOG.isDebugEnabled()) { |
409 | 0 | LOG.debug("Refreshing " + reference); |
410 | |
} |
411 | 0 | if (persistenceStructureService.hasReference(getDataObjectClass(), reference) |
412 | |
|| persistenceStructureService.hasCollection(getDataObjectClass(), reference)) { |
413 | 0 | getBusinessObject().refreshReferenceObject(reference); |
414 | |
} |
415 | |
else { |
416 | 0 | if (getDataDictionaryService().hasRelationship(getBusinessObject().getClass().getName(), |
417 | |
reference)) { |
418 | |
|
419 | |
|
420 | 0 | Object possibleRelationship = ObjectUtils.getPropertyValue(getBusinessObject(), |
421 | |
reference); |
422 | 0 | if (possibleRelationship != null) { |
423 | 0 | if (possibleRelationship instanceof PersistableBusinessObject) { |
424 | 0 | ((PersistableBusinessObject) possibleRelationship).refresh(); |
425 | |
} |
426 | 0 | else if (possibleRelationship instanceof Collection) { |
427 | |
|
428 | |
|
429 | |
|
430 | |
|
431 | |
|
432 | |
|
433 | |
|
434 | |
} |
435 | |
else { |
436 | 0 | LOG.warn("Expected that a referenceToRefresh (" |
437 | |
+ reference |
438 | |
+ ") would be a PersistableBusinessObject or Collection, but instead, it was of class " |
439 | |
+ possibleRelationship.getClass().getName()); |
440 | |
} |
441 | |
} |
442 | |
} |
443 | |
} |
444 | |
} |
445 | |
} |
446 | |
} |
447 | |
} |
448 | 0 | } |
449 | |
|
450 | |
public void addMultipleValueLookupResults(MaintenanceDocument document, String collectionName, |
451 | |
Collection<PersistableBusinessObject> rawValues, boolean needsBlank, PersistableBusinessObject bo) { |
452 | 0 | Collection maintCollection = (Collection) ObjectUtils.getPropertyValue(bo, collectionName); |
453 | 0 | String docTypeName = document.getDocumentHeader().getWorkflowDocument().getDocumentTypeName(); |
454 | |
|
455 | 0 | List<String> duplicateIdentifierFieldsFromDataDictionary = getDuplicateIdentifierFieldsFromDataDictionary( |
456 | |
docTypeName, collectionName); |
457 | |
|
458 | 0 | List<String> existingIdentifierList = getMultiValueIdentifierList(maintCollection, |
459 | |
duplicateIdentifierFieldsFromDataDictionary); |
460 | |
|
461 | 0 | Class collectionClass = getMaintenanceDocumentDictionaryService().getCollectionBusinessObjectClass(docTypeName, |
462 | |
collectionName); |
463 | |
|
464 | 0 | List<MaintainableSectionDefinition> sections = getMaintenanceDocumentDictionaryService() |
465 | |
.getMaintainableSections(docTypeName); |
466 | 0 | Map<String, String> template = MaintenanceUtils.generateMultipleValueLookupBOTemplate(sections, collectionName); |
467 | |
try { |
468 | 0 | for (PersistableBusinessObject nextBo : rawValues) { |
469 | |
PersistableBusinessObject templatedBo; |
470 | 0 | if (needsBlank) { |
471 | 0 | templatedBo = (PersistableBusinessObject) collectionClass.newInstance(); |
472 | |
} |
473 | |
else { |
474 | |
|
475 | |
|
476 | |
|
477 | |
try { |
478 | 0 | ModuleService moduleService = KRADServiceLocatorWeb.getKualiModuleService() |
479 | |
.getResponsibleModuleService(collectionClass); |
480 | 0 | if (moduleService != null && moduleService.isExternalizable(collectionClass)) |
481 | 0 | templatedBo = (PersistableBusinessObject) moduleService |
482 | |
.createNewObjectFromExternalizableClass(collectionClass); |
483 | |
else |
484 | 0 | templatedBo = (PersistableBusinessObject) collectionClass.newInstance(); |
485 | |
} |
486 | 0 | catch (Exception e) { |
487 | 0 | throw new RuntimeException("Cannot instantiate " + collectionClass.getName(), e); |
488 | 0 | } |
489 | |
|
490 | 0 | setNewCollectionLineDefaultValues(collectionName, templatedBo); |
491 | |
|
492 | 0 | ObjectUtils.createHybridBusinessObject(templatedBo, nextBo, template); |
493 | |
|
494 | 0 | prepareBusinessObjectForAdditionFromMultipleValueLookup(collectionName, templatedBo); |
495 | |
} |
496 | 0 | templatedBo.setNewCollectionRecord(true); |
497 | |
|
498 | 0 | if (!hasBusinessObjectExisted(templatedBo, existingIdentifierList, |
499 | |
duplicateIdentifierFieldsFromDataDictionary)) { |
500 | 0 | maintCollection.add(templatedBo); |
501 | |
|
502 | |
} |
503 | 0 | } |
504 | |
} |
505 | 0 | catch (Exception e) { |
506 | 0 | LOG.error("Unable to add multiple value lookup results " + e.getMessage()); |
507 | 0 | throw new RuntimeException("Unable to add multiple value lookup results " + e.getMessage()); |
508 | 0 | } |
509 | 0 | } |
510 | |
|
511 | |
|
512 | |
|
513 | |
|
514 | |
|
515 | |
|
516 | |
|
517 | |
|
518 | |
|
519 | |
|
520 | |
|
521 | |
public List<String> getDuplicateIdentifierFieldsFromDataDictionary(String docTypeName, String collectionName) { |
522 | 0 | List<String> duplicateIdentifierFieldNames = new ArrayList<String>(); |
523 | 0 | MaintainableCollectionDefinition collDef = getMaintenanceDocumentDictionaryService().getMaintainableCollection( |
524 | |
docTypeName, collectionName); |
525 | 0 | Collection<MaintainableFieldDefinition> fieldDef = collDef.getDuplicateIdentificationFields(); |
526 | 0 | for (MaintainableFieldDefinition eachFieldDef : fieldDef) { |
527 | 0 | duplicateIdentifierFieldNames.add(eachFieldDef.getName()); |
528 | |
} |
529 | 0 | return duplicateIdentifierFieldNames; |
530 | |
} |
531 | |
|
532 | |
public List<String> getMultiValueIdentifierList(Collection maintCollection, List<String> duplicateIdentifierFields) { |
533 | 0 | List<String> identifierList = new ArrayList<String>(); |
534 | 0 | for (PersistableBusinessObject bo : (Collection<PersistableBusinessObject>) maintCollection) { |
535 | 0 | String uniqueIdentifier = new String(); |
536 | 0 | for (String identifierField : duplicateIdentifierFields) { |
537 | 0 | uniqueIdentifier = uniqueIdentifier + identifierField + "-" |
538 | |
+ ObjectUtils.getPropertyValue(bo, identifierField); |
539 | |
} |
540 | 0 | if (StringUtils.isNotEmpty(uniqueIdentifier)) { |
541 | 0 | identifierList.add(uniqueIdentifier); |
542 | |
} |
543 | 0 | } |
544 | 0 | return identifierList; |
545 | |
} |
546 | |
|
547 | |
public boolean hasBusinessObjectExisted(BusinessObject bo, List<String> existingIdentifierList, |
548 | |
List<String> duplicateIdentifierFields) { |
549 | 0 | String uniqueIdentifier = new String(); |
550 | 0 | for (String identifierField : duplicateIdentifierFields) { |
551 | 0 | uniqueIdentifier = uniqueIdentifier + identifierField + "-" |
552 | |
+ ObjectUtils.getPropertyValue(bo, identifierField); |
553 | |
} |
554 | 0 | if (existingIdentifierList.contains(uniqueIdentifier)) { |
555 | 0 | return true; |
556 | |
} |
557 | |
else { |
558 | 0 | return false; |
559 | |
} |
560 | |
} |
561 | |
|
562 | |
public void prepareBusinessObjectForAdditionFromMultipleValueLookup(String collectionName, BusinessObject bo) { |
563 | |
|
564 | 0 | } |
565 | |
|
566 | |
|
567 | |
|
568 | |
|
569 | |
|
570 | |
|
571 | |
|
572 | |
public void processAfterCopy(MaintenanceDocument document, Map<String, String[]> parameters) { |
573 | |
try { |
574 | 0 | ObjectUtils.setObjectPropertyDeep(businessObject, KRADPropertyConstants.NEW_COLLECTION_RECORD, |
575 | |
boolean.class, true, 2); |
576 | |
} |
577 | 0 | catch (Exception e) { |
578 | 0 | LOG.error("unable to set newCollectionRecord property: " + e.getMessage(), e); |
579 | 0 | throw new RuntimeException("unable to set newCollectionRecord property: " + e.getMessage(), e); |
580 | 0 | } |
581 | 0 | } |
582 | |
|
583 | |
@Override |
584 | |
public void processAfterEdit(MaintenanceDocument document, Map<String, String[]> requestParameters) { |
585 | |
|
586 | 0 | } |
587 | |
|
588 | |
@Override |
589 | |
public void processAfterNew(MaintenanceDocument document, Map<String, String[]> requestParameters) { |
590 | |
|
591 | 0 | } |
592 | |
|
593 | |
@Override |
594 | |
public void processAfterPost(MaintenanceDocument document, Map<String, String[]> requestParameters) { |
595 | |
|
596 | 0 | } |
597 | |
|
598 | |
@Override |
599 | |
public void setDataObject(Object object) { |
600 | 0 | super.setDataObject(object); |
601 | |
|
602 | 0 | if(object instanceof PersistableBusinessObject) { |
603 | 0 | this.businessObject = (PersistableBusinessObject)object; |
604 | |
} |
605 | 0 | } |
606 | |
|
607 | |
@Override |
608 | |
public String getDocumentTitle(MaintenanceDocument document) { |
609 | 0 | return super.getDocumentTitle((org.kuali.rice.krad.document.MaintenanceDocument) document); |
610 | |
} |
611 | |
|
612 | |
|
613 | |
|
614 | |
|
615 | |
public PersistableBusinessObject getBusinessObject() { |
616 | 0 | return businessObject; |
617 | |
} |
618 | |
|
619 | |
|
620 | |
|
621 | |
|
622 | |
|
623 | |
|
624 | |
public void setBusinessObject(PersistableBusinessObject businessObject) { |
625 | 0 | this.businessObject = businessObject; |
626 | 0 | setDataObject(businessObject); |
627 | 0 | } |
628 | |
|
629 | |
|
630 | |
|
631 | |
|
632 | |
public Class getBoClass() { |
633 | 0 | return super.getDataObjectClass(); |
634 | |
} |
635 | |
|
636 | |
|
637 | |
|
638 | |
|
639 | |
|
640 | |
public void setBoClass(Class boClass) { |
641 | 0 | setDataObjectClass(boClass); |
642 | 0 | } |
643 | |
|
644 | |
|
645 | |
|
646 | |
|
647 | |
|
648 | |
public void setGenerateDefaultValues(String docTypeName) { |
649 | 0 | List<MaintainableSectionDefinition> sectionDefinitions = getMaintenanceDocumentDictionaryService() |
650 | |
.getMaintainableSections(docTypeName); |
651 | 0 | Map defaultValues = new HashMap(); |
652 | |
|
653 | |
try { |
654 | |
|
655 | 0 | for (Iterator iter = sectionDefinitions.iterator(); iter.hasNext();) { |
656 | |
|
657 | 0 | MaintainableSectionDefinition maintSectionDef = (MaintainableSectionDefinition) iter.next(); |
658 | 0 | Collection maintItems = maintSectionDef.getMaintainableItems(); |
659 | 0 | for (Iterator iterator = maintItems.iterator(); iterator.hasNext();) { |
660 | 0 | MaintainableItemDefinition item = (MaintainableItemDefinition) iterator.next(); |
661 | |
|
662 | 0 | if (item instanceof MaintainableFieldDefinition) { |
663 | 0 | MaintainableFieldDefinition maintainableFieldDefinition = (MaintainableFieldDefinition) item; |
664 | |
|
665 | 0 | String defaultValue = maintainableFieldDefinition.getDefaultValue(); |
666 | 0 | if (defaultValue != null) { |
667 | 0 | if (defaultValue.equals("true")) { |
668 | 0 | defaultValue = "Yes"; |
669 | |
} |
670 | 0 | else if (defaultValue.equals("false")) { |
671 | 0 | defaultValue = "No"; |
672 | |
} |
673 | |
} |
674 | |
|
675 | 0 | Class defaultValueFinderClass = maintainableFieldDefinition.getDefaultValueFinderClass(); |
676 | 0 | if (defaultValueFinderClass != null) { |
677 | 0 | defaultValue = ((ValueFinder) defaultValueFinderClass.newInstance()).getValue(); |
678 | |
|
679 | |
} |
680 | 0 | if (defaultValue != null) { |
681 | 0 | defaultValues.put(item.getName(), defaultValue); |
682 | |
} |
683 | |
} |
684 | 0 | } |
685 | 0 | } |
686 | 0 | Map cachedValues = FieldUtils.populateBusinessObjectFromMap(getBusinessObject(), defaultValues); |
687 | |
} |
688 | 0 | catch (Exception e) { |
689 | 0 | LOG.error("Unable to set default value " + e.getMessage(), e); |
690 | 0 | throw new RuntimeException("Unable to set default value" + e.getMessage(), e); |
691 | 0 | } |
692 | |
|
693 | 0 | } |
694 | |
|
695 | |
|
696 | |
|
697 | |
|
698 | |
|
699 | |
public void setGenerateBlankRequiredValues(String docTypeName) { |
700 | |
try { |
701 | 0 | List<MaintainableSectionDefinition> sectionDefinitions = getMaintenanceDocumentDictionaryService() |
702 | |
.getMaintainableSections(docTypeName); |
703 | 0 | Map<String, String> defaultValues = new HashMap<String, String>(); |
704 | |
|
705 | 0 | for (MaintainableSectionDefinition maintSectionDef : sectionDefinitions) { |
706 | 0 | for (MaintainableItemDefinition item : maintSectionDef.getMaintainableItems()) { |
707 | 0 | if (item instanceof MaintainableFieldDefinition) { |
708 | 0 | MaintainableFieldDefinition maintainableFieldDefinition = (MaintainableFieldDefinition) item; |
709 | 0 | if (maintainableFieldDefinition.isRequired() |
710 | |
&& maintainableFieldDefinition.isUnconditionallyReadOnly()) { |
711 | 0 | Object currPropVal = ObjectUtils.getPropertyValue(this.getBusinessObject(), item.getName()); |
712 | 0 | if (currPropVal == null |
713 | |
|| (currPropVal instanceof String && StringUtils.isBlank((String) currPropVal))) { |
714 | 0 | Class<? extends ValueFinder> defaultValueFinderClass = maintainableFieldDefinition |
715 | |
.getDefaultValueFinderClass(); |
716 | 0 | if (defaultValueFinderClass != null) { |
717 | 0 | String defaultValue = defaultValueFinderClass.newInstance().getValue(); |
718 | 0 | if (defaultValue != null) { |
719 | 0 | defaultValues.put(item.getName(), defaultValue); |
720 | |
} |
721 | |
} |
722 | |
} |
723 | |
} |
724 | 0 | } |
725 | |
} |
726 | |
} |
727 | 0 | FieldUtils.populateBusinessObjectFromMap(getBusinessObject(), defaultValues); |
728 | |
} |
729 | 0 | catch (Exception e) { |
730 | 0 | LOG.error("Unable to set blank required value " + e.getMessage(), e); |
731 | 0 | throw new RuntimeException("Unable to set blank required value" + e.getMessage(), e); |
732 | 0 | } |
733 | 0 | } |
734 | |
|
735 | |
@Deprecated |
736 | |
public void processAfterAddLine(String colName, Class colClass) { |
737 | 0 | } |
738 | |
|
739 | |
|
740 | |
|
741 | |
|
742 | |
|
743 | |
public void processBeforeAddLine(String colName, Class colClass, BusinessObject addBO) { |
744 | 0 | } |
745 | |
|
746 | |
|
747 | |
|
748 | |
|
749 | |
public boolean getShowInactiveRecords(String collectionName) { |
750 | 0 | return InactiveRecordsHidingUtils.getShowInactiveRecords(inactiveRecordDisplay, collectionName); |
751 | |
} |
752 | |
|
753 | |
|
754 | |
|
755 | |
|
756 | |
|
757 | |
public void setShowInactiveRecords(String collectionName, boolean showInactive) { |
758 | 0 | InactiveRecordsHidingUtils.setShowInactiveRecords(inactiveRecordDisplay, collectionName, showInactive); |
759 | 0 | } |
760 | |
|
761 | |
|
762 | |
|
763 | |
|
764 | |
public Map<String, Boolean> getInactiveRecordDisplay() { |
765 | 0 | return inactiveRecordDisplay; |
766 | |
} |
767 | |
|
768 | |
public void addNewLineToCollection(String collectionName) { |
769 | |
|
770 | 0 | if (LOG.isDebugEnabled()) { |
771 | 0 | LOG.debug("addNewLineToCollection( " + collectionName + " )"); |
772 | |
} |
773 | |
|
774 | 0 | PersistableBusinessObject addLine = newCollectionLines.get(collectionName); |
775 | 0 | if (addLine != null) { |
776 | |
|
777 | |
|
778 | 0 | addLine.setNewCollectionRecord(true); |
779 | |
|
780 | |
|
781 | |
|
782 | |
|
783 | |
|
784 | 0 | Collection maintCollection = (Collection) ObjectUtils.getPropertyValue(getBusinessObject(), collectionName); |
785 | |
|
786 | 0 | maintCollection.add(addLine); |
787 | |
|
788 | |
|
789 | |
|
790 | 0 | String referencesToRefresh = LookupUtils |
791 | |
.convertReferencesToSelectCollectionToString(getAllRefreshableReferences(getBusinessObject() |
792 | |
.getClass())); |
793 | 0 | if (LOG.isInfoEnabled()) { |
794 | 0 | LOG.info("References to refresh for adding line to collection " + collectionName + ": " |
795 | |
+ referencesToRefresh); |
796 | |
} |
797 | 0 | refreshReferences(referencesToRefresh); |
798 | |
} |
799 | |
|
800 | 0 | initNewCollectionLine(collectionName); |
801 | |
|
802 | 0 | } |
803 | |
|
804 | |
public PersistableBusinessObject getNewCollectionLine(String collectionName) { |
805 | 0 | if (LOG.isDebugEnabled()) { |
806 | |
|
807 | |
|
808 | 0 | LOG.debug("newCollectionLines: " + newCollectionLines); |
809 | |
} |
810 | 0 | PersistableBusinessObject addLine = newCollectionLines.get(collectionName); |
811 | 0 | if (addLine == null) { |
812 | 0 | addLine = initNewCollectionLine(collectionName); |
813 | |
} |
814 | 0 | return addLine; |
815 | |
} |
816 | |
|
817 | |
public PersistableBusinessObject initNewCollectionLine(String collectionName) { |
818 | 0 | if (LOG.isDebugEnabled()) { |
819 | 0 | LOG.debug("initNewCollectionLine( " + collectionName + " )"); |
820 | |
} |
821 | |
|
822 | |
|
823 | |
|
824 | |
|
825 | |
PersistableBusinessObject addLine; |
826 | |
try { |
827 | 0 | addLine = (PersistableBusinessObject) getMaintenanceDocumentDictionaryService() |
828 | |
.getCollectionBusinessObjectClass(getDocumentTypeName(), collectionName).newInstance(); |
829 | |
} |
830 | 0 | catch (Exception ex) { |
831 | 0 | LOG.error("unable to instantiate new collection line", ex); |
832 | 0 | throw new RuntimeException("unable to instantiate new collection line", ex); |
833 | 0 | } |
834 | |
|
835 | 0 | newCollectionLines.put(collectionName, addLine); |
836 | |
|
837 | |
|
838 | 0 | setNewCollectionLineDefaultValues(collectionName, addLine); |
839 | 0 | return addLine; |
840 | |
} |
841 | |
|
842 | |
|
843 | |
|
844 | |
|
845 | |
|
846 | |
public Map<String, String> populateNewCollectionLines(Map<String, String> fieldValues, |
847 | |
MaintenanceDocument maintenanceDocument, String methodToCall) { |
848 | 0 | if (LOG.isDebugEnabled()) { |
849 | 0 | LOG.debug("populateNewCollectionLines: " + fieldValues); |
850 | |
} |
851 | 0 | fieldValues = decryptEncryptedData(fieldValues, maintenanceDocument, methodToCall); |
852 | |
|
853 | 0 | Map<String, String> cachedValues = new HashMap<String, String>(); |
854 | |
|
855 | |
|
856 | 0 | List<MaintainableCollectionDefinition> collections = getMaintenanceDocumentDictionaryService() |
857 | |
.getMaintainableCollections(getDocumentTypeName()); |
858 | |
|
859 | 0 | for (MaintainableCollectionDefinition coll : collections) { |
860 | |
|
861 | 0 | String collName = coll.getName(); |
862 | 0 | if (LOG.isDebugEnabled()) { |
863 | 0 | LOG.debug("checking for collection: " + collName); |
864 | |
} |
865 | |
|
866 | 0 | Map<String, String> collectionValues = new HashMap<String, String>(); |
867 | 0 | Map<String, String> subCollectionValues = new HashMap<String, String>(); |
868 | |
|
869 | |
|
870 | 0 | for (Map.Entry<String, String> entry : fieldValues.entrySet()) { |
871 | 0 | String key = entry.getKey(); |
872 | 0 | if (key.startsWith(collName)) { |
873 | 0 | String subStrKey = key.substring(collName.length() + 1); |
874 | |
|
875 | |
|
876 | |
|
877 | 0 | if (key.contains("[")) { |
878 | |
|
879 | |
|
880 | |
|
881 | |
|
882 | 0 | subCollectionValues.put(key, entry.getValue()); |
883 | |
} |
884 | |
else { |
885 | 0 | collectionValues.put(subStrKey, entry.getValue()); |
886 | |
} |
887 | |
} |
888 | 0 | } |
889 | |
|
890 | 0 | if (LOG.isDebugEnabled()) { |
891 | 0 | LOG.debug("values for collection: " + collectionValues); |
892 | |
} |
893 | 0 | cachedValues.putAll(FieldUtils.populateBusinessObjectFromMap(getNewCollectionLine(collName), |
894 | |
collectionValues, KRADConstants.MAINTENANCE_ADD_PREFIX + collName + ".")); |
895 | 0 | performFieldForceUpperCase(getNewCollectionLine(collName), collectionValues); |
896 | |
|
897 | 0 | cachedValues.putAll(populateNewSubCollectionLines(coll, subCollectionValues)); |
898 | 0 | } |
899 | |
|
900 | |
|
901 | 0 | return cachedValues; |
902 | |
} |
903 | |
|
904 | |
|
905 | |
|
906 | |
|
907 | |
|
908 | |
|
909 | |
protected Map populateNewSubCollectionLines(MaintainableCollectionDefinition parentCollection, Map fieldValues) { |
910 | 0 | if (LOG.isDebugEnabled()) { |
911 | 0 | LOG.debug("populateNewSubCollectionLines: " + fieldValues); |
912 | |
} |
913 | 0 | Map cachedValues = new HashMap(); |
914 | |
|
915 | 0 | for (MaintainableCollectionDefinition coll : parentCollection.getMaintainableCollections()) { |
916 | |
|
917 | 0 | String collName = coll.getName(); |
918 | |
|
919 | 0 | if (LOG.isDebugEnabled()) { |
920 | 0 | LOG.debug("checking for sub collection: " + collName); |
921 | |
} |
922 | 0 | Map<String, String> parents = new HashMap<String, String>(); |
923 | |
|
924 | 0 | for (Object entry : fieldValues.entrySet()) { |
925 | 0 | String key = (String) ((Map.Entry) entry).getKey(); |
926 | 0 | if (key.contains(collName)) { |
927 | 0 | parents.put(StringUtils.substringBefore(key, "."), ""); |
928 | |
} |
929 | 0 | } |
930 | |
|
931 | 0 | for (String parent : parents.keySet()) { |
932 | |
|
933 | 0 | Map<String, Object> collectionValues = new HashMap<String, Object>(); |
934 | |
|
935 | |
|
936 | 0 | for (Object entry : fieldValues.entrySet()) { |
937 | 0 | String key = (String) ((Map.Entry) entry).getKey(); |
938 | 0 | if (key.contains(parent)) { |
939 | 0 | String substr = StringUtils.substringAfterLast(key, "."); |
940 | 0 | collectionValues.put(substr, ((Map.Entry) entry).getValue()); |
941 | |
} |
942 | 0 | } |
943 | |
|
944 | 0 | if (LOG.isDebugEnabled()) { |
945 | 0 | LOG.debug("values for sub collection: " + collectionValues); |
946 | |
} |
947 | 0 | GlobalVariables.getMessageMap().addToErrorPath( |
948 | |
KRADConstants.MAINTENANCE_ADD_PREFIX + parent + "." + collName); |
949 | 0 | cachedValues.putAll(FieldUtils.populateBusinessObjectFromMap(getNewCollectionLine(parent + "." |
950 | |
+ collName), collectionValues, KRADConstants.MAINTENANCE_ADD_PREFIX + parent + "." + collName |
951 | |
+ ".")); |
952 | 0 | performFieldForceUpperCase(getNewCollectionLine(parent + "." + collName), collectionValues); |
953 | 0 | GlobalVariables.getMessageMap().removeFromErrorPath( |
954 | |
KRADConstants.MAINTENANCE_ADD_PREFIX + parent + "." + collName); |
955 | 0 | } |
956 | |
|
957 | 0 | cachedValues.putAll(populateNewSubCollectionLines(coll, fieldValues)); |
958 | 0 | } |
959 | |
|
960 | 0 | return cachedValues; |
961 | |
} |
962 | |
|
963 | |
public Collection<String> getAffectedReferencesFromLookup(BusinessObject baseBO, String attributeName, |
964 | |
String collectionPrefix) { |
965 | 0 | PersistenceStructureService pss = getPersistenceStructureService(); |
966 | 0 | String nestedBOPrefix = ""; |
967 | 0 | if (ObjectUtils.isNestedAttribute(attributeName)) { |
968 | |
|
969 | |
|
970 | 0 | nestedBOPrefix = ObjectUtils.getNestedAttributePrefix(attributeName); |
971 | |
|
972 | |
|
973 | |
|
974 | 0 | Class reference = ObjectUtils.getPropertyType(baseBO, nestedBOPrefix, pss); |
975 | 0 | if (!(PersistableBusinessObject.class.isAssignableFrom(reference))) { |
976 | 0 | return new ArrayList<String>(); |
977 | |
} |
978 | |
|
979 | |
try { |
980 | 0 | baseBO = (PersistableBusinessObject) reference.newInstance(); |
981 | |
} |
982 | 0 | catch (InstantiationException e) { |
983 | 0 | LOG.error(e); |
984 | |
} |
985 | 0 | catch (IllegalAccessException e) { |
986 | 0 | LOG.error(e); |
987 | 0 | } |
988 | 0 | attributeName = ObjectUtils.getNestedAttributePrimitive(attributeName); |
989 | |
} |
990 | |
|
991 | 0 | if (baseBO == null) { |
992 | 0 | return new ArrayList<String>(); |
993 | |
} |
994 | |
|
995 | 0 | Map<String, Class> referenceNameToClassFromPSS = LookupUtils.getPrimitiveReference(baseBO, attributeName); |
996 | 0 | if (referenceNameToClassFromPSS.size() > 1) { |
997 | 0 | LOG.error("LookupUtils.getPrimitiveReference return results should only have at most one element"); |
998 | |
} |
999 | |
|
1000 | 0 | BusinessObjectMetaDataService businessObjectMetaDataService = getBusinessObjectMetaDataService(); |
1001 | 0 | DataObjectRelationship relationship = businessObjectMetaDataService.getBusinessObjectRelationship(baseBO, |
1002 | |
attributeName); |
1003 | 0 | if (relationship == null) { |
1004 | 0 | return new ArrayList<String>(); |
1005 | |
} |
1006 | |
|
1007 | 0 | Map<String, String> fkToPkMappings = relationship.getParentToChildReferences(); |
1008 | |
|
1009 | 0 | Collection<String> affectedReferences = generateAllAffectedReferences(baseBO.getClass(), fkToPkMappings, |
1010 | |
nestedBOPrefix, collectionPrefix); |
1011 | 0 | if (LOG.isDebugEnabled()) { |
1012 | 0 | LOG.debug("References affected by a lookup on BO attribute \"" + collectionPrefix + nestedBOPrefix + "." |
1013 | |
+ attributeName + ": " + affectedReferences); |
1014 | |
} |
1015 | |
|
1016 | 0 | return affectedReferences; |
1017 | |
} |
1018 | |
|
1019 | |
protected boolean isRelationshipRefreshable(Class boClass, String relationshipName) { |
1020 | 0 | if (getPersistenceStructureService().isPersistable(boClass)) { |
1021 | 0 | if (getPersistenceStructureService().hasCollection(boClass, relationshipName)) { |
1022 | 0 | return !getPersistenceStructureService().isCollectionUpdatable(boClass, relationshipName); |
1023 | |
} |
1024 | 0 | else if (getPersistenceStructureService().hasReference(boClass, relationshipName)) { |
1025 | 0 | return !getPersistenceStructureService().isReferenceUpdatable(boClass, relationshipName); |
1026 | |
} |
1027 | |
|
1028 | |
} |
1029 | |
|
1030 | 0 | return true; |
1031 | |
} |
1032 | |
|
1033 | |
protected Collection<String> generateAllAffectedReferences(Class boClass, Map<String, String> fkToPkMappings, |
1034 | |
String nestedBOPrefix, String collectionPrefix) { |
1035 | 0 | Set<String> allAffectedReferences = new HashSet<String>(); |
1036 | 0 | DataDictionaryService dataDictionaryService = getDataDictionaryService(); |
1037 | 0 | PersistenceStructureService pss = getPersistenceStructureService(); |
1038 | |
|
1039 | 0 | collectionPrefix = StringUtils.isBlank(collectionPrefix) ? "" : collectionPrefix; |
1040 | |
|
1041 | |
|
1042 | |
|
1043 | 0 | Collection<String> attributeReferenceFKAttributes = fkToPkMappings.keySet(); |
1044 | |
|
1045 | |
|
1046 | |
|
1047 | |
|
1048 | |
|
1049 | |
|
1050 | |
|
1051 | |
|
1052 | 0 | for (String fkAttribute : attributeReferenceFKAttributes) { |
1053 | 0 | for (String affectedReference : pss.getReferencesForForeignKey(boClass, fkAttribute).keySet()) { |
1054 | 0 | if (isRelationshipRefreshable(boClass, affectedReference)) { |
1055 | 0 | if (StringUtils.isBlank(nestedBOPrefix)) { |
1056 | 0 | allAffectedReferences.add(collectionPrefix + affectedReference); |
1057 | |
} |
1058 | |
else { |
1059 | 0 | allAffectedReferences.add(collectionPrefix + nestedBOPrefix + "." + affectedReference); |
1060 | |
} |
1061 | |
} |
1062 | |
} |
1063 | |
} |
1064 | |
|
1065 | |
|
1066 | 0 | for (String collectionName : pss.listCollectionObjectTypes(boClass).keySet()) { |
1067 | 0 | if (isRelationshipRefreshable(boClass, collectionName)) { |
1068 | 0 | Map<String, String> keyMappingsForCollection = pss.getInverseForeignKeysForCollection(boClass, |
1069 | |
collectionName); |
1070 | 0 | for (String collectionForeignKey : keyMappingsForCollection.keySet()) { |
1071 | 0 | if (attributeReferenceFKAttributes.contains(collectionForeignKey)) { |
1072 | 0 | if (StringUtils.isBlank(nestedBOPrefix)) { |
1073 | 0 | allAffectedReferences.add(collectionPrefix + collectionName); |
1074 | |
} |
1075 | |
else { |
1076 | 0 | allAffectedReferences.add(collectionPrefix + nestedBOPrefix + "." + collectionName); |
1077 | |
} |
1078 | |
} |
1079 | |
} |
1080 | 0 | } |
1081 | |
} |
1082 | |
|
1083 | |
|
1084 | 0 | List<String> ddDefinedRelationships = dataDictionaryService.getRelationshipNames(boClass.getName()); |
1085 | 0 | for (String ddRelationship : ddDefinedRelationships) { |
1086 | |
|
1087 | 0 | Map<String, String> referencePKtoFKmappings = dataDictionaryService.getRelationshipAttributeMap( |
1088 | |
boClass.getName(), ddRelationship); |
1089 | 0 | for (String sourceAttribute : referencePKtoFKmappings.values()) { |
1090 | |
|
1091 | |
|
1092 | 0 | if (attributeReferenceFKAttributes.contains(sourceAttribute)) { |
1093 | 0 | for (String affectedReference : dataDictionaryService.getRelationshipEntriesForSourceAttribute( |
1094 | |
boClass.getName(), sourceAttribute)) { |
1095 | 0 | if (isRelationshipRefreshable(boClass, ddRelationship)) { |
1096 | 0 | if (StringUtils.isBlank(nestedBOPrefix)) { |
1097 | 0 | allAffectedReferences.add(affectedReference); |
1098 | |
} |
1099 | |
else { |
1100 | 0 | allAffectedReferences.add(nestedBOPrefix + "." + affectedReference); |
1101 | |
} |
1102 | |
} |
1103 | |
} |
1104 | |
} |
1105 | |
} |
1106 | 0 | } |
1107 | 0 | return allAffectedReferences; |
1108 | |
} |
1109 | |
|
1110 | |
protected Collection<String> getAllRefreshableReferences(Class boClass) { |
1111 | 0 | HashSet<String> references = new HashSet<String>(); |
1112 | 0 | for (String referenceName : getPersistenceStructureService().listReferenceObjectFields(boClass).keySet()) { |
1113 | 0 | if (isRelationshipRefreshable(boClass, referenceName)) { |
1114 | 0 | references.add(referenceName); |
1115 | |
} |
1116 | |
} |
1117 | 0 | for (String collectionName : getPersistenceStructureService().listCollectionObjectTypes(boClass).keySet()) { |
1118 | 0 | if (isRelationshipRefreshable(boClass, collectionName)) { |
1119 | 0 | references.add(collectionName); |
1120 | |
} |
1121 | |
} |
1122 | 0 | for (String relationshipName : getDataDictionaryService().getRelationshipNames(boClass.getName())) { |
1123 | 0 | if (isRelationshipRefreshable(boClass, relationshipName)) { |
1124 | 0 | references.add(relationshipName); |
1125 | |
} |
1126 | |
} |
1127 | 0 | return references; |
1128 | |
} |
1129 | |
|
1130 | |
protected void setNewCollectionLineDefaultValues(String collectionName, PersistableBusinessObject addLine) { |
1131 | 0 | PropertyDescriptor[] descriptors = PropertyUtils.getPropertyDescriptors(addLine); |
1132 | 0 | for (int i = 0; i < descriptors.length; ++i) { |
1133 | 0 | PropertyDescriptor propertyDescriptor = descriptors[i]; |
1134 | |
|
1135 | 0 | String fieldName = propertyDescriptor.getName(); |
1136 | 0 | Class propertyType = propertyDescriptor.getPropertyType(); |
1137 | 0 | String value = getMaintenanceDocumentDictionaryService().getCollectionFieldDefaultValue(getDocumentTypeName(), |
1138 | |
collectionName, fieldName); |
1139 | |
|
1140 | 0 | if (value != null) { |
1141 | |
try { |
1142 | 0 | ObjectUtils.setObjectProperty(addLine, fieldName, propertyType, value); |
1143 | |
} |
1144 | 0 | catch (Exception ex) { |
1145 | 0 | LOG.error("Unable to set default property of collection object: " + "\nobject: " + addLine |
1146 | |
+ "\nfieldName=" + fieldName + "\npropertyType=" + propertyType + "\nvalue=" + value, ex); |
1147 | 0 | } |
1148 | |
} |
1149 | |
|
1150 | |
} |
1151 | 0 | } |
1152 | |
|
1153 | |
|
1154 | |
|
1155 | |
|
1156 | |
public void clearBusinessObjectOfRestrictedValues(MaintenanceDocumentRestrictions maintenanceDocumentRestrictions) { |
1157 | 0 | List<MaintainableSectionDefinition> sections = getMaintenanceDocumentDictionaryService() |
1158 | |
.getMaintainableSections(getDocumentTypeName()); |
1159 | 0 | for (MaintainableSectionDefinition sectionDefinition : sections) { |
1160 | 0 | for (MaintainableItemDefinition itemDefinition : sectionDefinition.getMaintainableItems()) { |
1161 | 0 | if (itemDefinition instanceof MaintainableFieldDefinition) { |
1162 | 0 | clearFieldRestrictedValues("", businessObject, (MaintainableFieldDefinition) itemDefinition, |
1163 | |
maintenanceDocumentRestrictions); |
1164 | |
} |
1165 | 0 | else if (itemDefinition instanceof MaintainableCollectionDefinition) { |
1166 | 0 | clearCollectionRestrictedValues("", businessObject, |
1167 | |
(MaintainableCollectionDefinition) itemDefinition, maintenanceDocumentRestrictions); |
1168 | |
} |
1169 | |
} |
1170 | |
} |
1171 | 0 | } |
1172 | |
|
1173 | |
protected void clearCollectionRestrictedValues(String fieldNamePrefix, BusinessObject businessObject, |
1174 | |
MaintainableCollectionDefinition collectionDefinition, |
1175 | |
MaintenanceDocumentRestrictions maintenanceDocumentRestrictions) { |
1176 | 0 | String collectionName = fieldNamePrefix + collectionDefinition.getName(); |
1177 | 0 | Collection<BusinessObject> collection = (Collection<BusinessObject>) ObjectUtils.getPropertyValue( |
1178 | |
businessObject, collectionDefinition.getName()); |
1179 | |
|
1180 | 0 | if (collection != null) { |
1181 | 0 | int i = 0; |
1182 | |
|
1183 | |
|
1184 | 0 | for (BusinessObject collectionItem : collection) { |
1185 | 0 | String collectionItemNamePrefix = collectionName + "[" + i + "]."; |
1186 | 0 | for (MaintainableCollectionDefinition subCollectionDefinition : collectionDefinition |
1187 | |
.getMaintainableCollections()) { |
1188 | 0 | clearCollectionRestrictedValues(collectionItemNamePrefix, collectionItem, subCollectionDefinition, |
1189 | |
maintenanceDocumentRestrictions); |
1190 | |
} |
1191 | 0 | for (MaintainableFieldDefinition fieldDefinition : collectionDefinition.getMaintainableFields()) { |
1192 | 0 | clearFieldRestrictedValues(collectionItemNamePrefix, collectionItem, fieldDefinition, |
1193 | |
maintenanceDocumentRestrictions); |
1194 | |
} |
1195 | 0 | i++; |
1196 | 0 | } |
1197 | |
} |
1198 | 0 | } |
1199 | |
|
1200 | |
protected void clearFieldRestrictedValues(String fieldNamePrefix, BusinessObject businessObject, |
1201 | |
MaintainableFieldDefinition fieldDefinition, MaintenanceDocumentRestrictions maintenanceDocumentRestrictions) { |
1202 | 0 | String fieldName = fieldNamePrefix + fieldDefinition.getName(); |
1203 | |
|
1204 | 0 | FieldRestriction fieldRestriction = maintenanceDocumentRestrictions.getFieldRestriction(fieldName); |
1205 | 0 | if (fieldRestriction.isRestricted()) { |
1206 | 0 | String defaultValue = null; |
1207 | 0 | if (StringUtils.isNotBlank(fieldDefinition.getDefaultValue())) { |
1208 | 0 | defaultValue = fieldDefinition.getDefaultValue(); |
1209 | |
} |
1210 | 0 | else if (fieldDefinition.getDefaultValueFinderClass() != null) { |
1211 | |
try { |
1212 | 0 | defaultValue = ((ValueFinder) fieldDefinition.getDefaultValueFinderClass().newInstance()) |
1213 | |
.getValue(); |
1214 | |
} |
1215 | 0 | catch (Exception e) { |
1216 | 0 | defaultValue = null; |
1217 | 0 | LOG.error("Error trying to instantiate ValueFinder or to determine ValueFinder for doc type: " |
1218 | |
+ getDocumentTypeName() + " field name " + fieldDefinition.getName() + " with field prefix: " |
1219 | |
+ fieldNamePrefix, e); |
1220 | 0 | } |
1221 | |
} |
1222 | |
try { |
1223 | 0 | ObjectUtils.setObjectProperty(businessObject, fieldDefinition.getName(), defaultValue); |
1224 | |
} |
1225 | 0 | catch (Exception e) { |
1226 | |
|
1227 | |
|
1228 | 0 | LOG.error("Unable to clear maintenance document values for field name: " + fieldName |
1229 | |
+ " default value: " + defaultValue, e); |
1230 | 0 | throw new RuntimeException("Unable to clear maintenance document values for field name: " + fieldName, |
1231 | |
e); |
1232 | 0 | } |
1233 | |
} |
1234 | 0 | } |
1235 | |
|
1236 | |
protected void performForceUpperCase(Map fieldValues) { |
1237 | 0 | List<MaintainableSectionDefinition> sections = getMaintenanceDocumentDictionaryService() |
1238 | |
.getMaintainableSections(getDocumentTypeName()); |
1239 | 0 | for (MaintainableSectionDefinition sectionDefinition : sections) { |
1240 | 0 | for (MaintainableItemDefinition itemDefinition : sectionDefinition.getMaintainableItems()) { |
1241 | 0 | if (itemDefinition instanceof MaintainableFieldDefinition) { |
1242 | 0 | performFieldForceUpperCase("", businessObject, (MaintainableFieldDefinition) itemDefinition, |
1243 | |
fieldValues); |
1244 | |
} |
1245 | 0 | else if (itemDefinition instanceof MaintainableCollectionDefinition) { |
1246 | 0 | performCollectionForceUpperCase("", businessObject, |
1247 | |
(MaintainableCollectionDefinition) itemDefinition, fieldValues); |
1248 | |
|
1249 | |
} |
1250 | |
} |
1251 | |
} |
1252 | 0 | } |
1253 | |
|
1254 | |
protected void performFieldForceUpperCase(String fieldNamePrefix, BusinessObject bo, |
1255 | |
MaintainableFieldDefinition fieldDefinition, Map fieldValues) { |
1256 | 0 | MessageMap errorMap = GlobalVariables.getMessageMap(); |
1257 | 0 | String fieldName = fieldDefinition.getName(); |
1258 | 0 | String mapKey = fieldNamePrefix + fieldName; |
1259 | 0 | if (fieldValues != null && fieldValues.get(mapKey) != null) { |
1260 | 0 | if (PropertyUtils.isWriteable(bo, fieldName) && ObjectUtils.getNestedValue(bo, fieldName) != null) { |
1261 | |
|
1262 | |
try { |
1263 | 0 | Class type = ObjectUtils.easyGetPropertyType(bo, fieldName); |
1264 | |
|
1265 | 0 | Class businessObjectClass = bo.getClass(); |
1266 | 0 | boolean upperCase = false; |
1267 | |
try { |
1268 | 0 | upperCase = getDataDictionaryService().getAttributeForceUppercase(businessObjectClass, |
1269 | |
fieldName); |
1270 | |
} |
1271 | 0 | catch (UnknownBusinessClassAttributeException t) { |
1272 | 0 | boolean catchme = true; |
1273 | |
|
1274 | 0 | } |
1275 | |
|
1276 | 0 | Object fieldValue = ObjectUtils.getNestedValue(bo, fieldName); |
1277 | |
|
1278 | 0 | if (upperCase && fieldValue instanceof String) { |
1279 | 0 | fieldValue = ((String) fieldValue).toUpperCase(); |
1280 | |
} |
1281 | 0 | ObjectUtils.setObjectProperty(bo, fieldName, type, fieldValue); |
1282 | |
} |
1283 | 0 | catch (FormatException e) { |
1284 | 0 | errorMap.putError(fieldName, e.getErrorKey(), e.getErrorArgs()); |
1285 | |
} |
1286 | 0 | catch (IllegalAccessException e) { |
1287 | 0 | LOG.error("unable to populate business object" + e.getMessage()); |
1288 | 0 | throw new RuntimeException(e.getMessage(), e); |
1289 | |
} |
1290 | 0 | catch (InvocationTargetException e) { |
1291 | 0 | LOG.error("unable to populate business object" + e.getMessage()); |
1292 | 0 | throw new RuntimeException(e.getMessage(), e); |
1293 | |
} |
1294 | 0 | catch (NoSuchMethodException e) { |
1295 | 0 | LOG.error("unable to populate business object" + e.getMessage()); |
1296 | 0 | throw new RuntimeException(e.getMessage(), e); |
1297 | 0 | } |
1298 | |
} |
1299 | |
} |
1300 | 0 | } |
1301 | |
|
1302 | |
protected void performCollectionForceUpperCase(String fieldNamePrefix, BusinessObject bo, |
1303 | |
MaintainableCollectionDefinition collectionDefinition, Map fieldValues) { |
1304 | 0 | String collectionName = fieldNamePrefix + collectionDefinition.getName(); |
1305 | 0 | Collection<BusinessObject> collection = (Collection<BusinessObject>) ObjectUtils.getPropertyValue(bo, |
1306 | |
collectionDefinition.getName()); |
1307 | 0 | if (collection != null) { |
1308 | 0 | int i = 0; |
1309 | |
|
1310 | |
|
1311 | 0 | for (BusinessObject collectionItem : collection) { |
1312 | 0 | String collectionItemNamePrefix = collectionName + "[" + i + "]."; |
1313 | |
|
1314 | 0 | for (MaintainableFieldDefinition fieldDefinition : collectionDefinition.getMaintainableFields()) { |
1315 | 0 | performFieldForceUpperCase(collectionItemNamePrefix, collectionItem, fieldDefinition, fieldValues); |
1316 | |
} |
1317 | 0 | for (MaintainableCollectionDefinition subCollectionDefinition : collectionDefinition |
1318 | |
.getMaintainableCollections()) { |
1319 | 0 | performCollectionForceUpperCase(collectionItemNamePrefix, collectionItem, subCollectionDefinition, |
1320 | |
fieldValues); |
1321 | |
} |
1322 | 0 | i++; |
1323 | 0 | } |
1324 | |
} |
1325 | 0 | } |
1326 | |
|
1327 | |
protected void performFieldForceUpperCase(BusinessObject bo, Map fieldValues) { |
1328 | 0 | MessageMap errorMap = GlobalVariables.getMessageMap(); |
1329 | |
|
1330 | |
try { |
1331 | 0 | for (Iterator iter = fieldValues.keySet().iterator(); iter.hasNext();) { |
1332 | 0 | String propertyName = (String) iter.next(); |
1333 | |
|
1334 | 0 | if (PropertyUtils.isWriteable(bo, propertyName) && fieldValues.get(propertyName) != null) { |
1335 | |
|
1336 | |
|
1337 | 0 | Class type = ObjectUtils.easyGetPropertyType(bo, propertyName); |
1338 | |
try { |
1339 | |
|
1340 | |
|
1341 | |
|
1342 | |
|
1343 | 0 | Class businessObjectClass = bo.getClass(); |
1344 | 0 | boolean upperCase = false; |
1345 | |
try { |
1346 | 0 | upperCase = getDataDictionaryService().getAttributeForceUppercase(businessObjectClass, |
1347 | |
propertyName); |
1348 | |
} |
1349 | 0 | catch (UnknownBusinessClassAttributeException t) { |
1350 | 0 | boolean catchme = true; |
1351 | |
|
1352 | 0 | } |
1353 | |
|
1354 | 0 | Object fieldValue = fieldValues.get(propertyName); |
1355 | |
|
1356 | 0 | if (upperCase && fieldValue instanceof String) { |
1357 | 0 | fieldValue = ((String) fieldValue).toUpperCase(); |
1358 | |
} |
1359 | 0 | ObjectUtils.setObjectProperty(bo, propertyName, type, fieldValue); |
1360 | |
} |
1361 | 0 | catch (FormatException e) { |
1362 | 0 | errorMap.putError(propertyName, e.getErrorKey(), e.getErrorArgs()); |
1363 | 0 | } |
1364 | |
} |
1365 | 0 | } |
1366 | |
} |
1367 | 0 | catch (IllegalAccessException e) { |
1368 | 0 | LOG.error("unable to populate business object" + e.getMessage()); |
1369 | 0 | throw new RuntimeException(e.getMessage(), e); |
1370 | |
} |
1371 | 0 | catch (InvocationTargetException e) { |
1372 | 0 | LOG.error("unable to populate business object" + e.getMessage()); |
1373 | 0 | throw new RuntimeException(e.getMessage(), e); |
1374 | |
} |
1375 | 0 | catch (NoSuchMethodException e) { |
1376 | 0 | LOG.error("unable to populate business object" + e.getMessage()); |
1377 | 0 | throw new RuntimeException(e.getMessage(), e); |
1378 | 0 | } |
1379 | |
|
1380 | 0 | } |
1381 | |
|
1382 | |
|
1383 | |
|
1384 | |
|
1385 | |
|
1386 | |
|
1387 | |
public boolean isExternalBusinessObject() { |
1388 | 0 | return false; |
1389 | |
} |
1390 | |
|
1391 | |
|
1392 | |
|
1393 | |
|
1394 | |
public void prepareBusinessObject(BusinessObject businessObject) { |
1395 | |
|
1396 | 0 | } |
1397 | |
|
1398 | |
|
1399 | |
public void deleteBusinessObject() { |
1400 | 0 | if (businessObject == null) |
1401 | 0 | return; |
1402 | |
|
1403 | 0 | KRADServiceLocator.getBusinessObjectService().delete(businessObject); |
1404 | 0 | businessObject = null; |
1405 | 0 | } |
1406 | |
|
1407 | |
public boolean isOldBusinessObjectInDocument() { |
1408 | 0 | return super.isOldDataObjectInDocument(); |
1409 | |
} |
1410 | |
|
1411 | |
protected PersistenceStructureService getPersistenceStructureService() { |
1412 | 0 | if (persistenceStructureService == null) { |
1413 | 0 | persistenceStructureService = KRADServiceLocator.getPersistenceStructureService(); |
1414 | |
} |
1415 | 0 | return persistenceStructureService; |
1416 | |
} |
1417 | |
|
1418 | |
protected BusinessObjectDictionaryService getBusinessObjectDictionaryService() { |
1419 | 0 | if (businessObjectDictionaryService == null) { |
1420 | 0 | businessObjectDictionaryService = KRADServiceLocatorWeb.getBusinessObjectDictionaryService(); |
1421 | |
} |
1422 | 0 | return businessObjectDictionaryService; |
1423 | |
} |
1424 | |
|
1425 | |
protected org.kuali.rice.kim.service.PersonService getPersonService() { |
1426 | 0 | if (personService == null) { |
1427 | 0 | personService = KimApiServiceLocator.getPersonService(); |
1428 | |
} |
1429 | 0 | return personService; |
1430 | |
} |
1431 | |
|
1432 | |
protected BusinessObjectMetaDataService getBusinessObjectMetaDataService() { |
1433 | 0 | if (businessObjectMetaDataService == null) { |
1434 | 0 | businessObjectMetaDataService = KNSServiceLocator.getBusinessObjectMetaDataService(); |
1435 | |
} |
1436 | 0 | return businessObjectMetaDataService; |
1437 | |
} |
1438 | |
|
1439 | |
protected BusinessObjectAuthorizationService getBusinessObjectAuthorizationService() { |
1440 | 0 | if (businessObjectAuthorizationService == null) { |
1441 | 0 | businessObjectAuthorizationService = KNSServiceLocator.getBusinessObjectAuthorizationService(); |
1442 | |
} |
1443 | 0 | return businessObjectAuthorizationService; |
1444 | |
} |
1445 | |
|
1446 | |
protected DocumentHelperService getDocumentHelperService() { |
1447 | 0 | if (documentHelperService == null) { |
1448 | 0 | documentHelperService = KRADServiceLocatorWeb.getDocumentHelperService(); |
1449 | |
} |
1450 | 0 | return documentHelperService; |
1451 | |
} |
1452 | |
|
1453 | |
public void setPersistenceStructureService(PersistenceStructureService persistenceStructureService) { |
1454 | 0 | this.persistenceStructureService = persistenceStructureService; |
1455 | 0 | } |
1456 | |
|
1457 | |
public void setBusinessObjectDictionaryService(BusinessObjectDictionaryService businessObjectDictionaryService) { |
1458 | 0 | this.businessObjectDictionaryService = businessObjectDictionaryService; |
1459 | 0 | } |
1460 | |
|
1461 | |
public void setPersonService(org.kuali.rice.kim.service.PersonService personService) { |
1462 | 0 | this.personService = personService; |
1463 | 0 | } |
1464 | |
|
1465 | |
public void setBusinessObjectMetaDataService(BusinessObjectMetaDataService businessObjectMetaDataService) { |
1466 | 0 | this.businessObjectMetaDataService = businessObjectMetaDataService; |
1467 | 0 | } |
1468 | |
|
1469 | |
public void setBusinessObjectAuthorizationService( |
1470 | |
BusinessObjectAuthorizationService businessObjectAuthorizationService) { |
1471 | 0 | this.businessObjectAuthorizationService = businessObjectAuthorizationService; |
1472 | 0 | } |
1473 | |
|
1474 | |
public void setDocumentHelperService(DocumentHelperService documentHelperService) { |
1475 | 0 | this.documentHelperService = documentHelperService; |
1476 | 0 | } |
1477 | |
|
1478 | |
public MaintenanceDocumentDictionaryService getMaintenanceDocumentDictionaryService() { |
1479 | 0 | if (maintenanceDocumentDictionaryService == null) { |
1480 | 0 | this.maintenanceDocumentDictionaryService = KNSServiceLocator.getMaintenanceDocumentDictionaryService(); |
1481 | |
} |
1482 | 0 | return maintenanceDocumentDictionaryService; |
1483 | |
} |
1484 | |
|
1485 | |
public void setMaintenanceDocumentDictionaryService( |
1486 | |
MaintenanceDocumentDictionaryService maintenanceDocumentDictionaryService) { |
1487 | 0 | this.maintenanceDocumentDictionaryService = maintenanceDocumentDictionaryService; |
1488 | 0 | } |
1489 | |
} |