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