Includes sp extension in cloning of record cmd
authorNiels Erik G. Nielsen <nielserik@indexdata.com>
Wed, 5 Jun 2013 20:00:22 +0000 (16:00 -0400)
committerNiels Erik G. Nielsen <nielserik@indexdata.com>
Wed, 5 Jun 2013 20:00:22 +0000 (16:00 -0400)
src/main/java/com/indexdata/mkjsf/pazpar2/commands/RecordCommand.java

index e9c4b54..c9df610 100644 (file)
@@ -15,6 +15,7 @@ public class RecordCommand extends Pazpar2Command implements ServiceProxyCommand
 \r
   private static final long serialVersionUID = 2817539422114569506L;\r
   private static Logger logger = Logger.getLogger(RecordCommand.class);\r
+  private RecordCommandSp spCommand = null;\r
 \r
   public RecordCommand() {\r
     super("record");\r
@@ -118,6 +119,7 @@ public class RecordCommand extends Pazpar2Command implements ServiceProxyCommand
     for (String parameterName : parameters.keySet()) {\r
       newCommand.setParameterInState(parameters.get(parameterName).copy());      \r
     }    \r
+    newCommand.spCommand = this.spCommand;\r
     return newCommand;\r
   }\r
   \r
@@ -127,7 +129,10 @@ public class RecordCommand extends Pazpar2Command implements ServiceProxyCommand
    * \r
    */\r
   public RecordCommandSp getSp () {\r
-    return new RecordCommandSp(this);\r
+    if (spCommand==null) {\r
+      spCommand = new RecordCommandSp(this);\r
+    } \r
+    return spCommand;\r
   }\r
 \r
   @Override\r