X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fcom%2Findexdata%2Fpz2utils4jsf%2Fpazpar2%2Fcommands%2FShowCommand.java;h=6522b08562c461ec62fe74cadda0cd01ceb1320d;hb=f9b06d877390d5b980dc3ad9c86b2b334cf550c9;hp=7a0fc0290acf06f64631402c2caec4288f54baa7;hpb=437baaa9cfedf7b5abe9dd66b15a531949121136;p=mkjsf-moved-to-github.git diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/ShowCommand.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/ShowCommand.java index 7a0fc02..6522b08 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/ShowCommand.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/commands/ShowCommand.java @@ -10,23 +10,75 @@ public class ShowCommand extends Pazpar2Command { super("show",stateMgr); } + /** + * Sets the sort order for results, the updates the 'show' data object + * from pazpar2. Set valid sort options in the documentation for pazpar2. + * + * The parts of the UI that display 'show' data should be rendered following + * this request. + * + * @param sortOption + */ public void setSort (String sort) { setParameter(new CommandParameter("sort","=",sort)); } + /** + * Retrieves the current sort order for results + * @return sort order - i.e. 'relevance' + */ public String getSort () { return getParameter("sort") != null ? getParameter("sort").value : "relevance"; } + /** + * Sets the number of records that pazpar2 should show at a time. Is + * followed by an update of the show data object from pazpar2. + * + * To be used by the UI for paging. After setting page size the parts + * of the UI that displays 'show' data should be rendered. + * + * @param perPageOption i.e. 10, default is 20. + */ public void setPageSize (String perPageOption) { setParameters(new CommandParameter("num","=",perPageOption), new CommandParameter("start","=",0)); } + /** + * Retrieves the currently defined number of items to show at a time + * + * @return number of result records that will be shown from pazpar2 + */ public String getPageSize () { return getParameter("num") != null ? getParameter("num").value : "20"; } + /** + * Sets the first record to show - starting at record '0'. After setting + * first record number, the 'show' data object will be updated from pazpar2, + * and the parts of the UI displaying show data should be re-rendered. + * + * To be used by the UI for paging. + * + * @param start first record to show + */ + public void setStart (int start) { + setParameter(new CommandParameter("start","=",start)); + } + + /** + * Retrieves the sequence number of the record that pazpaz2 will return as + * the first record in 'show' + * + * @return sequence number of the first record to be shown (numbering starting at '0') + * + */ + public int getStart() { + return getParameter("start") != null ? Integer.parseInt(getParameter("start").value) : 0; + } + + public ShowCommand copy () { ShowCommand newCommand = new ShowCommand(stateMgr); for (String parameterName : parameters.keySet()) {