1 package com.indexdata.pz2utils4jsf.pazpar2;
\r
3 import java.io.Serializable;
\r
4 import java.util.List;
\r
6 import com.indexdata.pz2utils4jsf.controls.ResultsPager;
\r
7 import com.indexdata.pz2utils4jsf.pazpar2.TargetFilter;
\r
8 import com.indexdata.pz2utils4jsf.pazpar2.data.ApplicationError;
\r
9 import com.indexdata.pz2utils4jsf.pazpar2.data.ByTarget;
\r
10 import com.indexdata.pz2utils4jsf.pazpar2.data.RecordResponse;
\r
11 import com.indexdata.pz2utils4jsf.pazpar2.data.ShowResponse;
\r
12 import com.indexdata.pz2utils4jsf.pazpar2.data.StatResponse;
\r
13 import com.indexdata.pz2utils4jsf.pazpar2.data.TermListsResponse;
\r
14 import com.indexdata.pz2utils4jsf.pazpar2.data.TermResponse;
\r
16 public interface Pz2Interface extends Serializable {
\r
19 * Executes a Pazpar2 search using the given query string
\r
23 public void doSearch(String query);
\r
26 * Executes a Pazpar2 search using the current query
\r
28 public void doSearch();
\r
31 * Updates display data objects by issuing the following pazpar2 commands:
\r
32 * 'show', 'stat', 'termlist' and 'bytarget'.
\r
34 * Returns a count of the remaining active clients from the most recent search.
\r
36 * After refreshing the data from pazpar2 the UI components displaying those
\r
37 * data should be re-rendered.
\r
39 * @return count of activeclients
\r
41 public String update();
\r
44 * Updates the data objects given by a comma separated list of one or more commands -
\r
45 * i.e. "show,state,termlist,bytarget".
\r
47 * May not be useful for the UI directly.
\r
49 * @param commands Command separated list of pazpar2 commands.
\r
50 * @return count of activeclients
\r
53 public String update (String commands);
\r
56 * Sets a query to used by the next search command
\r
58 * @param query a query on pazpar2 query syntax
\r
61 public void setQuery (String query);
\r
64 * Gets the current query
\r
65 * @return a pazpar2 query string
\r
67 public String getQuery ();
\r
70 * Sets a facet to limit the current query by,
\r
71 * then executes the search
\r
73 * @param facetKey i.e. 'au' for author
\r
74 * @param term i.e. 'Dickens, Charles'
\r
76 public void setFacet(String facetKey, String term);
\r
79 * Removes a facet set by setFacet(...), then executes
\r
82 * Will not remove facets set by setFacetOnQuery(...)
\r
84 * @param facetKey i.e. 'au' for author
\r
85 * @param term i.e. 'Dickens, Charles'
\r
87 public void removeFacet (String facetKey, String term);
\r
90 * Sets a facet to limit the current query by. The
\r
91 * facet is appended to the query string itself (rather
\r
92 * as a separately managed entity. It will thus appear
\r
93 * in a query field as retrieved by getQuery(). It will
\r
94 * not be removed by removeFacet(...)
\r
96 * @param facetKey i.e. 'au' for author
\r
97 * @param term i.e. 'Dickens, Charles'
\r
99 public void setFacetOnQuery(String facetKey, String term);
\r
102 * Adds a target filter to limit the current query by, then
\r
103 * executes the current search.
\r
105 * @param targetId pazpar2's ID for the target to limit by
\r
106 * @param targetName a descriptive name for the target
\r
108 public void setTargetFilter (String targetId, String targetName);
\r
111 * Removes the current target filter from the search
\r
114 public void removeTargetFilter ();
\r
118 * @return The target filter set on the current search command
\r
120 public TargetFilter getTargetFilter();
\r
123 * Resolves if the current search command has a target filter - to
\r
124 * be used by the UI for conditional rendering of target filter info.
\r
126 * @return true if the current search command is limited by a target
\r
129 public boolean hasTargetFilter();
\r
132 * Sets the ordering of records (hits) in the 'show' display object
\r
136 * Sets the sort order for results, the updates the 'show' data object
\r
137 * from pazpar2. Set valid sort options in the documentation for pazpar2.
\r
139 * The parts of the UI that display 'show' data should be rendered following
\r
142 * @param sortOption
\r
144 public void setSort(String sortOption);
\r
147 * Retrieves the current sort order for results
\r
148 * @return sort order - i.e. 'relevance'
\r
150 public String getSort();
\r
153 * Sets the number of records that pazpar2 should show at a time. Is
\r
154 * followed by an update of the show data object from pazpar2.
\r
156 * To be used by the UI for paging. After setting page size the parts
\r
157 * of the UI that displays 'show' data should be rendered.
\r
159 * @param perPageOption i.e. 10, default is 20.
\r
161 public void setPageSize (int perPageOption);
\r
164 * Retrieves the currently defined number of items to show at a time
\r
166 * @return number of result records that will be shown from pazpar2
\r
168 public int getPageSize();
\r
171 * Sets the first record to show - starting at record '0'. After setting
\r
172 * first record number, the 'show' data object will be updated from pazpar2,
\r
173 * and the parts of the UI displaying show data should be re-rendered.
\r
175 * To be used by the UI for paging.
\r
177 * @param start first record to show
\r
179 public void setStart (int start);
\r
182 * Retrieves the sequence number of the record that pazpaz2 will return as
\r
183 * the first record in 'show'
\r
185 * @return sequence number of the first record to be shown (numbering starting at '0')
\r
188 public int getStart();
\r
191 * Will retrieve or remove the record with the given recid from memory.
\r
193 * A pazpar2 'record' command will then be issued. The part of the UI
\r
194 * showing record data should thus be re-rendered.
\r
199 public String toggleRecord(String recid);
\r
202 * Returns the 'show' data as retrieved from pazpar2 by the most
\r
203 * recent update request
\r
205 * @return pazpar2 'show' response object
\r
207 public ShowResponse getShow();
\r
210 * Returns the 'stat' data as retrieved from pazpar2 by the most
\r
211 * recent update request
\r
213 * @return pazpar2 'stat' response object
\r
215 public StatResponse getStat();
\r
218 * Resolves whether the backend has a record with the given recid in memory
\r
220 * @return true if the bean currently holds the record with recid
\r
222 public boolean hasRecord (String recId);
\r
225 * Resolves whether the back-end has any records in memory (in 'show') for
\r
228 * @return true if there are records to display
\r
230 public boolean hasRecords ();
\r
233 * Returns a pazpar2 record as retrieved by the most recent 'record'
\r
235 * @return record data object
\r
237 public RecordResponse getRecord();
\r
240 * Returns a set of term lists (targets and facets) as retrieved by the
\r
241 * most recent 'termlist' command
\r
242 * @return set of termlists
\r
244 public TermListsResponse getTermLists ();
\r
247 * Returns up to 'count' terms from the facet given by the 'facet' parameter
\r
248 * @param facet name of the facet
\r
249 * @param count maximum number of facet terms to return
\r
250 * @return facet term list limited to 'count' terms
\r
252 public List<TermResponse> getFacetTerms (String facet, int count);
\r
255 * Returns all the terms of a given facet - or as many as pazpar2 returns
\r
256 * @param facet name of the facet
\r
257 * @return facet term list
\r
259 public List<TermResponse> getFacetTerms (String facet);
\r
262 * Returns a ByTarget data object as retrieved by the most recent 'bytarget'
\r
263 * request to pazpar2
\r
265 * @return ByTarget response data object
\r
267 public ByTarget getByTarget();
\r
270 * Initiates a pager object, a component holding the data to draw a sequence
\r
271 * of page numbers to navigate by and mechanisms to navigate with
\r
273 * @param pageRange number of pages to display in the pager
\r
274 * @return ResultsPager the initiated pager component
\r
276 public ResultsPager setPager(int pageRange);
\r
279 * Gives a component for drawing a pager to navigate by.
\r
280 * @return ResultsPager pager component
\r
282 public ResultsPager getPager();
\r
285 * Returns the current hash key used, as used for internal session state tracking
\r
286 * and potentially for browser history entries as well
\r
288 * A UI author would not normally be concerned with retrieving this. It's used by the
\r
289 * framework internally
\r
291 * @return string that can be used for browsers window.location.hash
\r
293 public String getCurrentStateKey ();
\r
296 * Sets the current state key, i.e. when user clicks back or forward in browser history.
\r
297 * Would normally be automatically handled by the frameworks components.
\r
299 * @param key corresponding to browsers hash string
\r
301 public void setCurrentStateKey(String key);
\r
303 public boolean hasErrors();
\r
305 public ApplicationError getOneError();
\r