Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
LookupResultsService |
|
| 1.0;1 |
1 | /** | |
2 | * Copyright 2005-2011 The Kuali Foundation | |
3 | * | |
4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.opensource.org/licenses/ecl2.php | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | package org.kuali.rice.kns.lookup; | |
17 | ||
18 | import org.kuali.rice.kns.web.ui.ResultRow; | |
19 | import org.kuali.rice.krad.bo.BusinessObject; | |
20 | ||
21 | import java.io.Serializable; | |
22 | import java.sql.Timestamp; | |
23 | import java.util.Collection; | |
24 | import java.util.List; | |
25 | import java.util.Set; | |
26 | ||
27 | @Deprecated | |
28 | public interface LookupResultsService extends Serializable { | |
29 | /** | |
30 | * Persists a list of result row objects into a database. The lookup results sequence number acts like a key identifying the lookup | |
31 | * results set. If results are persisted under the same sequence number, then the previously persisted list will be overwritten. | |
32 | * | |
33 | * @param lookupResultsSequenceNumber the lookup sequence number. Every time a user clicks "search", a new sequence number should be generated | |
34 | * @param resultTable A list of result rows. Note that this list does not contain BOs, but the data necessary to render a lookup results screen | |
35 | * @param personId the user that is performing the search. This prevents a malicious user from passing someone else's sequence number | |
36 | * (which he can guess) and eventually retrieving it, possibly exposing sensitive data | |
37 | * @throws Exception | |
38 | */ | |
39 | public void persistResultsTable(String lookupResultsSequenceNumber, List<ResultRow> resultTable, String personId) throws Exception; | |
40 | ||
41 | /** | |
42 | * Persists a list of BO object IDs that have been selected for return to the calling document (the back location in lookup terminology). | |
43 | * The lookup results sequence number acts like a key identifying the selected object IDs. If results are persisted under the same | |
44 | * sequence number, then the previously persisted list will be overwritten. | |
45 | * | |
46 | * @param lookupResultsSequenceNumber the lookup sequence number. Every time a user clicks "search", a new sequence number should be generated | |
47 | * @param selectedObjectIds A set of the object IDs of the selected rows. | |
48 | * @param personId the user that is performing the search. This prevents a malicious user from passing someone else's sequence number | |
49 | * (which he can guess) and eventually retrieving it, possibly exposing sensitive data | |
50 | * @throws Exception | |
51 | */ | |
52 | public void persistSelectedObjectIds(String lookupResultsSequenceNumber, Set<String> selectedObjectIds, String personId) throws Exception; | |
53 | ||
54 | /** | |
55 | * Returns the list of result rows that was persisted under the passed in sequence number | |
56 | * | |
57 | * @param lookupResultsSequenceNumber the lookup sequence number that was used to persist | |
58 | * @param personId the user id that was used to persist the results table. This prevents a malicious user from passing someone else's sequence number | |
59 | * (which he can guess) and eventually retrieving it, possibly exposing sensitive data | |
60 | * @return | |
61 | * @throws Exception many reasons, including if the user id parameter does not match the user used to persist the results | |
62 | */ | |
63 | public List<ResultRow> retrieveResultsTable(String lookupResultsSequenceNumber, String personId) throws Exception; | |
64 | ||
65 | /** | |
66 | * Returns the BOs that correspond to the selected objected IDs that were persisted under the given lookup results number | |
67 | * | |
68 | * DB data may have changed since the time the user clicked the "search" button (e.g. someone may have changed a value that was | |
69 | * used as a query criterion). If so, implementations may or may not choose to handle this situation. | |
70 | * | |
71 | * @param lookupResultsSequenceNumber the lookup sequence number that was used to persist | |
72 | * @param boClass The class of BO being retrieved from the lookup | |
73 | * @param personId the user id that was used to persist the results table. This prevents a malicious user from passing someone else's sequence number | |
74 | * (which he can guess) and eventually retrieving it, possibly exposing sensitive data | |
75 | * @return A list of BOs corresponding to the | |
76 | * @throws Exception many reasons, including if the user id parameter does not match the user used to persist the results | |
77 | */ | |
78 | public <T extends BusinessObject> Collection<T> retrieveSelectedResultBOs(String lookupResultsSequenceNumber, Class<T> boClass, String personId) throws Exception; | |
79 | ||
80 | /** | |
81 | * Returns whether a user is allowed to view the lookup results of the given sequence number | |
82 | * | |
83 | * @param lookupResultsSequenceNumber the lookup sequence number that was used to persist the results table | |
84 | * @param personId the user id that was used to persist the results table. | |
85 | * @return if the user ID used to persist the lookup results is the same user ID as the parameter | |
86 | */ | |
87 | public boolean isAuthorizedToAccessLookupResults(String lookupResultsSequenceNumber, String personId); | |
88 | ||
89 | /** | |
90 | * Returns whether a user is allowed to view the selected object IDs of the given sequence number | |
91 | * | |
92 | * @param lookupResultsSequenceNumber the lookup sequence number that was used to persist the selected object IDs | |
93 | * @param personId the user id that was used to persist the selected object IDs | |
94 | * @return if the user ID used to persist the selected object IDs is the same user ID as the parameter | |
95 | */ | |
96 | public boolean isAuthorizedToAccessSelectedObjectIds(String lookupResultsSequenceNumber, String personId); | |
97 | ||
98 | /** | |
99 | * Removes the lookup results that were persisted under this lookup results sequence number | |
100 | * | |
101 | * @param lookupResultsSequenceNumber | |
102 | * @throws Exception | |
103 | */ | |
104 | public void clearPersistedLookupResults(String lookupResultsSequenceNumber) throws Exception; | |
105 | ||
106 | /** | |
107 | * Removes the lookup results that were persisted under this selected object IDs | |
108 | * | |
109 | * @param lookupResultsSequenceNumber | |
110 | * @throws Exception | |
111 | */ | |
112 | public void clearPersistedSelectedObjectIds(String lookupResultsSequenceNumber) throws Exception; | |
113 | ||
114 | /** | |
115 | * removes all LookupResults BO where the lookup date attribute is older than | |
116 | * the parameter | |
117 | * | |
118 | * @param expirationDate all LookupResults having a lookup date before this date | |
119 | * will be removed | |
120 | */ | |
121 | public void deleteOldLookupResults(Timestamp expirationDate); | |
122 | ||
123 | /** | |
124 | * removes all LookupResults BO where the lookup date attribute is older than | |
125 | * the parameter | |
126 | * | |
127 | * @param expirationDate all LookupResults having a lookup date before this date | |
128 | * will be removed | |
129 | */ | |
130 | public void deleteOldSelectedObjectIds(Timestamp expirationDate); | |
131 | ||
132 | /** | |
133 | * Determines the lookup id for a given business object | |
134 | * | |
135 | * @param businessObject the business object to get a lookup id for | |
136 | * @return the lookup id | |
137 | */ | |
138 | public abstract String getLookupId(BusinessObject businessObject); | |
139 | } | |
140 |