Some javadoc
authorNiels Erik G. Nielsen <nielserik@indexdata.com>
Wed, 10 Apr 2013 17:25:00 +0000 (13:25 -0400)
committerNiels Erik G. Nielsen <nielserik@indexdata.com>
Wed, 10 Apr 2013 17:25:00 +0000 (13:25 -0400)
src/main/java/com/indexdata/pz2utils4jsf/pazpar2/state/Pazpar2State.java
src/main/java/com/indexdata/pz2utils4jsf/pazpar2/state/StateManager.java

index fba685e..4412a7f 100644 (file)
@@ -19,6 +19,13 @@ public class Pazpar2State {
     key = "#initial";\r
   }\r
   \r
+  /**\r
+   * Creates new state by cloning all commands of the provided state and \r
+   * then overriding one of them with the provided state changing command.\r
+   * \r
+   * @param previousState\r
+   * @param newCommand\r
+   */\r
   public Pazpar2State (Pazpar2State previousState, Pazpar2Command newCommand) {\r
     for (String commandName : previousState.commands.keySet()) {\r
       this.commands.put(commandName, previousState.commands.get(commandName).copy());\r
@@ -50,7 +57,7 @@ public class Pazpar2State {
   }\r
   \r
   /**\r
-   * Checks if the provided command represents a state change\r
+   * Checks if a command represents a change of this state\r
    * \r
    * @param command\r
    * @return true if the command causes a change of state\r
@@ -67,6 +74,12 @@ public class Pazpar2State {
     }\r
   } \r
   \r
+  /**\r
+   * Returns a command from this state\r
+   * \r
+   * @param name\r
+   * @return\r
+   */  \r
   public Pazpar2Command getCommand(String name) {\r
     return commands.get(name);\r
   }\r
index 638effd..7479bdd 100644 (file)
@@ -47,6 +47,14 @@ public class StateManager {
     }\r
   }\r
   \r
+  /**\r
+   * Gets a detached copy of a command. For the change manager\r
+   * to become aware of any changes to the copy it must be \r
+   * checked back in with 'checkIn(Pazpar2Command)'\r
+   * \r
+   * @param commandName\r
+   * @return Copy this state's instance of the given command\r
+   */\r
   public Pazpar2Command checkOut (String commandName) {\r
     return getCurrentState().getCommand(commandName).copy();\r
   }\r
@@ -55,6 +63,12 @@ public class StateManager {
     return states.get(currentKey);\r
   }\r
   \r
+  /**\r
+   * Changes the current state key. Invoked from the UI to have the state \r
+   * manager switch to another state than the current one. \r
+   * \r
+   * @param key\r
+   */\r
   public void setCurrentStateKey(String key) {    \r
     if (currentKey.equals(key)) {\r
       logger.debug("setCurrentStateKey: no key change detected");\r
@@ -74,11 +88,27 @@ public class StateManager {
     }\r
   }\r
 \r
-  \r
+  /**\r
+   * Sets a pending-state-change flag for the given command. Used by\r
+   * the beans to decide whether, say, a search should be executed before\r
+   * doing the next show. \r
+   * \r
+   * It is up to the client to set and reset this flag since the state\r
+   * manager is not otherwise informed about actual request activities \r
+   * (only about the definition of commands to be executed)\r
+   * \r
+   * @param command\r
+   * @param bool\r
+   */\r
   public void hasPendingStateChange(String command, boolean bool) {\r
     pendingStateChanges.put(command, new Boolean(bool));\r
   }\r
   \r
+  /**\r
+   * \r
+   * @param command\r
+   * @return true if there is a non-executed command change in this state\r
+   */\r
   public boolean hasPendingStateChange (String command) {\r
     return pendingStateChanges.get(command).booleanValue();\r
   }\r