1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kns.datadictionary.exporter;
17
18 import org.kuali.rice.kew.api.KewApiServiceLocator;
19 import org.kuali.rice.kew.api.doctype.DocumentType;
20 import org.kuali.rice.kns.datadictionary.DocumentEntry;
21 import org.kuali.rice.krad.datadictionary.exporter.ExportMap;
22 import org.kuali.rice.krad.service.DocumentHelperService;
23 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
24
25
26
27
28
29
30 @Deprecated
31 public abstract class DocumentEntryMapper {
32
33 protected DocumentType getDocumentType(String documentTypeName) {
34 return KewApiServiceLocator.getDocumentTypeService().getDocumentTypeByName(documentTypeName);
35 }
36
37
38
39
40
41 @SuppressWarnings("unchecked")
42 protected ExportMap mapEntry(DocumentEntry entry) {
43 if (entry == null) {
44 throw new IllegalArgumentException("invalid (null) entry");
45 }
46
47
48 ExportMap entryMap = new ExportMap(entry.getJstlKey());
49
50 Class businessRulesClass = entry.getBusinessRulesClass();
51 if (businessRulesClass != null) {
52 entryMap.set("businessRulesClass", businessRulesClass.getName());
53 }
54
55 entryMap.set("documentTypeName", entry.getDocumentTypeName());
56
57 DocumentType docType = getDocumentType(entry.getDocumentTypeName());
58 entryMap.set("label", docType.getLabel());
59
60 if (docType.getDescription() != null) {
61 entryMap.set("description", docType.getDescription());
62 }
63
64 DocumentHelperService documentHelperService = KRADServiceLocatorWeb.getDocumentHelperService();
65 entryMap.set("documentAuthorizerClass", documentHelperService.getDocumentAuthorizer(entry.getDocumentTypeName()).getClass().getName());
66 entryMap.set("documentPresentationControllerClass", documentHelperService.getDocumentPresentationController(entry.getDocumentTypeName()).getClass().getName());
67
68 entryMap.set("allowsNoteAttachments", Boolean.toString(entry.getAllowsNoteAttachments()));
69
70 entryMap.set("allowsNoteFYI", Boolean.toString(entry.getAllowsNoteFYI()));
71
72 if (entry.getAttachmentTypesValuesFinderClass() != null) {
73 entryMap.set("attachmentTypesValuesFinderClass", entry.getAttachmentTypesValuesFinderClass().getName());
74 }
75
76 entryMap.set("displayTopicFieldInNotes", Boolean.toString(entry.getDisplayTopicFieldInNotes()));
77
78 entryMap.set("usePessimisticLocking", Boolean.toString(entry.getUsePessimisticLocking()));
79 entryMap.set("useWorkflowPessimisticLocking", Boolean.toString(entry.getUseWorkflowPessimisticLocking()));
80 entryMap.set("sessionDocument", Boolean.toString(entry.isSessionDocument()));
81
82 entryMap.set(new AttributesMapBuilder().buildAttributesMap(entry));
83 entryMap.set(new CollectionsMapBuilder().buildCollectionsMap(entry));
84
85 return entryMap;
86 }
87
88 }