1 /** 2 * Copyright 2005-2014 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 /** 28 * @deprecated Only used in KNS classes, use KRAD. 29 */ 30 @Deprecated 31 public interface LookupResultsService extends Serializable { 32 /** 33 * Persists a list of result row objects into a database. The lookup results sequence number acts like a key identifying the lookup 34 * results set. If results are persisted under the same sequence number, then the previously persisted list will be overwritten. 35 * 36 * @param lookupResultsSequenceNumber the lookup sequence number. Every time a user clicks "search", a new sequence number should be generated 37 * @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 38 * @param personId the user that is performing the search. This prevents a malicious user from passing someone else's sequence number 39 * (which he can guess) and eventually retrieving it, possibly exposing sensitive data 40 * @throws Exception 41 */ 42 public void persistResultsTable(String lookupResultsSequenceNumber, List<ResultRow> resultTable, String personId) throws Exception; 43 44 /** 45 * Persists a list of BO object IDs that have been selected for return to the calling document (the back location in lookup terminology). 46 * The lookup results sequence number acts like a key identifying the selected object IDs. If results are persisted under the same 47 * sequence number, then the previously persisted list will be overwritten. 48 * 49 * @param lookupResultsSequenceNumber the lookup sequence number. Every time a user clicks "search", a new sequence number should be generated 50 * @param selectedObjectIds A set of the object IDs of the selected rows. 51 * @param personId the user that is performing the search. This prevents a malicious user from passing someone else's sequence number 52 * (which he can guess) and eventually retrieving it, possibly exposing sensitive data 53 * @throws Exception 54 */ 55 public void persistSelectedObjectIds(String lookupResultsSequenceNumber, Set<String> selectedObjectIds, String personId) throws Exception; 56 57 /** 58 * Returns the list of result rows that was persisted under the passed in sequence number 59 * 60 * @param lookupResultsSequenceNumber the lookup sequence number that was used to persist 61 * @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 62 * (which he can guess) and eventually retrieving it, possibly exposing sensitive data 63 * @return 64 * @throws Exception many reasons, including if the user id parameter does not match the user used to persist the results 65 */ 66 public List<ResultRow> retrieveResultsTable(String lookupResultsSequenceNumber, String personId) throws Exception; 67 68 /** 69 * Returns the BOs that correspond to the selected objected IDs that were persisted under the given lookup results number 70 * 71 * DB data may have changed since the time the user clicked the "search" button (e.g. someone may have changed a value that was 72 * used as a query criterion). If so, implementations may or may not choose to handle this situation. 73 * 74 * @param lookupResultsSequenceNumber the lookup sequence number that was used to persist 75 * @param boClass The class of BO being retrieved from the lookup 76 * @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 77 * (which he can guess) and eventually retrieving it, possibly exposing sensitive data 78 * @return A list of BOs corresponding to the 79 * @throws Exception many reasons, including if the user id parameter does not match the user used to persist the results 80 */ 81 public <T extends BusinessObject> Collection<T> retrieveSelectedResultBOs(String lookupResultsSequenceNumber, Class<T> boClass, String personId) throws Exception; 82 83 /** 84 * Returns whether a user is allowed to view the lookup results of the given sequence number 85 * 86 * @param lookupResultsSequenceNumber the lookup sequence number that was used to persist the results table 87 * @param personId the user id that was used to persist the results table. 88 * @return if the user ID used to persist the lookup results is the same user ID as the parameter 89 */ 90 public boolean isAuthorizedToAccessLookupResults(String lookupResultsSequenceNumber, String personId); 91 92 /** 93 * Returns whether a user is allowed to view the selected object IDs of the given sequence number 94 * 95 * @param lookupResultsSequenceNumber the lookup sequence number that was used to persist the selected object IDs 96 * @param personId the user id that was used to persist the selected object IDs 97 * @return if the user ID used to persist the selected object IDs is the same user ID as the parameter 98 */ 99 public boolean isAuthorizedToAccessSelectedObjectIds(String lookupResultsSequenceNumber, String personId); 100 101 /** 102 * Removes the lookup results that were persisted under this lookup results sequence number 103 * 104 * @param lookupResultsSequenceNumber 105 * @throws Exception 106 */ 107 public void clearPersistedLookupResults(String lookupResultsSequenceNumber) throws Exception; 108 109 /** 110 * Removes the lookup results that were persisted under this selected object IDs 111 * 112 * @param lookupResultsSequenceNumber 113 * @throws Exception 114 */ 115 public void clearPersistedSelectedObjectIds(String lookupResultsSequenceNumber) throws Exception; 116 117 /** 118 * removes all LookupResults BO where the lookup date attribute is older than 119 * the parameter 120 * 121 * @param expirationDate all LookupResults having a lookup date before this date 122 * will be removed 123 */ 124 public void deleteOldLookupResults(Timestamp expirationDate); 125 126 /** 127 * removes all LookupResults BO where the lookup date attribute is older than 128 * the parameter 129 * 130 * @param expirationDate all LookupResults having a lookup date before this date 131 * will be removed 132 */ 133 public void deleteOldSelectedObjectIds(Timestamp expirationDate); 134 135 /** 136 * Determines the lookup id for a given business object 137 * 138 * @param businessObject the business object to get a lookup id for 139 * @return the lookup id 140 */ 141 public abstract String getLookupId(BusinessObject businessObject); 142 } 143