Moves record parameter settings from pz2 bean to record cmd
[mkjsf-moved-to-github.git] / src / main / java / com / indexdata / pz2utils4jsf / pazpar2 / Pz2Session.java
index 56aa95b..654f3c8 100644 (file)
@@ -21,7 +21,6 @@ import com.indexdata.pz2utils4jsf.pazpar2.commands.CommandParameter;
 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
@@ -160,43 +159,7 @@ public class Pz2Session implements Pz2Interface, StateListener {
     }\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
@@ -228,22 +191,12 @@ public class Pz2Session implements Pz2Interface, StateListener {
       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
@@ -499,12 +452,12 @@ public class Pz2Session implements Pz2Interface, StateListener {
   }\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