More work on commands, statemgmt, EL references
[mkjsf-moved-to-github.git] / src / main / java / com / indexdata / pz2utils4jsf / pazpar2 / Pz2Bean.java
index 70dde92..345f049 100644 (file)
@@ -14,6 +14,7 @@ import org.apache.log4j.Logger;
 import com.indexdata.pz2utils4jsf.config.ConfigurationReader;\r
 import com.indexdata.pz2utils4jsf.controls.ResultsPager;\r
 import com.indexdata.pz2utils4jsf.errors.ErrorInterface;\r
+import com.indexdata.pz2utils4jsf.pazpar2.commands.Pazpar2Command;\r
 import com.indexdata.pz2utils4jsf.pazpar2.data.ByTarget;\r
 import com.indexdata.pz2utils4jsf.pazpar2.data.RecordResponse;\r
 import com.indexdata.pz2utils4jsf.pazpar2.data.ShowResponse;\r
@@ -29,24 +30,28 @@ public class Pz2Bean implements Pz2Interface, Serializable {
   private static Logger logger = Logger.getLogger(Pz2Bean.class);\r
   \r
   @Inject ConfigurationReader configurator;\r
-  protected Pz2Session pz2;  \r
+  \r
+  @Inject @ForStraightPz2 Pz2Session pz2;  \r
+  \r
   protected SearchClient searchClient;  \r
     \r
   public Pz2Bean () {\r
     logger.info("Instantiating pz2 bean [" + Utils.objectId(this) + "]");\r
+    logger.debug("in Pz2Bean configurator is " + configurator);\r
   }\r
   \r
   @PostConstruct\r
-  public void instantiatePz2SessionObject() {\r
+  public void instantiatePz2SessionObject() {    \r
+    logger.debug("in start of Pz2Bean post-construct configurator is " + configurator);\r
     logger.debug(Utils.objectId(this) + " will instantiate a Pz2Session next.");\r
-    pz2 = new Pz2Session();\r
     searchClient = new Pz2Client();\r
     logger.info("Using [" + Utils.objectId(searchClient) + "] configured by [" \r
                           + Utils.objectId(configurator) + "] on session [" \r
                           + Utils.objectId(pz2) + "]" );    \r
-    pz2.configureClient(searchClient,configurator);\r
-  }\r
-  \r
+    pz2.configureClient(searchClient,configurator);    \r
+    logger.debug("in end of Pz2Bean post-construct configurator is " + configurator);\r
+\r
+  }  \r
   \r
   /* (non-Javadoc)\r
    * @see com.indexdata.pz2utils4jsf.pazpar2.Pz2Interface#doSearch(java.lang.String)\r
@@ -81,9 +86,9 @@ public class Pz2Bean implements Pz2Interface, Serializable {
    * @see com.indexdata.pz2utils4jsf.pazpar2.Pz2Interface#setQuery(java.lang.String)\r
    */\r
   public void setQuery(String query) {\r
-    pz2.setQuery(query);\r
+    pz2.req.getSearch().setQuery(query);\r
   }\r
-\r
+    \r
   /* (non-Javadoc)\r
    * @see com.indexdata.pz2utils4jsf.pazpar2.Pz2Interface#getQuery()\r
    */\r
@@ -321,5 +326,9 @@ public class Pz2Bean implements Pz2Interface, Serializable {
   public String getRecordId() {\r
     return pz2.getRecordId();\r
   }\r
+  \r
+  public Pazpar2Command getSearchCommand () {\r
+    return pz2.getCommand("search");\r
+  }\r
 \r
 }\r