+ \r
+ /**\r
+ * This methods main purpose is to support browser history.\r
+ * \r
+ * When the browsers back or forward buttons are pressed, a \r
+ * re-search /might/ be required - namely if the query changes.\r
+ * So, as the UI requests updates of the page (show,facets,\r
+ * etc) this method checks if a search must be executed\r
+ * before those updates are performed.\r
+ * \r
+ * It will consequently also run a search if the UI updates a\r
+ * search parameter without actually explicitly executing the search \r
+ * before setting of the polling.\r
+ * \r
+ * @see {@link com.indexdata.mkjsf.pazpar2.state.StateManager#setCurrentStateKey} \r
+ * @param commands\r
+ */\r
+ protected void handleQueryStateChanges (String commands) {\r
+ if (stateMgr.hasPendingStateChange("search") && hasQuery()) { \r
+ logger.info("Triggered search: Found pending search change [" + pzreq.getCommand("search").toString() + "], doing search before updating " + commands); \r
+ pzreq.getSearch().run();\r
+ pzresp.getSearch().setIsNew(false);\r
+ } \r
+ if (stateMgr.hasPendingStateChange("record") && ! commands.equals("record")) { \r
+ logger.debug("Found pending record ID change. Doing record before updating " + commands);\r
+ stateMgr.hasPendingStateChange("record",false);\r
+ pzreq.getRecord().run();\r
+ }\r
+ }\r
+ \r
+ /**\r
+ * Used by the state manager to notify Pz2Service about state changes\r
+ */\r
+ @Override\r
+ public void stateUpdated(String commandName) {\r
+ logger.debug("State change reported for [" + commandName + "]");\r
+ if (commandName.equals("show")) {\r
+ logger.debug("Updating show");\r
+ update(commandName);\r
+ } \r
+ }\r
+\r
+ \r
+ /**\r
+ * Will retrieve -- or alternatively remove -- the record with the given \r
+ * recid from memory.\r
+ * \r
+ * A pazpar2 'record' command will then be issued. The part of the UI \r
+ * showing record data should thus be re-rendered.\r
+ * \r
+ * @param recid\r
+ * @return\r
+ */\r