Parses the tree ID from a query Used often so it's been broken into it's own method @param query The HTTP query to work with @param required Whether or not the ID is required for the given call @return The tree ID or 0 if not provided
(HttpQuery query, final boolean required)
| 690 | * @return The tree ID or 0 if not provided |
| 691 | */ |
| 692 | private int parseTreeId(HttpQuery query, final boolean required) { |
| 693 | try{ |
| 694 | if (required) { |
| 695 | return Integer.parseInt(query.getRequiredQueryStringParam("treeid")); |
| 696 | } else { |
| 697 | if (query.hasQueryStringParam("treeid")) { |
| 698 | return Integer.parseInt(query.getQueryStringParam("treeid")); |
| 699 | } else { |
| 700 | return 0; |
| 701 | } |
| 702 | } |
| 703 | } catch (NumberFormatException nfe) { |
| 704 | throw new BadRequestException("Unable to parse 'tree' value", nfe); |
| 705 | } |
| 706 | } |
| 707 | |
| 708 | /** |
| 709 | * Used to parse a list of TSUIDs from the query string for collision or not |
no test coverage detected