001/** 002 * Copyright 2005-2016 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.kns.lookup; 017 018import org.kuali.rice.kns.web.ui.ResultRow; 019import org.kuali.rice.krad.bo.BusinessObject; 020 021import java.io.Serializable; 022import java.sql.Timestamp; 023import java.util.Collection; 024import java.util.List; 025import java.util.Set; 026 027@Deprecated 028public interface LookupResultsService extends Serializable { 029 /** 030 * Persists a list of result row objects into a database. The lookup results sequence number acts like a key identifying the lookup 031 * results set. If results are persisted under the same sequence number, then the previously persisted list will be overwritten. 032 * 033 * @param lookupResultsSequenceNumber the lookup sequence number. Every time a user clicks "search", a new sequence number should be generated 034 * @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 035 * @param personId the user that is performing the search. This prevents a malicious user from passing someone else's sequence number 036 * (which he can guess) and eventually retrieving it, possibly exposing sensitive data 037 * @throws Exception 038 */ 039 public void persistResultsTable(String lookupResultsSequenceNumber, List<ResultRow> resultTable, String personId) throws Exception; 040 041 /** 042 * Persists a list of BO object IDs that have been selected for return to the calling document (the back location in lookup terminology). 043 * The lookup results sequence number acts like a key identifying the selected object IDs. If results are persisted under the same 044 * sequence number, then the previously persisted list will be overwritten. 045 * 046 * @param lookupResultsSequenceNumber the lookup sequence number. Every time a user clicks "search", a new sequence number should be generated 047 * @param selectedObjectIds A set of the object IDs of the selected rows. 048 * @param personId the user that is performing the search. This prevents a malicious user from passing someone else's sequence number 049 * (which he can guess) and eventually retrieving it, possibly exposing sensitive data 050 * @throws Exception 051 */ 052 public void persistSelectedObjectIds(String lookupResultsSequenceNumber, Set<String> selectedObjectIds, String personId) throws Exception; 053 054 /** 055 * Returns the list of result rows that was persisted under the passed in sequence number 056 * 057 * @param lookupResultsSequenceNumber the lookup sequence number that was used to persist 058 * @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 059 * (which he can guess) and eventually retrieving it, possibly exposing sensitive data 060 * @return 061 * @throws Exception many reasons, including if the user id parameter does not match the user used to persist the results 062 */ 063 public List<ResultRow> retrieveResultsTable(String lookupResultsSequenceNumber, String personId) throws Exception; 064 065 /** 066 * Returns the BOs that correspond to the selected objected IDs that were persisted under the given lookup results number 067 * 068 * DB data may have changed since the time the user clicked the "search" button (e.g. someone may have changed a value that was 069 * used as a query criterion). If so, implementations may or may not choose to handle this situation. 070 * 071 * @param lookupResultsSequenceNumber the lookup sequence number that was used to persist 072 * @param boClass The class of BO being retrieved from the lookup 073 * @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 074 * (which he can guess) and eventually retrieving it, possibly exposing sensitive data 075 * @return A list of BOs corresponding to the 076 * @throws Exception many reasons, including if the user id parameter does not match the user used to persist the results 077 */ 078 public <T extends BusinessObject> Collection<T> retrieveSelectedResultBOs(String lookupResultsSequenceNumber, Class<T> boClass, String personId) throws Exception; 079 080 /** 081 * Returns whether a user is allowed to view the lookup results of the given sequence number 082 * 083 * @param lookupResultsSequenceNumber the lookup sequence number that was used to persist the results table 084 * @param personId the user id that was used to persist the results table. 085 * @return if the user ID used to persist the lookup results is the same user ID as the parameter 086 */ 087 public boolean isAuthorizedToAccessLookupResults(String lookupResultsSequenceNumber, String personId); 088 089 /** 090 * Returns whether a user is allowed to view the selected object IDs of the given sequence number 091 * 092 * @param lookupResultsSequenceNumber the lookup sequence number that was used to persist the selected object IDs 093 * @param personId the user id that was used to persist the selected object IDs 094 * @return if the user ID used to persist the selected object IDs is the same user ID as the parameter 095 */ 096 public boolean isAuthorizedToAccessSelectedObjectIds(String lookupResultsSequenceNumber, String personId); 097 098 /** 099 * 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