import com.indexdata.mkjsf.pazpar2.commands.ShowCommand;\r
import com.indexdata.mkjsf.pazpar2.commands.StatCommand;\r
import com.indexdata.mkjsf.pazpar2.commands.TermlistCommand;\r
+import com.indexdata.mkjsf.pazpar2.commands.sp.AuthCommand;\r
+import com.indexdata.mkjsf.pazpar2.commands.sp.CategoriesCommand;\r
+import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommands;\r
\r
/**\r
* Holds a 'pazpar2 state', understood as a full set of pazpar2 commands and \r
public class Pazpar2State {\r
\r
String key = null;\r
- Map<String,Pazpar2Command> commands = new HashMap<String,Pazpar2Command>();;\r
+ Map<String,Pazpar2Command> commands = new HashMap<String,Pazpar2Command>(); \r
\r
- public Pazpar2State (StateManager mgr) {\r
- commands.put(Pazpar2Commands.INIT, new InitCommand(mgr));\r
- commands.put(Pazpar2Commands.PING, new PingCommand(mgr));\r
- commands.put(Pazpar2Commands.SETTINGS, new SettingsCommand(mgr));\r
- commands.put(Pazpar2Commands.SEARCH, new SearchCommand(mgr));\r
- commands.put(Pazpar2Commands.STAT, new StatCommand(mgr));\r
- commands.put(Pazpar2Commands.SHOW, new ShowCommand(mgr));\r
- commands.put(Pazpar2Commands.RECORD, new RecordCommand(mgr));\r
- commands.put(Pazpar2Commands.TERMLIST, new TermlistCommand(mgr));\r
- commands.put(Pazpar2Commands.BYTARGET, new BytargetCommand(mgr)); \r
- key = "#1";\r
+ public Pazpar2State () {\r
+ \r
+ commands.put(Pazpar2Commands.INIT, new InitCommand());\r
+ commands.put(Pazpar2Commands.PING, new PingCommand());\r
+ commands.put(Pazpar2Commands.SETTINGS, new SettingsCommand());\r
+ commands.put(Pazpar2Commands.SEARCH, new SearchCommand());\r
+ commands.put(Pazpar2Commands.STAT, new StatCommand());\r
+ commands.put(Pazpar2Commands.SHOW, new ShowCommand());\r
+ commands.put(Pazpar2Commands.RECORD, new RecordCommand());\r
+ commands.put(Pazpar2Commands.TERMLIST, new TermlistCommand());\r
+ commands.put(Pazpar2Commands.BYTARGET, new BytargetCommand()); \r
+\r
+ commands.put(ServiceProxyCommands.AUTH, new AuthCommand());\r
+ commands.put(ServiceProxyCommands.CATEGORIES, new CategoriesCommand());\r
+ \r
+ // key = "#1";\r
}\r
\r
/**\r
for (String commandName : previousState.commands.keySet()) {\r
this.commands.put(commandName, previousState.commands.get(commandName).copy());\r
}\r
- this.commands.put(newCommand.getName(),newCommand);\r
- this.key = getKey(); \r
+ this.commands.put(newCommand.getCommandName(),newCommand);\r
+ this.key = getKey(); \r
}\r
\r
/**\r
* Generates a state key that can be used by the browser to pick\r
* up this state again at a later point in time.\r
* \r
+ * @see {@link com.indexdata.mkjsf.pazpar2.state.StateManager#setCurrentStateKey}\r
* @return\r
*/\r
public String getKey() {\r
if (key == null) {\r
StringBuilder querystatebuilder = new StringBuilder("");\r
for (Pazpar2Command command : commands.values()) {\r
- if (command.hasParameters()) {\r
- querystatebuilder.append("||"+command.getName()+"::");\r
- querystatebuilder.append(command.getValueWithExpressions());\r
- } \r
+ if (! (command instanceof AuthCommand )) {\r
+ if (command.hasParameters()) {\r
+ querystatebuilder.append("||"+command.getCommandName()+"::");\r
+ querystatebuilder.append(command.getValueWithExpressions());\r
+ }\r
+ }\r
} \r
- key = "#"+querystatebuilder.toString().hashCode();\r
+ key = "#"+querystatebuilder.toString();\r
return key;\r
} else { \r
return key;\r
public boolean stateMutating (Pazpar2Command command) {\r
if (command == null) {\r
return true;\r
- } else if (commands.get(command.getName()) == null) {\r
+ } else if (commands.get(command.getCommandName()) == null) {\r
return true;\r
- } else if ((command.equals(commands.get(command.getName())))) {\r
+ } else if ((command.equals(commands.get(command.getCommandName())))) {\r
return false; \r
} else {\r
return true;\r