001: /*
002: * Copyright 2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.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/ecl1.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: */
016: package org.kuali.core.lookup;
017:
018: import java.io.Serializable;
019: import java.sql.Timestamp;
020: import java.util.Collection;
021: import java.util.List;
022: import java.util.Set;
023:
024: import org.kuali.core.bo.PersistableBusinessObject;
025: import org.kuali.core.web.ui.ResultRow;
026:
027: public interface LookupResultsService extends Serializable {
028: /**
029: * Persists a list of result row objects into a database. The lookup results sequence number acts like a key identifying the lookup
030: * results set. If results are persisted under the same sequence number, then the previously persisted list will be overwritten.
031: *
032: * @param lookupResultsSequenceNumber the lookup sequence number. Every time a user clicks "search", a new sequence number should be generated
033: * @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
034: * @param universalUserId the user that is performing the search. This prevents a malicious user from passing someone else's sequence number
035: * (which he can guess) and eventually retrieving it, possibly exposing sensitive data
036: * @throws Exception
037: */
038: public void persistResultsTable(String lookupResultsSequenceNumber,
039: List<ResultRow> resultTable, String universalUserId)
040: throws Exception;
041:
042: /**
043: * Persists a list of BO object IDs that have been selected for return to the calling document (the back location in lookup terminology).
044: * The lookup results sequence number acts like a key identifying the selected object IDs. If results are persisted under the same
045: * sequence number, then the previously persisted list will be overwritten.
046: *
047: * @param lookupResultsSequenceNumber the lookup sequence number. Every time a user clicks "search", a new sequence number should be generated
048: * @param selectedObjectIds A set of the object IDs of the selected rows.
049: * @param universalUserId the user that is performing the search. This prevents a malicious user from passing someone else's sequence number
050: * (which he can guess) and eventually retrieving it, possibly exposing sensitive data
051: * @throws Exception
052: */
053: public void persistSelectedObjectIds(
054: String lookupResultsSequenceNumber,
055: Set<String> selectedObjectIds, String universalUserId)
056: throws Exception;
057:
058: /**
059: * Returns the list of result rows that was persisted under the passed in sequence number
060: *
061: * @param lookupResultsSequenceNumber the lookup sequence number that was used to persist
062: * @param universalUserId the user id that was used to persist the results table. This prevents a malicious user from passing someone else's sequence number
063: * (which he can guess) and eventually retrieving it, possibly exposing sensitive data
064: * @return
065: * @throws Exception many reasons, including if the user id parameter does not match the user used to persist the results
066: */
067: public List<ResultRow> retrieveResultsTable(
068: String lookupResultsSequenceNumber, String universalUserId)
069: throws Exception;
070:
071: /**
072: * Returns the BOs that correspond to the selected objected IDs that were persisted under the given lookup results number
073: *
074: * DB data may have changed since the time the user clicked the "search" button (e.g. someone may have changed a value that was
075: * used as a query criterion). If so, implementations may or may not choose to handle this situation.
076: *
077: * @param lookupResultsSequenceNumber the lookup sequence number that was used to persist
078: * @param boClass The class of BO being retrieved from the lookup
079: * @param universalUserId the user id that was used to persist the results table. This prevents a malicious user from passing someone else's sequence number
080: * (which he can guess) and eventually retrieving it, possibly exposing sensitive data
081: * @return A list of BOs corresponding to the
082: * @throws Exception many reasons, including if the user id parameter does not match the user used to persist the results
083: */
084: public Collection<PersistableBusinessObject> retrieveSelectedResultBOs(
085: String lookupResultsSequenceNumber, Class boClass,
086: String universalUserId) throws Exception;
087:
088: /**
089: * Returns whether a user is allowed to view the lookup results of the given sequence number
090: *
091: * @param lookupResultsSequenceNumber the lookup sequence number that was used to persist the results table
092: * @param universalUserId the user id that was used to persist the results table.
093: * @return if the user ID used to persist the lookup results is the same user ID as the parameter
094: */
095: public boolean isAuthorizedToAccessLookupResults(
096: String lookupResultsSequenceNumber, String universalUserId);
097:
098: /**
099: * Returns whether a user is allowed to view the selected object IDs of the given sequence number
100: *
101: * @param lookupResultsSequenceNumber the lookup sequence number that was used to persist the selected object IDs
102: * @param universalUserId the user id that was used to persist the selected object IDs
103: * @return if the user ID used to persist the selected object IDs is the same user ID as the parameter
104: */
105: public boolean isAuthorizedToAccessSelectedObjectIds(
106: String lookupResultsSequenceNumber, String universalUserId);
107:
108: /**
109: * Removes the lookup results that were persisted under this lookup results sequence number
110: *
111: * @param lookupResultsSequenceNumber
112: * @throws Exception
113: */
114: public void clearPersistedLookupResults(
115: String lookupResultsSequenceNumber) throws Exception;
116:
117: /**
118: * Removes the lookup results that were persisted under this selected object IDs
119: *
120: * @param lookupResultsSequenceNumber
121: * @throws Exception
122: */
123: public void clearPersistedSelectedObjectIds(
124: String lookupResultsSequenceNumber) throws Exception;
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 deleteOldLookupResults(Timestamp expirationDate);
134:
135: /**
136: * removes all LookupResults BO where the lookup date attribute is older than
137: * the parameter
138: *
139: * @param expirationDate all LookupResults having a lookup date before this date
140: * will be removed
141: */
142: public void deleteOldSelectedObjectIds(Timestamp expirationDate);
143: }
|