1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.kuali.rice.kew.service.impl; |
17 |
|
|
18 |
|
import org.kuali.rice.kew.docsearch.DocumentRouteHeaderEBO; |
19 |
|
import org.kuali.rice.kew.doctype.bo.DocumentTypeEBO; |
20 |
|
import org.kuali.rice.kew.doctype.service.DocumentTypeService; |
21 |
|
import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue; |
22 |
|
import org.kuali.rice.kew.service.KEWServiceLocator; |
23 |
|
import org.kuali.rice.kns.bo.ExternalizableBusinessObject; |
24 |
|
import org.kuali.rice.kns.service.impl.ModuleServiceBase; |
25 |
|
|
26 |
|
import java.sql.Timestamp; |
27 |
|
import java.util.ArrayList; |
28 |
|
import java.util.List; |
29 |
|
import java.util.Map; |
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
@author |
35 |
|
|
36 |
|
|
|
|
| 0% |
Uncovered Elements: 98 (98) |
Complexity: 33 |
Complexity Density: 0.61 |
|
37 |
|
public class KEWModuleService extends ModuleServiceBase { |
38 |
|
|
39 |
|
protected DocumentTypeService docTypeService = null; |
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
@see |
46 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 3 |
Complexity Density: 0.33 |
|
47 |
0
|
@Override... |
48 |
|
public List<String> listPrimaryKeyFieldNames(Class businessObjectInterfaceClass) { |
49 |
0
|
if ( DocumentTypeEBO.class.isAssignableFrom( businessObjectInterfaceClass ) ) { |
50 |
0
|
List<String> pkFields = new ArrayList<String>( 1 ); |
51 |
0
|
pkFields.add( "documentTypeId" ); |
52 |
0
|
return pkFields; |
53 |
0
|
}else if(DocumentRouteHeaderEBO.class.isAssignableFrom( businessObjectInterfaceClass )){ |
54 |
0
|
List<String> pkFields = new ArrayList<String>( 1 ); |
55 |
0
|
pkFields.add( "routeHeaderId" ); |
56 |
0
|
return pkFields; |
57 |
|
} |
58 |
0
|
return super.listPrimaryKeyFieldNames(businessObjectInterfaceClass); |
59 |
|
} |
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
@see |
66 |
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 7 |
Complexity Density: 0.64 |
|
67 |
0
|
@Override... |
68 |
|
public <T extends ExternalizableBusinessObject> T getExternalizableBusinessObject( |
69 |
|
Class<T> businessObjectClass, Map<String, Object> fieldValues) { |
70 |
0
|
if(DocumentTypeEBO.class.isAssignableFrom(businessObjectClass)){ |
71 |
0
|
if ( fieldValues.containsKey( "name" ) ) { |
72 |
0
|
return (T)getDocumentTypeService().findByName((String)fieldValues.get( "name" ) ); |
73 |
0
|
}else if( fieldValues.containsKey( "documentTypeId" ) ){ |
74 |
0
|
return (T)getDocumentTypeService().findById(Long.valueOf(fieldValues.get( "documentTypeId" ).toString())); |
75 |
0
|
}else if (fieldValues.containsKey( "id" ) ) { |
76 |
|
|
77 |
0
|
return (T)getDocumentTypeService().findById(Long.valueOf(fieldValues.get( "id" ).toString())); |
78 |
|
} |
79 |
|
|
80 |
0
|
}else if(DocumentRouteHeaderEBO.class.isAssignableFrom( businessObjectClass )){ |
81 |
0
|
if ( fieldValues.containsKey( "routeHeaderId" ) ) { |
82 |
0
|
return (T)createDocSearchCriteriaEBO(KEWServiceLocator.getRouteHeaderService().getRouteHeader(Long.valueOf(fieldValues.get( "routeHeaderId" ).toString()))); |
83 |
|
} |
84 |
|
|
85 |
|
} |
86 |
|
|
87 |
|
|
88 |
0
|
return super.getExternalizableBusinessObject(businessObjectClass, fieldValues); |
89 |
|
} |
90 |
|
|
91 |
|
|
92 |
|
@return |
93 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
94 |
0
|
protected DocumentTypeService getDocumentTypeService() {... |
95 |
0
|
if(this.docTypeService == null){ |
96 |
|
|
97 |
0
|
this.docTypeService = KEWServiceLocator.getDocumentTypeService(); |
98 |
|
} |
99 |
0
|
return this.docTypeService; |
100 |
|
} |
101 |
|
|
102 |
|
|
103 |
|
@param |
104 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
105 |
0
|
public void setDocumentTypeService(DocumentTypeService docTypeService) {... |
106 |
0
|
this.docTypeService = docTypeService; |
107 |
|
} |
108 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
109 |
0
|
private DocumentRouteHeaderEBO createDocSearchCriteriaEBO(final DocumentRouteHeaderValue routeHeaderValue){... |
110 |
0
|
return new DocumentRouteHeaderEBO(){ |
111 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
112 |
0
|
public String getAppDocId() {... |
113 |
0
|
return routeHeaderValue.getAppDocId(); |
114 |
|
} |
115 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
116 |
0
|
public Timestamp getDateCreated() {... |
117 |
0
|
return routeHeaderValue.getCreateDate(); |
118 |
|
} |
119 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
120 |
0
|
public String getDocRouteStatus() {... |
121 |
|
|
122 |
0
|
return routeHeaderValue.getDocRouteStatus(); |
123 |
|
} |
124 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
125 |
0
|
public String getAppDocStatus() {... |
126 |
|
|
127 |
0
|
return routeHeaderValue.getAppDocStatus(); |
128 |
|
} |
129 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
130 |
0
|
public String getDocTitle() {... |
131 |
0
|
return routeHeaderValue.getDocTitle(); |
132 |
|
} |
133 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
134 |
0
|
public String getDocTypeFullName() {... |
135 |
0
|
return routeHeaderValue.getDocumentType().getName(); |
136 |
|
} |
137 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
138 |
0
|
public String getInitiator() {... |
139 |
0
|
return routeHeaderValue.getInitiatorPrincipal().getPrincipalName(); |
140 |
|
} |
141 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
142 |
0
|
public String getRouteHeaderId() {... |
143 |
|
|
144 |
0
|
return routeHeaderValue.getRouteHeaderId().toString(); |
145 |
|
} |
146 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
147 |
0
|
public void refresh() {... |
148 |
|
|
149 |
|
|
150 |
|
} |
151 |
|
|
152 |
|
}; |
153 |
|
} |
154 |
|
|
155 |
|
|
156 |
|
|
157 |
|
@see |
158 |
|
|
|
|
| 0% |
Uncovered Elements: 22 (22) |
Complexity: 8 |
Complexity Density: 0.57 |
|
159 |
0
|
@Override... |
160 |
|
public String getExternalizableBusinessObjectInquiryUrl( |
161 |
|
Class inquiryBusinessObjectClass, Map<String, String[]> parameters) { |
162 |
0
|
if ( DocumentTypeEBO.class.isAssignableFrom( inquiryBusinessObjectClass ) ) { |
163 |
0
|
int nonBlank = 0; |
164 |
0
|
boolean nameFound = false; |
165 |
|
|
166 |
0
|
for(String key: parameters.keySet()){ |
167 |
0
|
if("name".equals(key) && parameters.get(key) != null){ |
168 |
0
|
nameFound=true; |
169 |
0
|
}else if(!"name".equals(key) && parameters.get(key) != null){ |
170 |
0
|
nonBlank ++; |
171 |
|
} |
172 |
|
} |
173 |
|
|
174 |
0
|
if(nonBlank == 0 && nameFound == true){ |
175 |
0
|
parameters.clear(); |
176 |
0
|
DocumentTypeEBO dte = (DocumentTypeEBO)getDocumentTypeService().findByName(parameters.get( "name" )[0] ); |
177 |
0
|
String[] strArr = {dte.getDocumentTypeId().toString()}; |
178 |
0
|
parameters.put("documentTypeId", strArr); |
179 |
|
} |
180 |
|
|
181 |
|
} |
182 |
|
|
183 |
0
|
return super.getExternalizableBusinessObjectInquiryUrl( |
184 |
|
inquiryBusinessObjectClass, parameters); |
185 |
|
} |
186 |
|
|
187 |
|
|
188 |
|
|
189 |
|
@see |
190 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
191 |
0
|
public List<List<String>> listAlternatePrimaryKeyFieldNames(... |
192 |
|
Class businessObjectInterfaceClass) { |
193 |
0
|
if ( DocumentTypeEBO.class.isAssignableFrom( businessObjectInterfaceClass ) ) { |
194 |
0
|
ArrayList<List<String>> retList = new ArrayList<List<String>>(); |
195 |
0
|
ArrayList<String> keyList = new ArrayList<String>(); |
196 |
|
|
197 |
0
|
keyList.add("name"); |
198 |
0
|
retList.add(keyList); |
199 |
0
|
return retList; |
200 |
|
}else{ |
201 |
0
|
return null; |
202 |
|
} |
203 |
|
|
204 |
|
} |
205 |
|
} |
206 |
|
|