X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fcom%2Findexdata%2Fmkjsf%2Fpazpar2%2Fstate%2FPazpar2State.java;h=b5b1d3ead4a94875aadfe2b33c372963f02187ce;hb=ea49f38ba51c8325879b693536940974b73a01c2;hp=13e3989af7c57fb8aedf9f36906aa898a2af74c9;hpb=d400a082759c1a58cb79713f04ab2f3d62bca97c;p=mkjsf-moved-to-github.git diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/state/Pazpar2State.java b/src/main/java/com/indexdata/mkjsf/pazpar2/state/Pazpar2State.java index 13e3989..b5b1d3e 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/state/Pazpar2State.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/state/Pazpar2State.java @@ -28,22 +28,24 @@ import com.indexdata.mkjsf.pazpar2.commands.sp.ServiceProxyCommands; public class Pazpar2State { String key = null; - Map commands = new HashMap();; + Map commands = new HashMap(); - public Pazpar2State (StateManager mgr) { - commands.put(Pazpar2Commands.INIT, new InitCommand(mgr)); - commands.put(Pazpar2Commands.PING, new PingCommand(mgr)); - commands.put(Pazpar2Commands.SETTINGS, new SettingsCommand(mgr)); - commands.put(Pazpar2Commands.SEARCH, new SearchCommand(mgr)); - commands.put(Pazpar2Commands.STAT, new StatCommand(mgr)); - commands.put(Pazpar2Commands.SHOW, new ShowCommand(mgr)); - commands.put(Pazpar2Commands.RECORD, new RecordCommand(mgr)); - commands.put(Pazpar2Commands.TERMLIST, new TermlistCommand(mgr)); - commands.put(Pazpar2Commands.BYTARGET, new BytargetCommand(mgr)); + public Pazpar2State () { + + commands.put(Pazpar2Commands.INIT, new InitCommand()); + commands.put(Pazpar2Commands.PING, new PingCommand()); + commands.put(Pazpar2Commands.SETTINGS, new SettingsCommand()); + commands.put(Pazpar2Commands.SEARCH, new SearchCommand()); + commands.put(Pazpar2Commands.STAT, new StatCommand()); + commands.put(Pazpar2Commands.SHOW, new ShowCommand()); + commands.put(Pazpar2Commands.RECORD, new RecordCommand()); + commands.put(Pazpar2Commands.TERMLIST, new TermlistCommand()); + commands.put(Pazpar2Commands.BYTARGET, new BytargetCommand()); - commands.put(ServiceProxyCommands.AUTH, new AuthCommand(mgr)); - commands.put(ServiceProxyCommands.CATEGORIES, new CategoriesCommand(mgr)); - key = "#1"; + commands.put(ServiceProxyCommands.AUTH, new AuthCommand()); + commands.put(ServiceProxyCommands.CATEGORIES, new CategoriesCommand()); + + // key = "#1"; } /** @@ -58,23 +60,26 @@ public class Pazpar2State { this.commands.put(commandName, previousState.commands.get(commandName).copy()); } this.commands.put(newCommand.getCommandName(),newCommand); - this.key = getKey(); + this.key = getKey(); } /** * Generates a state key that can be used by the browser to pick * up this state again at a later point in time. * + * @see {@link com.indexdata.mkjsf.pazpar2.state.StateManager#setCurrentStateKey} * @return */ public String getKey() { if (key == null) { StringBuilder querystatebuilder = new StringBuilder(""); for (Pazpar2Command command : commands.values()) { - if (command.hasParameters()) { - querystatebuilder.append("||"+command.getCommandName()+"::"); - querystatebuilder.append(command.getValueWithExpressions()); - } + if (! (command instanceof AuthCommand )) { + if (command.hasParameters()) { + querystatebuilder.append("||"+command.getCommandName()+"::"); + querystatebuilder.append(command.getValueWithExpressions()); + } + } } key = "#"+querystatebuilder.toString(); return key;