001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/citations/tags/sakai_2-4-1/citations-api/api/src/java/org/sakaiproject/citation/api/ActiveSearch.java $
003: * $Id: ActiveSearch.java 28744 2007-04-12 01:38:51Z ajpoland@iupui.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.citation.api;
021:
022: import java.util.List;
023: import java.util.Map;
024:
025: import org.sakaiproject.citation.util.api.SearchException;
026: import org.sakaiproject.citation.util.api.SearchQuery;
027:
028: /**
029: *
030: */
031: public interface ActiveSearch {
032: public static final String BASIC_SEARCH_TYPE = "basic";
033: public static final String ADVANCED_SEARCH_TYPE = "advanced";
034:
035: /*******************************************************
036: * Search results
037: *******************************************************/
038:
039: /**
040: * Access the index of the first record in the current view page. Record indexes start at 1.
041: * @return
042: */
043: public int getFirstRecordIndex();
044:
045: /**
046: * @return
047: */
048: public Map getIndex();
049:
050: /**
051: * Access the index of the last record in the current view page. Record indexes start at 1,
052: * and the maximum legal value equals the size() of the full search results list or start
053: * index of the next page minus 1, which is start index of the current page plus the size of
054: * the current page minus 1.
055: * @return
056: */
057: public int getLastRecordIndex();
058:
059: /**
060: * @return
061: */
062: public Integer getNumRecordsFetched();
063:
064: /**
065: * @return
066: */
067: public Integer getNumRecordsFound();
068:
069: /**
070: * @return
071: */
072: public Integer getNumRecordsMerged();
073:
074: /**
075: * @return
076: */
077: public Integer getPageSize();
078:
079: /**
080: * @return
081: */
082: public String getRepositoryId();
083:
084: /**
085: * @return
086: */
087: public String getRepositoryName();
088:
089: /**
090: * @return
091: */
092: public SearchQuery getBasicQuery();
093:
094: /**
095: *
096: * @return
097: */
098: public SearchQuery getAdvancedQuery();
099:
100: /**
101: * @return
102: */
103: public String getSearchId();
104:
105: /**
106: * Gets the thread that is handling the active search
107: *
108: * @return Thread that is handling this active search
109: */
110: public Thread getSearchThread();
111:
112: /**
113: *
114: * @return
115: */
116: public String getSearchType();
117:
118: /**
119: * @return
120: */
121: public CitationCollection getSearchResults();
122:
123: /**
124: * @return
125: */
126: public String getSortBy();
127:
128: /**
129: * @return
130: */
131: public Integer getStartRecord();
132:
133: /**
134: * Access the status message for this search.
135: * @return The current status message.
136: */
137: public String getStatusMessage();
138:
139: /**
140: * Access the zero-based index indicating the page that was most recently accessed using the
141: * viewPage method.
142: * @return
143: */
144: public int getViewPageNumber();
145:
146: /**
147: * Access the zero-based index indicating the page that was most recently accessed using the
148: * viewPage method.
149: * @return
150: */
151: public int getViewPageSize();
152:
153: /**
154: * @return the firstPage
155: */
156: public boolean isFirstPage();
157:
158: /**
159: * @return the lastPage
160: */
161: public boolean isLastPage();
162:
163: /**
164: * @return the newSearch
165: */
166: public boolean isNewSearch();
167:
168: /**
169: *
170: */
171: public void prepareForNextPage();
172:
173: /**
174: *
175: * @param advancedCriteria
176: */
177: public void setAdvancedQuery(SearchQuery advancedCriteria);
178:
179: /**
180: * @param searchCriteria
181: */
182: public void setBasicQuery(SearchQuery basicCriteria);
183:
184: /**
185: * @param firstPage
186: */
187: public void setFirstPage(boolean firstPage);
188:
189: /**
190: * @param index
191: */
192: public void setIndex(Map index);
193:
194: /**
195: * @param lastPage
196: */
197: public void setLastPage(boolean lastPage);
198:
199: /**
200: * @param newSearch
201: */
202: public void setNewSearch(boolean newSearch);
203:
204: /**
205: * @param numRecordsFetched
206: */
207: public void setNumRecordsFetched(Integer numRecordsFetched);
208:
209: /**
210: * @param numRecordsFound
211: */
212: public void setNumRecordsFound(Integer numRecordsFound);
213:
214: /**
215: * @param numRecordsMerged
216: */
217: public void setNumRecordsMerged(Integer numRecordsMerged);
218:
219: /**
220: * @param pageSize
221: */
222: public void setPageSize(Integer pageSize);
223:
224: /**
225: * @param pageSize
226: */
227: public void setPageSize(String pageSize);
228:
229: /*******************************************************
230: * Current display page
231: *******************************************************/
232:
233: /**
234: * @param repositoryName
235: */
236: public void setRepositoryName(String repositoryName);
237:
238: /**
239: * Sets the thread that is handling the active search
240: *
241: * @param searchThread
242: */
243: public void setSearchThread(Thread searchThread);
244:
245: /**
246: *
247: * @param searchType
248: */
249: public void setSearchType(String searchType);
250:
251: /**
252: * @param sortBy
253: */
254: public void setSortBy(String sortBy);
255:
256: /**
257: * @param startRecord
258: */
259: public void setStartRecord(Integer startRecord);
260:
261: /**
262: * @param startRecord
263: */
264: public void setStartRecord(String startRecord);
265:
266: /**
267: * Set the status message for this search to null.
268: */
269: public void setStatusMessage();
270:
271: /**
272: * Set the status message for this search.
273: * @param msg The message to set.
274: */
275: public void setStatusMessage(String msg);
276:
277: /**
278: * @param size
279: */
280: public void setViewPageSize(int size);
281:
282: /**
283: * This method gives access to a list of citations representing the first page of output based
284: * on a predefined "page size". In zero-based page numbering, this method returns page zero.
285: */
286: public List viewPage();
287:
288: /**
289: * This method gives access to a list of citations representing a page of output based on a
290: * predefined "page size". The page number is zero-based. This method can return any page
291: * that has already been accessed or the "next" page, a page that can be generated by retrieving
292: * no more than <i>pageSize</i> additional citations.
293: * @param page The zero-based index of the desired page.
294: * @throws SearchException if the requested page is beyond the next page (i.e. it can't be
295: * supplied without doing more than one additional search of size <i>pageSize</i>.
296: */
297: public List viewPage(int page) throws SearchException;
298: }
|