- \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
- * @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
- } \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
- * Executes the command and parses the response to create data objects.\r
- * If the parsed response is of a known type it will be cached in 'pzresp'\r
- * \r
- * @param commandName The command to be executed\r
- * @return An XML response parsed to form a response data object\r
- */\r
- /*\r
- protected ResponseDataObject doCommand(String commandName) {\r
- Pazpar2Command command = pzreq.getCommand(commandName);\r
- if (command.spOnly() && isPazpar2Service()) {\r
- logger.warn("Skipping " + commandName + " - SP-only command, not supported by Pazpar2");\r
- return new ResponseDataObject();\r
- } else {\r
- logger.info("Request "+commandName + ". Search command is: "+ pzreq.getCommand("search").toString()); \r
- long start = System.currentTimeMillis();\r
- ResponseDataObject responseObject = command.run(); \r
- long end = System.currentTimeMillis();\r
- logger.debug("Executed " + command.getCommandName() + " in " + (end-start) + " ms." );\r
- return responseObject;\r
- }\r
- }\r
- */\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