Some javadoc
[mkjsf-moved-to-github.git] / src / main / java / com / indexdata / pz2utils4jsf / pazpar2 / state / StateManager.java
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