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