import com.indexdata.pz2utils4jsf.pazpar2.commands.CommandReadOnly;\r
import com.indexdata.pz2utils4jsf.pazpar2.commands.Pazpar2Command;\r
import com.indexdata.pz2utils4jsf.pazpar2.commands.Pazpar2Commands;\r
-import com.indexdata.pz2utils4jsf.pazpar2.commands.SearchCommand;\r
import com.indexdata.pz2utils4jsf.pazpar2.data.ByTarget;\r
import com.indexdata.pz2utils4jsf.pazpar2.data.CommandError;\r
import com.indexdata.pz2utils4jsf.pazpar2.data.Pazpar2ResponseData;\r
}\r
\r
}\r
- \r
- /*\r
- public void setQuery (String query) {\r
- logger.debug("Creating new command parameter for " + query);\r
- setCommandParameter("search",new CommandParameter("query","=",query));\r
- }\r
- \r
- public String getQuery () {\r
- return getCommandParameterValueSimple("search","query",null);\r
- }\r
- */\r
- \r
- public void setFacet (String facetKey, String term) { \r
- if (term != null && term.length()>0) { \r
- Pazpar2Command command = req.getCommand("search");\r
- command.getParameter("query").addExpression(new Expression(facetKey,"=",term));\r
- stateMgr.checkIn(command);\r
- doSearch();\r
- } \r
- }\r
- \r
- public void setFacetOnQuery (String facetKey, String term) {\r
- String facetExpression = facetKey + "=" + term; \r
- if (term != null && term.length()>0) {\r
- String currentQuery= req.getCommandReadOnly("search").getParameterValue("query");\r
- setCommandParameter("search",new CommandParameter("query","=", currentQuery + " and " + facetExpression));\r
- doSearch(); \r
- } \r
- }\r
- \r
- public void removeFacet(String facetKey, String term) {\r
- SearchCommand command = req.getSearch();\r
- command.getParameter("query").removeExpression(new Expression(facetKey,"=",term));\r
- stateMgr.checkIn(command);\r
- doSearch();\r
- }\r
- \r
+ \r
public void setSingleTargetFilter (String targetId, String targetName) { \r
if (hasSingleTargetFilter(new SingleTargetFilter(targetId,targetName))) {\r
logger.debug("Already using target filter " + this.singleTargetFilter.getFilterExpression());\r
dataObjects.put("record", new RecordResponse());\r
return "";\r
} else {\r
- setRecordId(recId);\r
+ req.getRecord().setRecordId(recId);\r
return doCommand("record");\r
}\r
}\r
\r
@Override\r
- public void setRecordId(String recId) {\r
- setCommandParameter("record",new CommandParameter("id","=",recId));\r
- }\r
- \r
- @Override\r
- public String getRecordId () {\r
- return getCommandParameterValue("record","recid","");\r
- }\r
- \r
- @Override\r
public boolean hasRecord (String recId) {\r
return req.getCommandReadOnly("record").hasParameters() && getRecord().getRecId().equals(recId);\r
}\r
}\r
\r
@Override\r
- public void stateUpdate(String commandName) {\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
\r
private void updateListeners (String command) {\r
for (StateListener lsnr : listeners) {\r
- lsnr.stateUpdate(command);\r
+ lsnr.stateUpdated(command);\r
}\r
}\r
\r
Pazpar2State state = new Pazpar2State(getCurrentState(),command);\r
states.put(state.getKey(), state);\r
currentKey = state.getKey();\r
- hasPendingStateChange(command.getName(),new Boolean(true));\r
+ hasPendingStateChange(command.getName(),new Boolean(true)); \r
+ logger.debug("Updating listeners with state change from " + command);\r
+ updateListeners(command.getName()); \r
} else {\r
logger.debug("Command " + command.getName() + " not found to change the state [" + command.getEncodedQueryString() + "]");\r
}\r
*/\r
public void hasPendingStateChange(String command, boolean bool) {\r
pendingStateChanges.put(command, new Boolean(bool));\r
- if (bool) {\r
- logger.debug("Updating listeners with state change from " + command);\r
- updateListeners(command);\r
- }\r
}\r
\r
/**\r