code: private Mode resolve(Mode mode) {
      if (mode == Mode.CURRENT) { 
        return currentMode;
      }
      // For an action that does not specify the useMode attribute
      // we create an anonymous next mode that becomes defined if we
      // have a nested mode element inside the action.
      // If we do not have a nested mode then the anonymous mode
      // is not defined and basically that means we should use the
      // current mode to perform that action.
      if (mode.isAnonymous() && !mode.isDefined()) {
        return currentMode;
      }
      return mode;
    }
docs: Resolves the Mode.CURRENT to the currentMode for this mode usage.
  If Mode.CURRENT is not passed as argument then the same mode is returned
  with the exception of an anonymous mode that is not defined, when we
  get also the current mode.
  @param mode The mode to be resolved.
  @return Either the current mode mode usage or the same mode passed as argument.