Javadoc
[mkjsf-moved-to-github.git] / src / main / java / com / indexdata / mkjsf / pazpar2 / commands / InitCommand.java
index d52ec51..8743874 100644 (file)
@@ -5,6 +5,12 @@ import org.apache.log4j.Logger;
 import com.indexdata.mkjsf.pazpar2.commands.sp.InitCommandSp;\r
 import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand;\r
 \r
+/**\r
+ * <b><code>init</code></b> Pazpar2 command, referenced as: <code>pzreq.init</code>\r
+ * \r
+ * @author Niels Erik\r
+ *\r
+ */\r
 public class InitCommand extends Pazpar2Command implements ServiceProxyCommand {\r
 \r
   private static final long serialVersionUID = -4915976465898889987L;\r
@@ -15,27 +21,48 @@ public class InitCommand extends Pazpar2Command implements ServiceProxyCommand {
     super("init");\r
   }\r
   \r
+  /**\r
+   * Sets the <code>clear</code> parameter. See Pazpar2 documentation for details.\r
+   * \r
+   * @param clear\r
+   */\r
   public void setClear(String clear) { \r
     setParameterInState(new CommandParameter("clear","=",clear));\r
   }\r
-  \r
+\r
+  /**\r
+   * Returns the <code>clear</code> parameter value.\r
+   */\r
   public String getClear() {\r
     return getParameterValue("clear");\r
   }\r
   \r
+  /**\r
+   * Sets the <code>service</code> parameter. See Pazpar2 documentation for details.\r
+   * @param serviceId\r
+   */\r
   public void setService(String serviceId) {    \r
     setParameterInState(new CommandParameter("service","=",serviceId));\r
   }\r
   \r
+  /**\r
+   * Returns the <code>service</code> parameter value.\r
+   */  \r
   public String getService() {\r
     return getParameterValue("service");\r
   }\r
   \r
+  /**\r
+   * Disabled, not supported for <code>init</code>\r
+   */\r
   @Override\r
   public void setSession (String sessionId) {\r
     throw new UnsupportedOperationException("Cannot set session id on init command");\r
   }\r
-  \r
+\r
+  /**\r
+   * Disabled, not supported for <code>init</code>\r
+   */\r
   @Override\r
   public String getSession () {\r
     throw new UnsupportedOperationException("Cannot set or get session id on init command");\r
@@ -47,13 +74,16 @@ public class InitCommand extends Pazpar2Command implements ServiceProxyCommand {
     for (String parameterName : parameters.keySet()) {\r
       newCommand.setParameterInState(parameters.get(parameterName).copy());      \r
     }\r
-    newCommand.spCommand = this.spCommand;\r
+    newCommand.spCommand = new InitCommandSp(this);\r
+    if (spCommand != null && spCommand.getUploadedInitDoc()!=null) {\r
+      newCommand.spCommand.setUploadedInitDoc(spCommand.getUploadedInitDoc());\r
+    }\r
     return newCommand;\r
   }\r
   \r
   public ServiceProxyCommand getSp() {\r
     if (spCommand==null) {\r
-      spCommand = new InitCommandSp(this);\r
+      spCommand = new InitCommandSp(this);      \r
     } \r
     return spCommand;\r
   }\r