Moves request logic from pz2bean to individual commands
[mkjsf-moved-to-github.git] / src / main / java / com / indexdata / mkjsf / pazpar2 / Pz2Interface.java
1 package com.indexdata.mkjsf.pazpar2;\r
2 \r
3 import java.io.Serializable;\r
4 \r
5 import com.indexdata.mkjsf.controls.ResultsPager;\r
6 \r
7 public interface Pz2Interface extends Serializable {\r
8   \r
9   /**\r
10    * Executes a Pazpar2 search using the given query string\r
11    * \r
12    * @param query\r
13    */\r
14   //public void doSearch(String query);\r
15   \r
16   /**\r
17    * Executes a Pazpar2 search using the current query \r
18    */\r
19   // public void doSearch();\r
20   \r
21   /**\r
22    * Executes a Pazpar2 record requests\r
23    * @return Active clients for the record request\r
24    */\r
25   // public String doRecord();\r
26   \r
27   /**\r
28    * Updates display data objects by issuing the following pazpar2 commands: \r
29    * 'show', 'stat', 'termlist' and 'bytarget'.\r
30    *  \r
31    * Returns a count of the remaining active clients from the most recent search.\r
32    * \r
33    * After refreshing the data from pazpar2 the UI components displaying those \r
34    * data should be re-rendered.\r
35    * \r
36    * @return count of activeclients \r
37    */\r
38   public String update();\r
39   \r
40   /**\r
41    * Updates the data objects given by a comma separated list of one or more commands - \r
42    * i.e. "show,state,termlist,bytarget".\r
43    *  \r
44    * May not be useful for the UI directly. \r
45    *  \r
46    * @param commands Command separated list of pazpar2 commands.\r
47    * @return count of activeclients \r
48    * \r
49    */\r
50   public String update (String commands);\r
51             \r
52   /**\r
53    * Will retrieve or remove the record with the given recid from memory.\r
54    * \r
55    * A pazpar2 'record' command will then be issued. The part of the UI \r
56    * showing record data should thus be re-rendered.\r
57    *  \r
58    * @param recid\r
59    * @return\r
60    */\r
61   public String toggleRecord(String recid);\r
62       \r
63   /**\r
64    * Resolves whether the backend has a record with the given recid in memory \r
65    * \r
66    * @return true if the bean currently holds the record with recid\r
67    */  \r
68   public boolean hasRecord (String recId);\r
69           \r
70     \r
71   /**\r
72    * Initiates a pager object, a component holding the data to draw a sequence\r
73    * of page numbers to navigate by and mechanisms to navigate with\r
74    * \r
75    * @param pageRange number of pages to display in the pager\r
76    * @return ResultsPager the initiated pager component\r
77    */\r
78   public ResultsPager setPager(int pageRange);\r
79   \r
80   /**\r
81    * Gives a component for drawing a pager to navigate by.\r
82    * @return ResultsPager pager component\r
83    */\r
84   public ResultsPager getPager();\r
85   \r
86   /**\r
87    * Returns the current hash key used, as used for internal session state tracking\r
88    * and potentially for browser history entries as well\r
89    * \r
90    * A UI author would not normally be concerned with retrieving this. It's used by the\r
91    * framework internally\r
92    *  \r
93    * @return string that can be used for browsers window.location.hash\r
94    */\r
95   public String getCurrentStateKey ();\r
96       \r
97   /**\r
98    * Sets the current state key, i.e. when user clicks back or forward in browser history.\r
99    * Would normally be automatically handled by the frameworks components.\r
100    *  \r
101    * @param key corresponding to browsers hash string\r
102    */\r
103   public void setCurrentStateKey(String key);\r
104   \r
105   public boolean getAuthenticationRequired ();\r
106 \r
107   public String getCheckHistory ();\r
108   public String getWatchActiveclients ();\r
109   public String getWatchActiveclientsRecord ();\r
110 \r
111   public void setServiceTypePZ2 ();\r
112   public void setServiceTypeSP ();\r
113   public void setServiceTypeTBD ();\r
114   public void setServiceUrl(String url);\r
115   public String getServiceUrl();\r
116   public String getServiceType();\r
117   public boolean isPazpar2Service ();  \r
118   public boolean isServiceProxyService();  \r
119   public boolean serviceIsToBeDecided ();\r
120   public SearchClient getSearchClient();\r
121 }\r