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