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