| 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.dto.DocumentTypeDTO; |
| 21 |
|
import org.kuali.rice.kew.exception.WorkflowException; |
| 22 |
|
import org.kuali.rice.kns.datadictionary.DataDictionary; |
| 23 |
|
import org.kuali.rice.kns.datadictionary.TransactionalDocumentEntry; |
| 24 |
|
import org.kuali.rice.kns.document.TransactionalDocument; |
| 25 |
|
import org.kuali.rice.kns.rule.BusinessRule; |
| 26 |
|
import org.kuali.rice.kns.service.DataDictionaryService; |
| 27 |
|
import org.kuali.rice.kns.service.KNSServiceLocatorWeb; |
| 28 |
|
import org.kuali.rice.kns.service.TransactionalDocumentDictionaryService; |
| 29 |
|
|
| 30 |
|
|
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
|
|
|
| 0% |
Uncovered Elements: 73 (73) |
Complexity: 21 |
Complexity Density: 0.47 |
|
| 34 |
|
public class TransactionalDocumentDictionaryServiceImpl implements TransactionalDocumentDictionaryService { |
| 35 |
|
private DataDictionaryService dataDictionaryService; |
| 36 |
|
|
| 37 |
|
|
| 38 |
|
@see |
| 39 |
|
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 40 |
0
|
public Boolean getAllowsCopy(TransactionalDocument document) {... |
| 41 |
0
|
Boolean allowsCopy = null; |
| 42 |
|
|
| 43 |
0
|
TransactionalDocumentEntry entry = getTransactionalDocumentEntry(document); |
| 44 |
0
|
if (entry != null) { |
| 45 |
0
|
allowsCopy = Boolean.valueOf(entry.getAllowsCopy()); |
| 46 |
|
} |
| 47 |
|
|
| 48 |
0
|
return allowsCopy; |
| 49 |
|
} |
| 50 |
|
|
| 51 |
|
|
| 52 |
|
@see |
| 53 |
|
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 54 |
0
|
public Class getDocumentClassByName(String documentTypeName) {... |
| 55 |
0
|
Class documentClass = null; |
| 56 |
|
|
| 57 |
0
|
TransactionalDocumentEntry entry = getTransactionalDocumentEntryBydocumentTypeName(documentTypeName); |
| 58 |
0
|
if (entry != null) { |
| 59 |
0
|
documentClass = entry.getDocumentClass(); |
| 60 |
|
} |
| 61 |
|
|
| 62 |
0
|
return documentClass; |
| 63 |
|
} |
| 64 |
|
|
| 65 |
|
|
| 66 |
|
@see |
| 67 |
|
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 68 |
0
|
public String getDescription(String transactionalDocumentTypeName) {... |
| 69 |
0
|
String description = null; |
| 70 |
|
|
| 71 |
0
|
DocumentTypeDTO docType = getDocumentType(transactionalDocumentTypeName); |
| 72 |
0
|
if (docType != null) { |
| 73 |
0
|
description = docType.getDocTypeDescription(); |
| 74 |
|
} |
| 75 |
|
|
| 76 |
0
|
return description; |
| 77 |
|
} |
| 78 |
|
|
| 79 |
|
|
| 80 |
|
@see |
| 81 |
|
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 82 |
0
|
public String getLabel(String transactionalDocumentTypeName) {... |
| 83 |
0
|
String label = null; |
| 84 |
|
|
| 85 |
0
|
DocumentTypeDTO docType = getDocumentType(transactionalDocumentTypeName); |
| 86 |
0
|
if (docType != null) { |
| 87 |
0
|
label = docType.getDocTypeLabel(); |
| 88 |
|
} |
| 89 |
|
|
| 90 |
0
|
return label; |
| 91 |
|
} |
| 92 |
|
|
| 93 |
|
|
| 94 |
|
@see |
| 95 |
|
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
| 96 |
0
|
public Class<? extends BusinessRule> getBusinessRulesClass(TransactionalDocument document) {... |
| 97 |
0
|
Class<? extends BusinessRule> businessRulesClass = null; |
| 98 |
|
|
| 99 |
|
|
| 100 |
0
|
String docTypeName = document.getDocumentHeader().getWorkflowDocument().getDocumentType(); |
| 101 |
0
|
TransactionalDocumentEntry entry = getTransactionalDocumentEntryBydocumentTypeName(docTypeName); |
| 102 |
0
|
if (entry != null) { |
| 103 |
0
|
businessRulesClass = entry.getBusinessRulesClass(); |
| 104 |
|
} |
| 105 |
|
|
| 106 |
0
|
return businessRulesClass; |
| 107 |
|
} |
| 108 |
|
|
| 109 |
|
|
| 110 |
|
|
| 111 |
|
|
| 112 |
|
@param |
| 113 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 114 |
0
|
public void setDataDictionaryService(DataDictionaryService dataDictionaryService) {... |
| 115 |
0
|
this.dataDictionaryService = dataDictionaryService; |
| 116 |
|
} |
| 117 |
|
|
| 118 |
|
|
| 119 |
|
|
| 120 |
|
|
| 121 |
|
@return |
| 122 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 123 |
0
|
public DataDictionary getDataDictionary() {... |
| 124 |
0
|
return this.dataDictionaryService.getDataDictionary(); |
| 125 |
|
} |
| 126 |
|
|
| 127 |
|
|
| 128 |
|
|
| 129 |
|
|
| 130 |
|
@param |
| 131 |
|
@return |
| 132 |
|
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 133 |
0
|
protected DocumentTypeDTO getDocumentType(String documentTypeName) {... |
| 134 |
0
|
try { |
| 135 |
0
|
return KNSServiceLocatorWeb.getWorkflowInfoService().getDocType(documentTypeName); |
| 136 |
|
} catch (WorkflowException e) { |
| 137 |
0
|
throw new RuntimeException("Caught exception attempting to get document type for doc type name '" + documentTypeName + "'", e); |
| 138 |
|
} |
| 139 |
|
} |
| 140 |
|
|
| 141 |
|
|
| 142 |
|
|
| 143 |
|
|
| 144 |
|
@param |
| 145 |
|
@return |
| 146 |
|
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 147 |
0
|
private TransactionalDocumentEntry getTransactionalDocumentEntry(TransactionalDocument document) {... |
| 148 |
0
|
if (document == null) { |
| 149 |
0
|
throw new IllegalArgumentException("invalid (null) document"); |
| 150 |
|
} |
| 151 |
|
|
| 152 |
0
|
TransactionalDocumentEntry entry = (TransactionalDocumentEntry)getDataDictionary().getDocumentEntry(document.getClass().getName()); |
| 153 |
|
|
| 154 |
0
|
return entry; |
| 155 |
|
} |
| 156 |
|
|
| 157 |
|
|
| 158 |
|
|
| 159 |
|
|
| 160 |
|
@param |
| 161 |
|
@return |
| 162 |
|
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 163 |
0
|
private TransactionalDocumentEntry getTransactionalDocumentEntryBydocumentTypeName(String documentTypeName) {... |
| 164 |
0
|
if (documentTypeName == null) { |
| 165 |
0
|
throw new IllegalArgumentException("invalid (null) document type name"); |
| 166 |
|
} |
| 167 |
|
|
| 168 |
0
|
TransactionalDocumentEntry entry = (TransactionalDocumentEntry) getDataDictionary().getDocumentEntry(documentTypeName); |
| 169 |
|
|
| 170 |
0
|
return entry; |
| 171 |
|
} |
| 172 |
|
|
| 173 |
|
|
| 174 |
|
|
| 175 |
|
|
| 176 |
|
@see |
| 177 |
|
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 178 |
0
|
public Collection getDefaultExistenceChecks(String docTypeName) {... |
| 179 |
0
|
Collection defaultExistenceChecks = null; |
| 180 |
|
|
| 181 |
0
|
TransactionalDocumentEntry entry = getTransactionalDocumentEntryBydocumentTypeName(docTypeName); |
| 182 |
0
|
if (entry != null) { |
| 183 |
0
|
defaultExistenceChecks = entry.getDefaultExistenceChecks(); |
| 184 |
|
} |
| 185 |
|
|
| 186 |
0
|
return defaultExistenceChecks; |
| 187 |
|
} |
| 188 |
|
|
| 189 |
|
|
| 190 |
|
|
| 191 |
|
|
| 192 |
|
@see |
| 193 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 194 |
0
|
public Collection getDefaultExistenceChecks(TransactionalDocument document) {... |
| 195 |
0
|
return getDefaultExistenceChecks(getTransactionalDocumentEntry(document).getDocumentTypeName()); |
| 196 |
|
} |
| 197 |
|
} |