1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.lum.lrc.service.impl; |
17 | |
|
18 | |
import java.util.List; |
19 | |
|
20 | |
import javax.jws.WebService; |
21 | |
|
22 | |
import org.kuali.student.core.dto.StatusInfo; |
23 | |
import org.kuali.student.core.exceptions.AlreadyExistsException; |
24 | |
import org.kuali.student.core.exceptions.DataValidationErrorException; |
25 | |
import org.kuali.student.core.exceptions.DoesNotExistException; |
26 | |
import org.kuali.student.core.exceptions.InvalidParameterException; |
27 | |
import org.kuali.student.core.exceptions.MissingParameterException; |
28 | |
import org.kuali.student.core.exceptions.OperationFailedException; |
29 | |
import org.kuali.student.core.exceptions.PermissionDeniedException; |
30 | |
import org.kuali.student.core.exceptions.VersionMismatchException; |
31 | |
import org.kuali.student.core.search.dto.SearchCriteriaTypeInfo; |
32 | |
import org.kuali.student.core.search.dto.SearchRequest; |
33 | |
import org.kuali.student.core.search.dto.SearchResult; |
34 | |
import org.kuali.student.core.search.dto.SearchResultTypeInfo; |
35 | |
import org.kuali.student.core.search.dto.SearchTypeInfo; |
36 | |
import org.kuali.student.core.search.service.SearchManager; |
37 | |
import org.kuali.student.lum.lrc.dao.LrcDao; |
38 | |
import org.kuali.student.lum.lrc.dto.CredentialInfo; |
39 | |
import org.kuali.student.lum.lrc.dto.CredentialTypeInfo; |
40 | |
import org.kuali.student.lum.lrc.dto.CreditInfo; |
41 | |
import org.kuali.student.lum.lrc.dto.CreditTypeInfo; |
42 | |
import org.kuali.student.lum.lrc.dto.GradeInfo; |
43 | |
import org.kuali.student.lum.lrc.dto.GradeTypeInfo; |
44 | |
import org.kuali.student.lum.lrc.dto.ResultComponentInfo; |
45 | |
import org.kuali.student.lum.lrc.dto.ResultComponentTypeInfo; |
46 | |
import org.kuali.student.lum.lrc.dto.ScaleInfo; |
47 | |
import org.kuali.student.lum.lrc.entity.ResultComponent; |
48 | |
import org.kuali.student.lum.lrc.entity.ResultComponentType; |
49 | |
import org.kuali.student.lum.lrc.entity.Scale; |
50 | |
import org.kuali.student.lum.lrc.service.LrcService; |
51 | |
import org.springframework.transaction.annotation.Transactional; |
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
@WebService(endpointInterface = "org.kuali.student.lum.lrc.service.LrcService", serviceName = "LrcService", portName = "LrcService", targetNamespace = "http://student.kuali.org/wsdl/lrc") |
58 | |
@Transactional(noRollbackFor={DoesNotExistException.class},rollbackFor={Throwable.class}) |
59 | 10 | public class LrcServiceImpl implements LrcService { |
60 | |
private LrcDao lrcDao; |
61 | |
private SearchManager searchManager; |
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | |
@Override |
67 | |
public String compareGrades(String gradeKey, String scaleKey, |
68 | |
String compareGradeKey, String compareScaleKey) |
69 | |
throws InvalidParameterException, MissingParameterException, |
70 | |
OperationFailedException { |
71 | 0 | throw new UnsupportedOperationException("Method not yet implemented!"); |
72 | |
} |
73 | |
|
74 | |
|
75 | |
|
76 | |
|
77 | |
@Override |
78 | |
public ResultComponentInfo createResultComponent( |
79 | |
String resultComponentTypeKey, |
80 | |
ResultComponentInfo resultComponentInfo) |
81 | |
throws AlreadyExistsException, DataValidationErrorException, |
82 | |
DoesNotExistException, InvalidParameterException, |
83 | |
MissingParameterException, OperationFailedException, |
84 | |
PermissionDeniedException { |
85 | 7 | checkForMissingParameter(resultComponentTypeKey, "resultComponentTypeKey"); |
86 | 6 | checkForMissingParameter(resultComponentInfo, "resultComponentInfo"); |
87 | |
|
88 | 5 | ResultComponent rc = LrcServiceAssembler.toResultComponent(resultComponentTypeKey, resultComponentInfo, lrcDao); |
89 | 5 | lrcDao.create(rc); |
90 | 5 | return LrcServiceAssembler.toResultComponentInfo(rc); |
91 | |
} |
92 | |
|
93 | |
|
94 | |
|
95 | |
|
96 | |
@Override |
97 | |
public StatusInfo deleteResultComponent(String resultComponentId) |
98 | |
throws DoesNotExistException, InvalidParameterException, |
99 | |
MissingParameterException, OperationFailedException, |
100 | |
PermissionDeniedException { |
101 | 3 | checkForMissingParameter(resultComponentId, "resultComponentId"); |
102 | 2 | lrcDao.delete(ResultComponent.class, resultComponentId); |
103 | 1 | StatusInfo statusInfo = new StatusInfo(); |
104 | 1 | return statusInfo; |
105 | |
} |
106 | |
|
107 | |
|
108 | |
|
109 | |
|
110 | |
@Override |
111 | |
public CredentialInfo getCredential(String credentialKey) |
112 | |
throws DoesNotExistException, InvalidParameterException, |
113 | |
MissingParameterException, OperationFailedException { |
114 | 0 | throw new UnsupportedOperationException(); |
115 | |
} |
116 | |
|
117 | |
|
118 | |
|
119 | |
|
120 | |
@Override |
121 | |
public List<String> getCredentialKeysByCredentialType( |
122 | |
String credentialTypeKey) throws DoesNotExistException, |
123 | |
InvalidParameterException, MissingParameterException, |
124 | |
OperationFailedException { |
125 | 0 | throw new UnsupportedOperationException(); |
126 | |
} |
127 | |
|
128 | |
|
129 | |
|
130 | |
|
131 | |
@Override |
132 | |
public CredentialTypeInfo getCredentialType(String credentialTypeKey) |
133 | |
throws DoesNotExistException, InvalidParameterException, |
134 | |
MissingParameterException, OperationFailedException { |
135 | 0 | throw new UnsupportedOperationException(); |
136 | |
} |
137 | |
|
138 | |
|
139 | |
|
140 | |
|
141 | |
@Override |
142 | |
public List<CredentialTypeInfo> getCredentialTypes() |
143 | |
throws OperationFailedException { |
144 | 0 | throw new UnsupportedOperationException(); |
145 | |
} |
146 | |
|
147 | |
|
148 | |
|
149 | |
|
150 | |
@Override |
151 | |
public List<CredentialInfo> getCredentialsByKeyList( |
152 | |
List<String> credentialKeyList) throws DoesNotExistException, |
153 | |
InvalidParameterException, MissingParameterException, |
154 | |
OperationFailedException { |
155 | 0 | throw new UnsupportedOperationException(); |
156 | |
} |
157 | |
|
158 | |
|
159 | |
|
160 | |
|
161 | |
@Override |
162 | |
public CreditInfo getCredit(String creditKey) throws DoesNotExistException, |
163 | |
InvalidParameterException, MissingParameterException, |
164 | |
OperationFailedException { |
165 | 0 | throw new UnsupportedOperationException(); |
166 | |
} |
167 | |
|
168 | |
|
169 | |
|
170 | |
|
171 | |
@Override |
172 | |
public List<String> getCreditKeysByCreditType(String creditTypeKey) |
173 | |
throws DoesNotExistException, InvalidParameterException, |
174 | |
MissingParameterException, OperationFailedException { |
175 | 0 | throw new UnsupportedOperationException(); |
176 | |
} |
177 | |
|
178 | |
|
179 | |
|
180 | |
|
181 | |
@Override |
182 | |
public CreditTypeInfo getCreditType(String creditTypeKey) |
183 | |
throws DoesNotExistException, InvalidParameterException, |
184 | |
MissingParameterException, OperationFailedException { |
185 | 0 | throw new UnsupportedOperationException(); |
186 | |
} |
187 | |
|
188 | |
|
189 | |
|
190 | |
|
191 | |
@Override |
192 | |
public List<CreditTypeInfo> getCreditTypes() |
193 | |
throws OperationFailedException { |
194 | 0 | throw new UnsupportedOperationException(); |
195 | |
} |
196 | |
|
197 | |
|
198 | |
|
199 | |
|
200 | |
@Override |
201 | |
public List<CreditInfo> getCreditsByKeyList(List<String> creditKeyList) |
202 | |
throws DoesNotExistException, InvalidParameterException, |
203 | |
MissingParameterException, OperationFailedException { |
204 | 0 | throw new UnsupportedOperationException(); |
205 | |
} |
206 | |
|
207 | |
|
208 | |
|
209 | |
|
210 | |
@Override |
211 | |
public GradeInfo getGrade(String gradeKey) throws DoesNotExistException, |
212 | |
InvalidParameterException, MissingParameterException, |
213 | |
OperationFailedException { |
214 | 0 | throw new UnsupportedOperationException(); |
215 | |
} |
216 | |
|
217 | |
|
218 | |
|
219 | |
|
220 | |
@Override |
221 | |
public List<String> getGradeKeysByGradeType(String gradeTypeKey) |
222 | |
throws DoesNotExistException, InvalidParameterException, |
223 | |
MissingParameterException, OperationFailedException { |
224 | 0 | throw new UnsupportedOperationException(); |
225 | |
} |
226 | |
|
227 | |
|
228 | |
|
229 | |
|
230 | |
@Override |
231 | |
public GradeTypeInfo getGradeType(String gradeTypeKey) |
232 | |
throws DoesNotExistException, InvalidParameterException, |
233 | |
MissingParameterException, OperationFailedException { |
234 | 0 | throw new UnsupportedOperationException(); |
235 | |
} |
236 | |
|
237 | |
|
238 | |
|
239 | |
|
240 | |
@Override |
241 | |
public List<GradeTypeInfo> getGradeTypes() throws OperationFailedException { |
242 | 0 | throw new UnsupportedOperationException(); |
243 | |
} |
244 | |
|
245 | |
|
246 | |
|
247 | |
|
248 | |
@Override |
249 | |
public List<GradeInfo> getGradesByKeyList(List<String> gradeKeyList) |
250 | |
throws DoesNotExistException, InvalidParameterException, |
251 | |
MissingParameterException, OperationFailedException { |
252 | 0 | throw new UnsupportedOperationException(); |
253 | |
} |
254 | |
|
255 | |
|
256 | |
|
257 | |
@Override |
258 | |
public List<GradeInfo> getGradesByScale(String scale) |
259 | |
throws DoesNotExistException, InvalidParameterException, |
260 | |
MissingParameterException, OperationFailedException { |
261 | 0 | throw new UnsupportedOperationException(); |
262 | |
} |
263 | |
|
264 | |
|
265 | |
|
266 | |
|
267 | |
@Override |
268 | |
public ResultComponentInfo getResultComponent(String resultComponentId) |
269 | |
throws DoesNotExistException, InvalidParameterException, |
270 | |
MissingParameterException, OperationFailedException { |
271 | 104 | checkForMissingParameter(resultComponentId, "resultComponentId"); |
272 | 103 | ResultComponent resultComponent = lrcDao.fetch(ResultComponent.class, resultComponentId); |
273 | |
|
274 | 102 | return LrcServiceAssembler.toResultComponentInfo(resultComponent); |
275 | |
} |
276 | |
|
277 | |
|
278 | |
|
279 | |
|
280 | |
@Override |
281 | |
public List<String> getResultComponentIdsByResult(String resultValueId, |
282 | |
String resultComponentTypeKey) throws DoesNotExistException, |
283 | |
InvalidParameterException, MissingParameterException, |
284 | |
OperationFailedException { |
285 | 5 | checkForMissingParameter(resultValueId, "resultValueId"); |
286 | 4 | checkForMissingParameter(resultComponentTypeKey, "resultComponentTypeKey"); |
287 | 3 | List<String> ids = lrcDao.getResultComponentIdsByResult(resultValueId, resultComponentTypeKey); |
288 | 3 | return ids; |
289 | |
} |
290 | |
|
291 | |
|
292 | |
|
293 | |
|
294 | |
@Override |
295 | |
public List<String> getResultComponentIdsByResultComponentType( |
296 | |
String resultComponentTypeKey) throws DoesNotExistException, |
297 | |
InvalidParameterException, MissingParameterException, |
298 | |
OperationFailedException { |
299 | 117 | checkForMissingParameter(resultComponentTypeKey, "resultComponentTypeKey"); |
300 | 116 | List<String> ids = lrcDao.getResultComponentIdsByResultComponentType(resultComponentTypeKey); |
301 | 116 | return ids; |
302 | |
} |
303 | |
|
304 | |
|
305 | |
|
306 | |
|
307 | |
@Override |
308 | |
public ResultComponentTypeInfo getResultComponentType( |
309 | |
String resultComponentTypeKey) throws DoesNotExistException, |
310 | |
InvalidParameterException, MissingParameterException, |
311 | |
OperationFailedException { |
312 | 2 | checkForMissingParameter(resultComponentTypeKey, "resultComponentTypeKey"); |
313 | 2 | ResultComponentType entity = lrcDao.getResultComponentType(resultComponentTypeKey); |
314 | 1 | return LrcServiceAssembler.toResultComponentTypeInfo(entity); |
315 | |
} |
316 | |
|
317 | |
|
318 | |
|
319 | |
|
320 | |
@Override |
321 | |
public List<ResultComponentTypeInfo> getResultComponentTypes() |
322 | |
throws OperationFailedException { |
323 | 10 | List<ResultComponentType> rct = lrcDao.find(ResultComponentType.class); |
324 | 10 | return LrcServiceAssembler.toResultComponentTypeInfos(rct); |
325 | |
} |
326 | |
|
327 | |
|
328 | |
|
329 | |
|
330 | |
@Override |
331 | |
public ScaleInfo getScale(String scaleKey) throws DoesNotExistException, |
332 | |
InvalidParameterException, MissingParameterException, |
333 | |
OperationFailedException { |
334 | 0 | checkForMissingParameter(scaleKey, "scaleKey"); |
335 | 0 | Scale scale = lrcDao.fetch(Scale.class, scaleKey); |
336 | 0 | return LrcServiceAssembler.toScaleInfo(scale); |
337 | |
} |
338 | |
|
339 | |
|
340 | |
|
341 | |
|
342 | |
@Override |
343 | |
public List<GradeInfo> translateGrade(String gradeKey, String scaleKey, |
344 | |
String translateScaleKey) throws InvalidParameterException, |
345 | |
MissingParameterException, OperationFailedException { |
346 | 0 | throw new UnsupportedOperationException("Method not yet implemented!"); |
347 | |
} |
348 | |
|
349 | |
|
350 | |
|
351 | |
|
352 | |
@Override |
353 | |
public ResultComponentInfo updateResultComponent(String resultComponentId, |
354 | |
ResultComponentInfo resultComponentInfo) |
355 | |
throws DataValidationErrorException, DoesNotExistException, |
356 | |
InvalidParameterException, MissingParameterException, |
357 | |
OperationFailedException, PermissionDeniedException, |
358 | |
VersionMismatchException { |
359 | 5 | checkForMissingParameter(resultComponentId, "resultComponentId"); |
360 | 4 | checkForMissingParameter(resultComponentInfo, "resultComponentInfo"); |
361 | |
|
362 | 3 | ResultComponent entity = lrcDao.fetch(ResultComponent.class, resultComponentId); |
363 | |
|
364 | 3 | if (!String.valueOf(entity.getVersionNumber()).equals(resultComponentInfo.getMetaInfo().getVersionInd())){ |
365 | 1 | throw new VersionMismatchException("ResultComponent to be updated is not the current version"); |
366 | |
} |
367 | |
|
368 | 2 | LrcServiceAssembler.toResultComponent(entity, resultComponentInfo, lrcDao); |
369 | 2 | lrcDao.update(entity); |
370 | 2 | return LrcServiceAssembler.toResultComponentInfo(entity); |
371 | |
} |
372 | |
|
373 | |
|
374 | |
|
375 | |
|
376 | |
public LrcDao getLrcDao() { |
377 | 0 | return lrcDao; |
378 | |
} |
379 | |
|
380 | |
|
381 | |
|
382 | |
|
383 | |
public void setLrcDao(LrcDao lrcDao) { |
384 | 5 | this.lrcDao = lrcDao; |
385 | 5 | } |
386 | |
|
387 | |
|
388 | |
|
389 | |
|
390 | |
|
391 | |
|
392 | |
|
393 | |
|
394 | |
private void checkForMissingParameter(Object param, String paramName) |
395 | |
throws MissingParameterException { |
396 | 257 | if (param == null) { |
397 | 9 | throw new MissingParameterException(paramName + " can not be null"); |
398 | |
} |
399 | 248 | } |
400 | |
|
401 | |
@Override |
402 | |
public SearchCriteriaTypeInfo getSearchCriteriaType( |
403 | |
String searchCriteriaTypeKey) throws DoesNotExistException, |
404 | |
InvalidParameterException, MissingParameterException, |
405 | |
OperationFailedException { |
406 | |
|
407 | 0 | return searchManager.getSearchCriteriaType(searchCriteriaTypeKey); |
408 | |
} |
409 | |
|
410 | |
@Override |
411 | |
public List<SearchCriteriaTypeInfo> getSearchCriteriaTypes() |
412 | |
throws OperationFailedException { |
413 | 0 | return searchManager.getSearchCriteriaTypes(); |
414 | |
} |
415 | |
|
416 | |
@Override |
417 | |
public SearchResultTypeInfo getSearchResultType(String searchResultTypeKey) |
418 | |
throws DoesNotExistException, InvalidParameterException, |
419 | |
MissingParameterException, OperationFailedException { |
420 | 0 | checkForMissingParameter(searchResultTypeKey, "searchResultTypeKey"); |
421 | 0 | return searchManager.getSearchResultType(searchResultTypeKey); |
422 | |
} |
423 | |
|
424 | |
@Override |
425 | |
public List<SearchResultTypeInfo> getSearchResultTypes() |
426 | |
throws OperationFailedException { |
427 | 0 | return searchManager.getSearchResultTypes(); |
428 | |
} |
429 | |
|
430 | |
@Override |
431 | |
public SearchTypeInfo getSearchType(String searchTypeKey) |
432 | |
throws DoesNotExistException, InvalidParameterException, |
433 | |
MissingParameterException, OperationFailedException { |
434 | 0 | checkForMissingParameter(searchTypeKey, "searchTypeKey"); |
435 | 0 | return searchManager.getSearchType(searchTypeKey); |
436 | |
} |
437 | |
|
438 | |
@Override |
439 | |
public List<SearchTypeInfo> getSearchTypes() |
440 | |
throws OperationFailedException { |
441 | 0 | return searchManager.getSearchTypes(); |
442 | |
} |
443 | |
|
444 | |
@Override |
445 | |
public List<SearchTypeInfo> getSearchTypesByCriteria( |
446 | |
String searchCriteriaTypeKey) throws DoesNotExistException, |
447 | |
InvalidParameterException, MissingParameterException, |
448 | |
OperationFailedException { |
449 | 0 | checkForMissingParameter(searchCriteriaTypeKey, "searchCriteriaTypeKey"); |
450 | 0 | return searchManager.getSearchTypesByCriteria(searchCriteriaTypeKey); |
451 | |
} |
452 | |
|
453 | |
@Override |
454 | |
public List<SearchTypeInfo> getSearchTypesByResult( |
455 | |
String searchResultTypeKey) throws DoesNotExistException, |
456 | |
InvalidParameterException, MissingParameterException, |
457 | |
OperationFailedException { |
458 | 0 | checkForMissingParameter(searchResultTypeKey, "searchResultTypeKey"); |
459 | 0 | return searchManager.getSearchTypesByResult(searchResultTypeKey); |
460 | |
} |
461 | |
|
462 | |
public SearchManager getSearchManager() { |
463 | 0 | return searchManager; |
464 | |
} |
465 | |
|
466 | |
public void setSearchManager(SearchManager searchManager) { |
467 | 4 | this.searchManager = searchManager; |
468 | 4 | } |
469 | |
|
470 | |
@Override |
471 | |
public SearchResult search(SearchRequest searchRequest) throws MissingParameterException { |
472 | 0 | checkForMissingParameter(searchRequest, "searchRequest"); |
473 | 0 | return searchManager.search(searchRequest, lrcDao); |
474 | |
} |
475 | |
|
476 | |
} |