docs: private TreeRule parseRule(HttpQuery query) {
      final TreeRule rule = new TreeRule(parseTreeId(query, true));
      
      if (query.hasQueryStringParam("type")) {
        try {
          rule.setType(TreeRule.stringToType(query.getQueryStringParam("type")));
        } catch (IllegalArgumentException e) {
          throw new BadRequestException("Unable to parse the 'type' parameter", e);
        }
      }
      if (query.hasQueryStringParam("field")) {
        rule.setField(query.getQueryStringParam("field"));
      }
      if (query.hasQueryStringParam("custom_field")) {
        rule.setCustomField(query.getQueryStringParam("custom_field"));
      }
      if (query.hasQueryStringParam("regex")) {
        try {
          rule.setRegex(query.getQueryStringParam("regex"));
        } catch (PatternSyntaxException e) {
          throw new BadRequestException(
              "Unable to parse the 'regex' parameter", e);
        }
      }
      if (query.hasQueryStringParam("separator")) {
        rule.setSeparator(query.getQueryStringParam("separator"));
      }
      if (query.hasQueryStringParam("description")) {
        rule.setDescription(query.getQueryStringParam("description"));
      }
      if (query.hasQueryStringParam("notes")) {
        rule.setNotes(query.getQueryStringParam("notes"));
      }
      if (query.hasQueryStringParam("regex_group_idx")) {
        try {
          rule.setRegexGroupIdx(Integer.parseInt(
              query.getQueryStringParam("regex_group_idx")));
        } catch (NumberFormatException e) {
          throw new BadRequestException(
              "Unable to parse the 'regex_group_idx' parameter", e);
        }
      }
      if (query.hasQueryStringParam("display_format")) {
        rule.setDisplayFormat(query.getQueryStringParam("display_format"));
      }
      //if (query.hasQueryStringParam("level")) {
        try {
          rule.setLevel(Integer.parseInt(
              query.getRequiredQueryStringParam("level")));
        } catch (NumberFormatException e) {
          throw new BadRequestException(
              "Unable to parse the 'level' parameter", e);
        }
      //}
      //if (query.hasQueryStringParam("order")) {
        try {
          rule.setOrder(Integer.parseInt(
              query.getRequiredQueryStringParam("order")));
        } catch (NumberFormatException e) {
          throw new BadRequestException(
              "Unable to parse the 'order' parameter", e);
        }
      //}
      return rule;
    }