/* (non-Javadoc)\r
* @see com.indexdata.pz2utils4jsf.pazpar2.Pz2Interface#setTargetFilter(java.lang.String, java.lang.String)\r
*/\r
- public void setTargetFilter(String targetId, String targetName) {\r
- pz2.setTargetFilter(targetId, targetName);\r
+ public void setSingleTargetFilter(String targetId, String targetName) {\r
+ pz2.setSingleTargetFilter(targetId, targetName);\r
}\r
\r
/* (non-Javadoc)\r
- * @see com.indexdata.pz2utils4jsf.pazpar2.Pz2Interface#removeTargetFilter()\r
+ * @see com.indexdata.pz2utils4jsf.pazpar2.Pz2Interface#getTargetFilter()\r
*/\r
- public void removeTargetFilter () {\r
- pz2.removeTargetFilter();\r
+ public SingleTargetFilter getSingleTargetFilter() {\r
+ return pz2.getSingleTargetFilter();\r
}\r
-\r
+ \r
/* (non-Javadoc)\r
- * @see com.indexdata.pz2utils4jsf.pazpar2.Pz2Interface#getTargetFilter()\r
+ * @see com.indexdata.pz2utils4jsf.pazpar2.Pz2Interface#removeTargetFilter()\r
*/\r
- public TargetFilter getTargetFilter() {\r
- return pz2.getTargetFilter();\r
+ public void removeSingleTargetFilter () {\r
+ pz2.removeSingleTargetFilter();\r
}\r
-\r
+ \r
/* (non-Javadoc)\r
* @see com.indexdata.pz2utils4jsf.pazpar2.Pz2Interface#hasTargetFilter()\r
*/\r
- public boolean hasTargetFilter() {\r
- return pz2.hasTargetFilter();\r
+ public boolean hasSingleTargetFilter() {\r
+ return pz2.hasSingleTargetFilter();\r
+ }\r
+\r
+ \r
+ public String getFilter () {\r
+ return pz2.getFilter();\r
}\r
+ \r
+ public void setFilter (String filterExpression) {\r
+ pz2.setFilter(filterExpression);\r
+ }\r
+\r
\r
/* (non-Javadoc)\r
* @see com.indexdata.pz2utils4jsf.pazpar2.Pz2Interface#setSort(java.lang.String)\r
*/\r
public void setFacetOnQuery(String facetKey, String term);\r
\r
+ \r
+ public void setFilter(String filterExpression);\r
+ \r
+ public String getFilter();\r
+\r
+ \r
/**\r
- * Adds a target filter to limit the current query by, then\r
- * executes the current search.\r
+ * Adds a single target filter to restrict the current query by, \r
+ * then executes the current search.\r
+ * \r
+ * This is a special case of the general setFilter function, \r
+ * allowing to associate a descriptive target name with the \r
+ * filter expression for display in UI. \r
* \r
* @param targetId pazpar2's ID for the target to limit by\r
* @param targetName a descriptive name for the target\r
*/\r
- public void setTargetFilter (String targetId, String targetName);\r
+ public void setSingleTargetFilter (String targetId, String targetName);\r
\r
/**\r
* Removes the current target filter from the search\r
* \r
*/\r
- public void removeTargetFilter ();\r
+ public void removeSingleTargetFilter ();\r
\r
/**\r
* \r
* @return The target filter set on the current search command\r
*/\r
- public TargetFilter getTargetFilter();\r
+ public SingleTargetFilter getSingleTargetFilter();\r
\r
/**\r
* Resolves if the current search command has a target filter - to\r
* @return true if the current search command is limited by a target \r
* filter\r
*/\r
- public boolean hasTargetFilter();\r
- \r
+ public boolean hasSingleTargetFilter();\r
+ \r
/**\r
* Sets the ordering of records (hits) in the 'show' display object\r
*/\r
\r
import org.apache.log4j.Logger;\r
\r
+import com.indexdata.pz2utils4jsf.config.Configuration;\r
import com.indexdata.pz2utils4jsf.config.ConfigurationReader;\r
import com.indexdata.pz2utils4jsf.pazpar2.sp.ServiceProxyClient;\r
import com.indexdata.pz2utils4jsf.pazpar2.sp.ServiceProxyInterface;\r
\r
@Override\r
public void setInitFileName(String fileName) {\r
+ logger.info("Setting init file name: " + fileName);\r
session().setInitFileName(fileName); \r
}\r
\r
public String getInitFileName() {\r
return session().getInitFileName();\r
}\r
+ \r
+ public void setAceFilter (String filterExpression) {\r
+ session().setAceFilter(filterExpression);\r
+ }\r
+ \r
+ public String getAceFilter () {\r
+ return session().getAceFilter();\r
+ }\r
\r
@Override\r
public String postInit() throws UnsupportedEncodingException, IOException {\r
- return session().postInit();\r
+ logger.info("Posting init: " + System.currentTimeMillis());\r
+ session().postInit();\r
+ return "";\r
}\r
\r
@Override\r
public void setServiceProxyUrl(String url) {\r
- session().setServiceProxyUrl(url); \r
+ logger.info("Setting Service Proxy url: " + url);\r
+ session().setServiceProxyUrl(url); \r
}\r
\r
@Override\r
public String getInitResponse() {\r
return session().getInitResponse();\r
}\r
+ \r
+ public Configuration getClientConfiguration() {\r
+ return session().client().getConfiguration();\r
+ }\r
+ \r
+ public String getInitDocPath () {\r
+ return session().client().getConfiguration().get("INIT_DOC_PATH");\r
+ }\r
\r
}\r
\r
protected List<ErrorInterface> configurationErrors = null;\r
protected SearchClient searchClient = null; \r
- protected TargetFilter targetFilter = null; \r
+ protected SingleTargetFilter singleTargetFilter = null; \r
protected ResultsPager pager = null; \r
\r
public Pz2Session () {\r
public void doSearch() { \r
queryStates.hasPendingStateChange("search",false);\r
resetDataObjects();\r
+ removeCommand("record");\r
setCommandParameter("show",new CommandParameter("start","=",0)); \r
logger.debug(Utils.objectId(this) + " is searching using "+getCommand("search").getParameter("query").getEncodedQueryString());\r
doCommand("search"); \r
doSearch();\r
}\r
\r
- public void setTargetFilter (String targetId, String targetName) { \r
- if (hasTargetFilter(new TargetFilter(targetId,targetName))) {\r
- logger.debug("Already using target filter " + this.targetFilter.getFilterExpression());\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
} else { \r
- this.targetFilter = new TargetFilter(targetId,targetName);\r
- setCommandParameter("search",new CommandParameter("filter","=",this.targetFilter.getFilterExpression())); \r
+ this.singleTargetFilter = new SingleTargetFilter(targetId,targetName);\r
+ setCommandParameter("search",new CommandParameter("filter","=",this.singleTargetFilter.getFilterExpression())); \r
doSearch();\r
} \r
}\r
\r
- public TargetFilter getTargetFilter () {\r
- return targetFilter;\r
+ public SingleTargetFilter getSingleTargetFilter () {\r
+ return singleTargetFilter;\r
}\r
\r
- public void removeTargetFilter () {\r
- logger.debug("Removing target filter " + targetFilter.getFilterExpression());\r
- this.targetFilter = null;\r
+ public void removeSingleTargetFilter () {\r
+ logger.debug("Removing target filter " + singleTargetFilter.getFilterExpression());\r
+ this.singleTargetFilter = null;\r
removeCommandParameter("search","filter"); \r
doSearch();\r
}\r
\r
- public boolean hasTargetFilter() {\r
- return targetFilter != null; \r
+ public boolean hasSingleTargetFilter() {\r
+ return singleTargetFilter != null; \r
}\r
\r
public void setSort (String sortOption) {\r
}\r
\r
\r
- protected boolean hasTargetFilter(TargetFilter targetFilter) {\r
- return hasTargetFilter() && targetFilter.equals(this.targetFilter);\r
+ protected boolean hasSingleTargetFilter(SingleTargetFilter targetFilter) {\r
+ return hasSingleTargetFilter() && targetFilter.equals(this.singleTargetFilter);\r
}\r
\r
protected boolean hasQuery() {\r
\r
protected void handleQueryStateChanges (String commands) {\r
if (queryStates.hasPendingStateChange("search")) { \r
- logger.debug("Found pending search change. Doing search before updating " + commands);\r
+ logger.debug("Found pending search change. Doing search before updating " + commands); \r
doSearch();\r
} \r
if (queryStates.hasPendingStateChange("record") && ! commands.equals("record")) { \r
dataObjects.put("record", new RecordResponse());\r
dataObjects.put("search", new SearchResponse());\r
}\r
+\r
+ @Override\r
+ public void setFilter(String filterExpression) {\r
+ logger.debug("Setting filter to " + filterExpression);\r
+ setCommandParameter("search",new CommandParameter("filter","=",filterExpression)); \r
+ }\r
+ \r
+ public String getFilter() {\r
+ return getCommandParameterValueSimple("search", "filter", "");\r
+ }\r
+ \r
+ public boolean hasFilter () {\r
+ return getFilter().length()>0;\r
+ }\r
\r
}\r
--- /dev/null
+package com.indexdata.pz2utils4jsf.pazpar2;\r
+\r
+import java.io.Serializable;\r
+\r
+import com.indexdata.pz2utils4jsf.pazpar2.SingleTargetFilter;\r
+\r
+public class SingleTargetFilter implements Serializable {\r
+\r
+ private static final long serialVersionUID = 2389085467202526537L;\r
+\r
+ private String targetName;\r
+ private String targetId;\r
+ \r
+ public SingleTargetFilter (String targetId, String targetName) {\r
+ this.targetId = targetId;\r
+ this.targetName = targetName;\r
+ }\r
+ \r
+ public String getTargetName () {\r
+ return targetName;\r
+ }\r
+ \r
+ public String getTargetId () {\r
+ return targetId; \r
+ }\r
+ \r
+ public String getFilterExpression () {\r
+ return "pz:id="+targetId;\r
+ }\r
+ \r
+ @Override\r
+ public boolean equals(Object o) {\r
+ if (o instanceof SingleTargetFilter) {\r
+ return targetName.equals(((SingleTargetFilter) o).getTargetName()) && \r
+ targetId.equals(((SingleTargetFilter) o).getTargetId());\r
+ } else {\r
+ return false;\r
+ }\r
+ }\r
+ \r
+ @Override\r
+ public int hashCode () {\r
+ return (targetId+targetName).hashCode();\r
+ }\r
+ \r
+ \r
+}\r
+++ /dev/null
-package com.indexdata.pz2utils4jsf.pazpar2;\r
-\r
-import java.io.Serializable;\r
-\r
-import com.indexdata.pz2utils4jsf.pazpar2.TargetFilter;\r
-\r
-public class TargetFilter implements Serializable {\r
-\r
- private static final long serialVersionUID = 2389085467202526537L;\r
-\r
- private String targetName;\r
- private String targetId;\r
- \r
- public TargetFilter (String targetId, String targetName) {\r
- this.targetId = targetId;\r
- this.targetName = targetName;\r
- }\r
- \r
- public String getTargetName () {\r
- return targetName;\r
- }\r
- \r
- public String getTargetId () {\r
- return targetId; \r
- }\r
- \r
- public String getFilterExpression () {\r
- return "pz:id="+targetId;\r
- }\r
- \r
- @Override\r
- public boolean equals(Object o) {\r
- if (o instanceof TargetFilter) {\r
- return targetName.equals(((TargetFilter) o).getTargetName()) && \r
- targetId.equals(((TargetFilter) o).getTargetId());\r
- } else {\r
- return false;\r
- }\r
- }\r
- \r
- @Override\r
- public int hashCode () {\r
- return (targetId+targetName).hashCode();\r
- }\r
- \r
- \r
-}\r
\r
import org.apache.log4j.Logger;\r
\r
+import com.indexdata.pz2utils4jsf.pazpar2.CommandParameter;\r
import com.indexdata.pz2utils4jsf.pazpar2.Pz2Session;\r
import com.indexdata.pz2utils4jsf.pazpar2.sp.auth.ServiceProxyUser;\r
import com.indexdata.pz2utils4jsf.utils.Utils;\r
private static final long serialVersionUID = -5770410029361522854L;\r
private static Logger logger = Logger.getLogger(ServiceProxySession.class);\r
private String initDocFileName = "";\r
- private String initDocResponse = "";\r
- \r
+ private String initDocResponse = ""; \r
+ \r
public ServiceProxySession() {\r
logger.info("Instantiating pz2 session object [" + Utils.objectId(this) + "]");\r
}\r
}\r
\r
@Override\r
- public String postInit() throws UnsupportedEncodingException, IOException {\r
+ public String postInit() throws UnsupportedEncodingException, IOException { \r
String initDocPath = client().getInitDocPaths()[0];\r
logger.info("Paths: " + client().getInitDocPaths());\r
logger.info("Path: " + initDocPath);\r
return client().getServiceProxyUrl();\r
}\r
\r
- private ServiceProxyClient client () {\r
+ public ServiceProxyClient client () {\r
return (ServiceProxyClient)searchClient;\r
}\r
\r
return initDocResponse;\r
}\r
\r
+ public void setAceFilter(String filterExpression) {\r
+ setCommandParameter("record",new CommandParameter("acefilter","=",filterExpression));\r
+ }\r
+ \r
+ public String getAceFilter () {\r
+ return getCommandParameterValue("record","acefilter","");\r
+ }\r
\r
-\r
}\r