1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.util.documentserializer;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.krad.datadictionary.DataDictionary;
20 import org.kuali.rice.krad.datadictionary.DocumentEntry;
21 import org.kuali.rice.krad.datadictionary.WorkflowProperties;
22 import org.kuali.rice.krad.datadictionary.WorkflowProperty;
23 import org.kuali.rice.krad.datadictionary.WorkflowPropertyGroup;
24 import org.kuali.rice.krad.document.Document;
25 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
26
27 import java.util.List;
28
29
30
31
32
33
34
35
36
37 public class BusinessObjectPropertySerializibilityEvaluator extends PropertySerializabilityEvaluatorBase implements PropertySerializabilityEvaluator {
38
39
40
41
42
43
44 @Override
45 public void initializeEvaluatorForDocument(Document document) {
46 DataDictionary dictionary = KRADServiceLocatorWeb.getDataDictionaryService().getDataDictionary();
47 DocumentEntry docEntry = dictionary.getDocumentEntry(document.getDocumentHeader().getWorkflowDocument().getDocumentTypeName());
48 WorkflowProperties workflowProperties = docEntry.getWorkflowProperties();
49 List<WorkflowPropertyGroup> groups = workflowProperties.getWorkflowPropertyGroups();
50
51 serializableProperties = new PropertySerializerTrie();
52
53 for (WorkflowPropertyGroup group : groups) {
54
55 if (StringUtils.isEmpty(group.getBasePath())) {
56
57 serializableProperties.addSerializablePropertyName(document.getBasePathToDocumentDuringSerialization(), false);
58 }
59 else {
60 serializableProperties.addSerializablePropertyName(group.getBasePath(), false);
61 }
62
63 for (WorkflowProperty property : group.getWorkflowProperties()) {
64 String fullPath;
65 if (StringUtils.isEmpty(group.getBasePath())) {
66 fullPath = document.getBasePathToDocumentDuringSerialization() + "." + property.getPath();
67 }
68 else {
69 fullPath = group.getBasePath() + "." + property.getPath();
70 }
71 serializableProperties.addSerializablePropertyName(fullPath, false);
72 }
73 }
74 }
75
76 }