Adds check for SP only commands.
[mkjsf-moved-to-github.git] / src / main / java / com / indexdata / mkjsf / pazpar2 / commands / InitCommand.java
index 2ae51a5..3166168 100644 (file)
@@ -1,8 +1,9 @@
 package com.indexdata.mkjsf.pazpar2.commands;\r
 \r
+import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand;\r
 import com.indexdata.mkjsf.pazpar2.state.StateManager;\r
 \r
-public class InitCommand extends Pazpar2Command {\r
+public class InitCommand extends Pazpar2Command implements ServiceProxyCommand {\r
 \r
   private static final long serialVersionUID = -4915976465898889987L;\r
 \r
@@ -14,10 +15,18 @@ public class InitCommand extends Pazpar2Command {
     setParameterInState(new CommandParameter("clear","=",clear));\r
   }\r
   \r
+  public String getClear() {\r
+    return getParameterValue("clear");\r
+  }\r
+  \r
   public void setService(String serviceId) {    \r
     setParameterInState(new CommandParameter("service","=",serviceId));\r
   }\r
   \r
+  public String getService() {\r
+    return getParameterValue("service");\r
+  }\r
+  \r
   @Override\r
   public void setSession (String sessionId) {\r
     throw new UnsupportedOperationException("Cannot set session id on init command");\r
@@ -27,5 +36,23 @@ public class InitCommand extends Pazpar2Command {
   public String getSession () {\r
     throw new UnsupportedOperationException("Cannot set or get session id on init command");\r
   }\r
+  \r
+  public InitCommand copy () {\r
+    InitCommand newCommand = new InitCommand(stateMgr);\r
+    for (String parameterName : parameters.keySet()) {\r
+      newCommand.setParameterInState(parameters.get(parameterName).copy());      \r
+    }    \r
+    return newCommand;\r
+  }\r
+  \r
+  public ServiceProxyCommand getSp() {\r
+    return this;\r
+  }\r
+\r
+  @Override\r
+  public boolean spOnly() {\r
+    return false;\r
+  }\r
+\r
 \r
 }\r