\r
private static final long serialVersionUID = 3440277287081557861L;\r
private static Logger logger = Logger.getLogger(Pz2Bean.class);\r
+ private static Logger responseLogger = Logger.getLogger("com.indexdata.pz2utils4jsf.pazpar2.responses");\r
\r
protected SearchClient searchClient = null;\r
\r
public void doSearch() { \r
stateMgr.hasPendingStateChange("search",false);\r
pzresp.reset();\r
- // TODO: avoid state proliferation here:\r
- pzreq.getRecord().removeParameters();\r
- pzreq.getShow().setParameter(new CommandParameter("start","=",0)); \r
+ // resets some record and show command parameters without \r
+ // changing state or creating state change feedback\r
+ pzreq.getRecordInState().removeParametersSilently(); \r
+ pzreq.getShowInState().setParameterSilently(new CommandParameter("start","=",0)); \r
logger.debug(Utils.objectId(this) + " is searching using "+pzreq.getCommandReadOnly("search").getUrlEncodedParameterValue("query"));\r
doCommand("search"); \r
}\r
for (CommandThread thread : threadList) {\r
String commandName = thread.getCommand().getName();\r
String response = thread.getResponse();\r
- logger.debug("Response was: " + response);\r
+ responseLogger.debug("Response was: " + response);\r
Pazpar2ResponseData responseObject = Pazpar2ResponseParser.getParser().getDataObject(response);\r
pzresp.put(commandName, responseObject); \r
}\r
}\r
\r
public void setParameter (CommandParameter parameter) {\r
- logger.debug("Setting parameter " + parameter.getName() + "=" + parameter.getValueWithExpressions() + " to " + this.getName());\r
+ logger.debug(name + " setting parameter " + parameter.getName() + "=" + parameter.getValueWithExpressions() + " to " + this.getName());\r
parameters.put(parameter.getName(),parameter);\r
stateMgr.checkIn(this);\r
}\r
\r
public void setParameters (CommandParameter... params) {\r
for (CommandParameter param : params) {\r
- logger.debug("Setting parameter " + param.getName() + "=" + param.getValueWithExpressions() + " to " + this.getName());\r
+ logger.debug(name + " setting parameter " + param.getName() + "=" + param.getValueWithExpressions() + " to " + this.getName());\r
parameters.put(param.getName(),param);\r
}\r
stateMgr.checkIn(this);\r
\r
\r
public void setParameterSilently (CommandParameter parameter) {\r
- logger.debug("Setting parameter silently " + parameter.getName() + "=" + parameter.getValueWithExpressions() + " to " + this.getName());\r
+ logger.debug(name + " setting parameter silently " + parameter.getName() + "=" + parameter.getValueWithExpressions() + " to " + this.getName());\r
parameters.put(parameter.getName(),parameter); \r
}\r
\r
stateMgr.checkIn(this);\r
}\r
\r
+ public void removeParametersSilently() {\r
+ parameters = new HashMap<String,CommandParameter>(); \r
+ }\r
+\r
+ \r
public boolean hasParameters () {\r
return (parameters.keySet().size()>0);\r
}\r
\r
public String getSession() {\r
return getParameterValue("session");\r
- }\r
-\r
- \r
- \r
- \r
+ } \r
}\r
return (ShowCommand) (stateMgr.checkOut(SHOW));\r
}\r
\r
+ public ShowCommand getShowInState () {\r
+ return (ShowCommand) (stateMgr.getCurrentState().getCommand(SHOW));\r
+ }\r
+ \r
public RecordCommand getRecord() {\r
return (RecordCommand) (stateMgr.checkOut(RECORD));\r
}\r
\r
+ public RecordCommand getRecordInState() {\r
+ return (RecordCommand)stateMgr.getCurrentState().getCommand(RECORD);\r
+ }\r
+ \r
public TermlistCommand getTermlist() {\r
return (TermlistCommand) (stateMgr.checkOut(TERMLIST));\r
}\r
\r
public ShowCommand(StateManager stateMgr) {\r
super("show",stateMgr);\r
+ setParameterSilently(new CommandParameter("start","=","0"));\r
}\r
\r
/**\r
logger.debug("Getting " + commandName + " from state manager.");\r
return getCurrentState().getCommand(commandName).copy();\r
}\r
- \r
+ \r
public CommandReadOnly getCommand (String commandName) {\r
return getCurrentState().getCommand(commandName);\r
}\r