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