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