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 java.util.Collection;
19
20 import org.kuali.rice.kew.api.KewApiServiceLocator;
21 import org.kuali.rice.kew.api.doctype.DocumentType;
22 import org.kuali.rice.kns.service.TransactionalDocumentDictionaryService;
23 import org.kuali.rice.krad.datadictionary.DataDictionary;
24 import org.kuali.rice.krad.datadictionary.TransactionalDocumentEntry;
25 import org.kuali.rice.krad.document.TransactionalDocument;
26 import org.kuali.rice.krad.rules.rule.BusinessRule;
27 import org.kuali.rice.krad.service.DataDictionaryService;
28
29
30
31
32
33 @Deprecated
34 public class TransactionalDocumentDictionaryServiceImpl implements TransactionalDocumentDictionaryService {
35 private DataDictionaryService dataDictionaryService;
36
37
38
39
40 public Boolean getAllowsCopy(TransactionalDocument document) {
41 Boolean allowsCopy = null;
42
43 TransactionalDocumentEntry entry = getTransactionalDocumentEntry(document);
44 if (entry != null) {
45 allowsCopy = Boolean.valueOf(entry.getAllowsCopy());
46 }
47
48 return allowsCopy;
49 }
50
51
52
53
54 public Class getDocumentClassByName(String documentTypeName) {
55 Class documentClass = null;
56
57 TransactionalDocumentEntry entry = getTransactionalDocumentEntryBydocumentTypeName(documentTypeName);
58 if (entry != null) {
59 documentClass = entry.getDocumentClass();
60 }
61
62 return documentClass;
63 }
64
65
66
67
68 public String getDescription(String transactionalDocumentTypeName) {
69 String description = null;
70
71 DocumentType docType = getDocumentType(transactionalDocumentTypeName);
72 if (docType != null) {
73 description = docType.getDescription();
74 }
75
76 return description;
77 }
78
79
80
81
82 public String getLabel(String transactionalDocumentTypeName) {
83 String label = null;
84
85 DocumentType docType = getDocumentType(transactionalDocumentTypeName);
86 if (docType != null) {
87 label = docType.getLabel();
88 }
89
90 return label;
91 }
92
93
94
95
96
97
98
99 public void setDataDictionaryService(DataDictionaryService dataDictionaryService) {
100 this.dataDictionaryService = dataDictionaryService;
101 }
102
103
104
105
106
107
108 public DataDictionary getDataDictionary() {
109 return this.dataDictionaryService.getDataDictionary();
110 }
111
112
113
114
115
116
117
118 protected DocumentType getDocumentType(String documentTypeName) {
119 return KewApiServiceLocator.getDocumentTypeService().getDocumentTypeByName(documentTypeName);
120 }
121
122
123
124
125
126
127
128 private TransactionalDocumentEntry getTransactionalDocumentEntry(TransactionalDocument document) {
129 if (document == null) {
130 throw new IllegalArgumentException("invalid (null) document");
131 }
132
133 TransactionalDocumentEntry entry = (TransactionalDocumentEntry)getDataDictionary().getDocumentEntry(document.getClass().getName());
134
135 return entry;
136 }
137
138
139
140
141
142
143
144 private TransactionalDocumentEntry getTransactionalDocumentEntryBydocumentTypeName(String documentTypeName) {
145 if (documentTypeName == null) {
146 throw new IllegalArgumentException("invalid (null) document type name");
147 }
148
149 TransactionalDocumentEntry entry = (TransactionalDocumentEntry) getDataDictionary().getDocumentEntry(documentTypeName);
150
151 return entry;
152 }
153
154
155
156
157
158
159 public Collection getDefaultExistenceChecks(String docTypeName) {
160 Collection defaultExistenceChecks = null;
161
162 TransactionalDocumentEntry entry = getTransactionalDocumentEntryBydocumentTypeName(docTypeName);
163 if (entry != null) {
164 defaultExistenceChecks = entry.getDefaultExistenceChecks();
165 }
166
167 return defaultExistenceChecks;
168 }
169
170
171
172
173
174
175 public Collection getDefaultExistenceChecks(TransactionalDocument document) {
176 return getDefaultExistenceChecks(getTransactionalDocumentEntry(document).getDocumentTypeName());
177 }
178 }