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.errors.ErrorInterface;
\r
8 import com.indexdata.pz2utils4jsf.pazpar2.data.ByTarget;
\r
9 import com.indexdata.pz2utils4jsf.pazpar2.data.RecordResponse;
\r
10 import com.indexdata.pz2utils4jsf.pazpar2.data.ShowResponse;
\r
11 import com.indexdata.pz2utils4jsf.pazpar2.data.StatResponse;
\r
12 import com.indexdata.pz2utils4jsf.pazpar2.data.TermListsResponse;
\r
13 import com.indexdata.pz2utils4jsf.pazpar2.data.TermResponse;
\r
15 public interface Pz2Interface extends Serializable {
\r
18 * Executes a Pazpar2 search using the given query string
\r
22 public void doSearch(String query);
\r
25 * Executes a Pazpar2 search using the current query
\r
27 public void doSearch();
\r
30 * Updates display data objects by issuing the following pazpar2 commands:
\r
31 * 'show', 'stat', 'termlist' and 'bytarget'.
\r
33 * Returns a count of the remaining active clients from the most recent search.
\r
35 * After refreshing the data from pazpar2 the UI components displaying those
\r
36 * data should be re-rendered.
\r
38 * @return count of activeclients
\r
40 public String update();
\r
43 * Updates the data objects given by a comma separated list of one or more commands -
\r
44 * i.e. "show,state,termlist,bytarget".
\r
46 * May not be useful for the UI directly.
\r
48 * @param commands Command separated list of pazpar2 commands.
\r
49 * @return count of activeclients
\r
52 public String update (String commands);
\r
55 public void setFilter(String filterExpression);
\r
57 public String getFilter();
\r
61 * Adds a single target filter to restrict the current query by,
\r
62 * then executes the current search.
\r
64 * This is a special case of the general setFilter function,
\r
65 * allowing to associate a descriptive target name with the
\r
66 * filter expression for display in UI.
\r
68 * @param targetId pazpar2's ID for the target to limit by
\r
69 * @param targetName a descriptive name for the target
\r
71 public void setSingleTargetFilter (String targetId, String targetName);
\r
74 * Removes the current target filter from the search
\r
77 public void removeSingleTargetFilter ();
\r
81 * @return The target filter set on the current search command
\r
83 public SingleTargetFilter getSingleTargetFilter();
\r
86 * Resolves if the current search command has a target filter - to
\r
87 * be used by the UI for conditional rendering of target filter info.
\r
89 * @return true if the current search command is limited by a target
\r
92 public boolean hasSingleTargetFilter();
\r
95 * Will retrieve or remove the record with the given recid from memory.
\r
97 * A pazpar2 'record' command will then be issued. The part of the UI
\r
98 * showing record data should thus be re-rendered.
\r
103 public String toggleRecord(String recid);
\r
106 * Returns the 'show' data as retrieved from pazpar2 by the most
\r
107 * recent update request
\r
109 * @return pazpar2 'show' response object
\r
111 public ShowResponse getShow();
\r
114 * Returns the 'stat' data as retrieved from pazpar2 by the most
\r
115 * recent update request
\r
117 * @return pazpar2 'stat' response object
\r
119 public StatResponse getStat();
\r
122 * Resolves whether the backend has a record with the given recid in memory
\r
124 * @return true if the bean currently holds the record with recid
\r
126 public boolean hasRecord (String recId);
\r
129 * Resolves whether the back-end has any records in memory (in 'show') for
\r
132 * @return true if there are records to display
\r
134 public boolean hasRecords ();
\r
137 * Returns a pazpar2 record as retrieved by the most recent 'record'
\r
139 * @return record data object
\r
141 public RecordResponse getRecord();
\r
144 * Returns a set of term lists (targets and facets) as retrieved by the
\r
145 * most recent 'termlist' command
\r
146 * @return set of termlists
\r
148 public TermListsResponse getTermLists ();
\r
151 * Returns up to 'count' terms from the facet given by the 'facet' parameter
\r
152 * @param facet name of the facet
\r
153 * @param count maximum number of facet terms to return
\r
154 * @return facet term list limited to 'count' terms
\r
156 public List<TermResponse> getFacetTerms (String facet, int count);
\r
159 * Returns all the terms of a given facet - or as many as pazpar2 returns
\r
160 * @param facet name of the facet
\r
161 * @return facet term list
\r
163 public List<TermResponse> getFacetTerms (String facet);
\r
166 * Returns a ByTarget data object as retrieved by the most recent 'bytarget'
\r
167 * request to pazpar2
\r
169 * @return ByTarget response data object
\r
171 public ByTarget getByTarget();
\r
174 * Initiates a pager object, a component holding the data to draw a sequence
\r
175 * of page numbers to navigate by and mechanisms to navigate with
\r
177 * @param pageRange number of pages to display in the pager
\r
178 * @return ResultsPager the initiated pager component
\r
180 public ResultsPager setPager(int pageRange);
\r
183 * Gives a component for drawing a pager to navigate by.
\r
184 * @return ResultsPager pager component
\r
186 public ResultsPager getPager();
\r
189 * Returns the current hash key used, as used for internal session state tracking
\r
190 * and potentially for browser history entries as well
\r
192 * A UI author would not normally be concerned with retrieving this. It's used by the
\r
193 * framework internally
\r
195 * @return string that can be used for browsers window.location.hash
\r
197 public String getCurrentStateKey ();
\r
200 * Sets the current state key, i.e. when user clicks back or forward in browser history.
\r
201 * Would normally be automatically handled by the frameworks components.
\r
203 * @param key corresponding to browsers hash string
\r
205 public void setCurrentStateKey(String key);
\r
208 * @return true if any errors encountered so far
\r
210 public boolean hasErrors();
\r
214 * @return true if errors encountered during execution of commands
\r
216 public boolean hasCommandErrors();
\r
220 * @return true if errors encountered when configuring the service
\r
222 public boolean hasConfigurationErrors();
\r
225 * Returns one (of possibly multiple) errors encountered during execution of commands
\r
226 * Will prefer to show the search errors - if any - as the search command is usually
\r
231 public ErrorInterface getCommandError();
\r
234 * Returns all errors encountered during configuration of the application, in particular
\r
235 * the Pazpar2 client.
\r
239 public List<ErrorInterface> getConfigurationErrors();
\r