Example #1
0
 /**
  * This methods main purpose is to support browser history.
  *
  * <p>When the browsers back or forward buttons are pressed, a re-search /might/ be required -
  * namely if the query changes. So, as the UI requests updates of the page (show,facets, etc) this
  * method checks if a search must be executed before those updates are performed.
  *
  * <p>It will consequently also run a search if the UI updates a search parameter without actually
  * explicitly executing the search before setting of the polling.
  *
  * @see {@link com.indexdata.mkjsf.pazpar2.state.StateManager#setCurrentStateKey}
  * @param commands
  */
 protected void handleQueryStateChanges(String commands) {
   if (stateMgr.hasPendingStateChange("search") && hasQuery()) {
     logger.info(
         "Triggered search: Found pending search change ["
             + pzreq.getCommand("search").toString()
             + "], doing search before updating "
             + commands);
     pzreq.getSearch().run();
     pzresp.getSearch().setIsNew(false);
   }
   if (stateMgr.hasPendingStateChange("record") && !commands.equals("record")) {
     logger.debug("Found pending record ID change. Doing record before updating " + commands);
     stateMgr.hasPendingStateChange("record", false);
     pzreq.getRecord().run();
   }
 }