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