import java.io.IOException;\r
import java.io.UnsupportedEncodingException;\r
\r
+import javax.enterprise.context.SessionScoped;\r
+\r
import org.apache.log4j.Logger;\r
\r
import com.indexdata.pz2utils4jsf.pazpar2.Pz2Session;\r
+import com.indexdata.pz2utils4jsf.pazpar2.commands.CommandParameter;\r
import com.indexdata.pz2utils4jsf.pazpar2.sp.auth.ServiceProxyUser;\r
import com.indexdata.pz2utils4jsf.utils.Utils;\r
\r
+@ForServiceProxy @SessionScoped\r
public class ServiceProxySession extends Pz2Session implements ServiceProxyInterface {\r
\r
private ServiceProxyUser user; \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
+ logger.info("Instantiating SP pz2 session object [" + Utils.objectId(this) + "]");\r
}\r
\r
public void setUser(ServiceProxyUser user) {\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
+ this.resetDataObjects();\r
byte[] response = client().postInitDoc(initDocPath + getInitFileName());\r
initDocResponse = new String(response,"UTF-8");\r
return initDocResponse;\r
}\r
+ \r
+ @Override\r
+ public String postInit(byte[] initDoc) throws UnsupportedEncodingException, IOException { \r
+ this.resetDataObjects();\r
+ byte[] response = client().postInitDoc(initDoc);\r
+ initDocResponse = new String(response,"UTF-8");\r
+ return initDocResponse;\r
+ }\r
+\r
\r
@Override\r
public void setServiceProxyUrl(String url) {\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