From: Niels Erik G. Nielsen Date: Wed, 10 Apr 2013 17:25:00 +0000 (-0400) Subject: Some javadoc X-Git-Tag: v0.0.7~181 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=7b4d66a5933f030bef0d2a6074c4cd2fee7d9fbb;p=mkjsf-moved-to-github.git Some javadoc --- diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/state/Pazpar2State.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/state/Pazpar2State.java index fba685e..4412a7f 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/state/Pazpar2State.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/state/Pazpar2State.java @@ -19,6 +19,13 @@ public class Pazpar2State { key = "#initial"; } + /** + * Creates new state by cloning all commands of the provided state and + * then overriding one of them with the provided state changing command. + * + * @param previousState + * @param newCommand + */ public Pazpar2State (Pazpar2State previousState, Pazpar2Command newCommand) { for (String commandName : previousState.commands.keySet()) { this.commands.put(commandName, previousState.commands.get(commandName).copy()); @@ -50,7 +57,7 @@ public class Pazpar2State { } /** - * Checks if the provided command represents a state change + * Checks if a command represents a change of this state * * @param command * @return true if the command causes a change of state @@ -67,6 +74,12 @@ public class Pazpar2State { } } + /** + * Returns a command from this state + * + * @param name + * @return + */ public Pazpar2Command getCommand(String name) { return commands.get(name); } diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/state/StateManager.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/state/StateManager.java index 638effd..7479bdd 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/state/StateManager.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/state/StateManager.java @@ -47,6 +47,14 @@ public class StateManager { } } + /** + * Gets a detached copy of a command. For the change manager + * to become aware of any changes to the copy it must be + * checked back in with 'checkIn(Pazpar2Command)' + * + * @param commandName + * @return Copy this state's instance of the given command + */ public Pazpar2Command checkOut (String commandName) { return getCurrentState().getCommand(commandName).copy(); } @@ -55,6 +63,12 @@ public class StateManager { return states.get(currentKey); } + /** + * Changes the current state key. Invoked from the UI to have the state + * manager switch to another state than the current one. + * + * @param key + */ public void setCurrentStateKey(String key) { if (currentKey.equals(key)) { logger.debug("setCurrentStateKey: no key change detected"); @@ -74,11 +88,27 @@ public class StateManager { } } - + /** + * Sets a pending-state-change flag for the given command. Used by + * the beans to decide whether, say, a search should be executed before + * doing the next show. + * + * It is up to the client to set and reset this flag since the state + * manager is not otherwise informed about actual request activities + * (only about the definition of commands to be executed) + * + * @param command + * @param bool + */ public void hasPendingStateChange(String command, boolean bool) { pendingStateChanges.put(command, new Boolean(bool)); } + /** + * + * @param command + * @return true if there is a non-executed command change in this state + */ public boolean hasPendingStateChange (String command) { return pendingStateChanges.get(command).booleanValue(); }