1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kns.service.impl;
17
18 import org.apache.commons.collections.CollectionUtils;
19 import org.kuali.rice.kns.datadictionary.MaintainableSectionDefinition;
20 import org.kuali.rice.kns.util.documentserlializer.MaintenanceDocumentPropertySerializibilityEvaluator;
21 import org.kuali.rice.krad.datadictionary.MaintenanceDocumentEntry;
22 import org.kuali.rice.krad.service.BusinessObjectSerializerService;
23 import org.kuali.rice.krad.service.DocumentDictionaryService;
24 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
25 import org.kuali.rice.krad.service.impl.SerializerServiceBase;
26 import org.kuali.rice.krad.util.documentserializer.AlwaysTruePropertySerializibilityEvaluator;
27 import org.kuali.rice.krad.util.documentserializer.PropertySerializabilityEvaluator;
28
29 import java.util.List;
30
31
32
33
34
35
36 @Deprecated
37 public class BusinessObjectSerializerServiceImpl extends SerializerServiceBase implements BusinessObjectSerializerService {
38
39 private DocumentDictionaryService documentDictionaryService;
40
41 @Override
42 public PropertySerializabilityEvaluator getPropertySerizabilityEvaluator(Object businessObject) {
43 PropertySerializabilityEvaluator evaluator = null;
44
45 String docTypeName = getDocumentDictionaryService().getMaintenanceDocumentTypeName(businessObject.getClass());
46 MaintenanceDocumentEntry maintenanceDocumentEntry =
47 getDocumentDictionaryService().getMaintenanceDocumentEntry(docTypeName);
48
49 if (maintenanceDocumentEntry instanceof org.kuali.rice.kns.datadictionary.MaintenanceDocumentEntry) {
50 List<MaintainableSectionDefinition> maintainableSectionDefinitions =
51 ((org.kuali.rice.kns.datadictionary.MaintenanceDocumentEntry) maintenanceDocumentEntry).getMaintainableSections();
52 if (CollectionUtils.isEmpty(maintainableSectionDefinitions)) {
53 evaluator = new AlwaysTruePropertySerializibilityEvaluator();
54 } else {
55 evaluator = new MaintenanceDocumentPropertySerializibilityEvaluator();
56 evaluator.initializeEvaluatorForDataObject(businessObject);
57 }
58 }
59 else {
60 evaluator = new AlwaysTruePropertySerializibilityEvaluator();
61 }
62
63 return evaluator;
64 }
65
66 protected DocumentDictionaryService getDocumentDictionaryService() {
67 if (documentDictionaryService == null) {
68 this.documentDictionaryService = KRADServiceLocatorWeb.getDocumentDictionaryService();
69 }
70 return documentDictionaryService;
71 }
72
73 public void setDocumentDictionaryService(DocumentDictionaryService documentDictionaryService) {
74 this.documentDictionaryService = documentDictionaryService;
75 }
76 }