Adds SP extensions to Pazpar2 commands and parameters
[mkjsf-moved-to-github.git] / src / main / java / com / indexdata / mkjsf / pazpar2 / commands / InitCommand.java
1 package com.indexdata.mkjsf.pazpar2.commands;\r
2 \r
3 import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommand;\r
4 import com.indexdata.mkjsf.pazpar2.state.StateManager;\r
5 \r
6 public class InitCommand extends Pazpar2Command implements ServiceProxyCommand {\r
7 \r
8   private static final long serialVersionUID = -4915976465898889987L;\r
9 \r
10   public InitCommand(StateManager stateMgr) {\r
11     super("init",stateMgr);\r
12   }\r
13   \r
14   public void setClear(String clear) { \r
15     setParameterInState(new CommandParameter("clear","=",clear));\r
16   }\r
17   \r
18   public void setService(String serviceId) {    \r
19     setParameterInState(new CommandParameter("service","=",serviceId));\r
20   }\r
21   \r
22   @Override\r
23   public void setSession (String sessionId) {\r
24     throw new UnsupportedOperationException("Cannot set session id on init command");\r
25   }\r
26   \r
27   @Override\r
28   public String getSession () {\r
29     throw new UnsupportedOperationException("Cannot set or get session id on init command");\r
30   }\r
31   \r
32   public InitCommand copy () {\r
33     InitCommand newCommand = new InitCommand(stateMgr);\r
34     for (String parameterName : parameters.keySet()) {\r
35       newCommand.setParameterInState(parameters.get(parameterName).copy());      \r
36     }    \r
37     return newCommand;\r
38   }\r
39   \r
40   public ServiceProxyCommand getSp() {\r
41     return this;\r
42   }\r
43 \r
44 \r
45 }\r