/**
   * Validates a notification and sets its valid flag and validationmessage string.
   *
   * @param n the notification to validate
   * @return
   */
  protected void validate(NotificationInfo n) {

    if (n == null) {
      throw new IllegalArgumentException("NotificationInfo argument cannot be null");
    }

    // assume notification is valid, handlers will reset state and message, if something is wrong
    n.setValid(true);
    n.setValidationMessage("OK");

    // consider touch and transient notification to always be valid
    if (n.isTouch() || n.isTransient()) {
      return;
    }

    switch (n.getEventType()) {
      case Notification.SET:
        handleSetNotification(n);
        break;
      case Notification.ADD:
        handleAddNotification(n);
        break;
      case Notification.REMOVE:
        handleRemoveNotification(n);
        break;
      case Notification.ADD_MANY:
        handleAddManyNotification(n);
        break;
      case Notification.REMOVE_MANY:
        handleRemoveManyNotification(n);
        break;
      case Notification.UNSET:
        handleUnsetNotification(n);
        break;
      case Notification.MOVE:
        handleMoveNotification(n);
        break;
      default:
        handleUnknownNotification(n);
        break;
    }
  }