- \r
- public void doSearch(String query) {\r
- pzreq.getSearch().setParameter(new CommandParameter("query","=",query)); \r
- doSearch();\r
- }\r
-\r
- public void doSearch() {\r
- try {\r
- if (errors.hasConfigurationErrors()) {\r
- logger.error("Ignoring search request due to configuration errors.");\r
- } else if (searchClient == null){\r
- logger.error("No search client defined. A client must either be pre-configured or selected before searching.");\r
- errors.addConfigurationError(new ConfigurationError("No client defined","Client is null","No search client defined. A client must be pre-configured or selected runtime, prior to searching."));\r
- } else {\r
- stateMgr.hasPendingStateChange("search",false);\r
- pzresp.resetSearchAndBeyond();\r
- pzreq.getRecord().removeParametersInState(); \r
- pzreq.getShow().setParameterInState(new CommandParameter("start","=",0)); \r
- logger.debug(Utils.objectId(this) + " is searching using "+pzreq.getCommand("search").getUrlEncodedParameterValue("query"));\r
- searchClient.setSearchCommand(pzreq.getCommand("search"));\r
- doCommand("search");\r
- }\r
- } catch (NullPointerException npe) {\r
- npe.printStackTrace(); \r
- }\r
- }\r
- \r
- public String doRecord() {\r
- if (errors.hasConfigurationErrors()) {\r
- logger.error("Ignoring record request due to configuration errors.");\r
- return "";\r
- } else if (!pzreq.getCommand("record").hasParameterValue("id")) {\r
- logger.debug("Ignoring record request due to no id parameter.");\r
- return "";\r
- } else if (pzresp.getSearch().hasApplicationError()) {\r
- logger.debug("Ignoring record request due search error.");\r
- return "";\r
- } else {\r
- logger.debug("Executing record command");\r
- doCommand("record");\r
- return pzresp.getRecord().getActiveClients();\r
- }\r
- }\r