1
2
3
4
5
6
7
8
9
10
11
12
13 package org.kuali.student.r2.common.class1.search;
14
15 import org.kuali.student.r2.common.dto.ContextInfo;
16 import org.kuali.student.r2.common.exceptions.DoesNotExistException;
17 import org.kuali.student.r2.common.exceptions.InvalidParameterException;
18 import org.kuali.student.r2.common.exceptions.MissingParameterException;
19 import org.kuali.student.r2.common.exceptions.OperationFailedException;
20 import org.kuali.student.r2.common.exceptions.PermissionDeniedException;
21 import org.kuali.student.r2.core.class1.type.dto.TypeInfo;
22 import org.kuali.student.r2.core.search.dto.SearchRequestInfo;
23 import org.kuali.student.r2.core.search.dto.SearchResultInfo;
24 import org.kuali.student.r2.core.search.service.SearchService;
25
26 import javax.annotation.Resource;
27 import javax.persistence.EntityManager;
28 import java.util.Arrays;
29 import java.util.List;
30
31
32
33
34
35
36 public abstract class SearchServiceAbstractHardwiredImplBase
37 implements SearchService {
38
39
40 @Resource
41 private EntityManager entityManager;
42
43
44
45
46 public abstract TypeInfo getSearchType();
47
48 @Override
49 public TypeInfo getSearchType(String searchTypeKey, ContextInfo contextInfo)
50 throws DoesNotExistException,
51 InvalidParameterException,
52 MissingParameterException,
53 OperationFailedException {
54 TypeInfo st = this.getSearchType();
55 if (!searchTypeKey.equals(st.getKey())) {
56 throw new DoesNotExistException(searchTypeKey);
57 }
58 return st;
59 }
60
61 @Override
62 public List<TypeInfo> getSearchTypes(ContextInfo contextInfo)
63 throws InvalidParameterException,
64 MissingParameterException,
65 OperationFailedException {
66 return Arrays.asList(this.getSearchType());
67 }
68
69
70 @Override
71 public abstract SearchResultInfo search(SearchRequestInfo searchRequestInfo, ContextInfo contextInfo)
72 throws
73 MissingParameterException,
74 OperationFailedException,
75 PermissionDeniedException;
76
77 public EntityManager getEntityManager() {
78 return entityManager;
79 }
80
81 public void setEntityManager(EntityManager entityManager) {
82 this.entityManager = entityManager;
83 }
84 }