MCPcopy Index your code
hub / github.com/OpenTSDB/opentsdb / parseTreeId

Method parseTreeId

src/tsd/TreeRpc.java:692–706  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 5

handleBranchMethod · 0.95
handleRulesMethod · 0.95
parseTreeMethod · 0.95
parseRuleMethod · 0.95
parseTSUIDsListMethod · 0.95

Calls 3

hasQueryStringParamMethod · 0.45
getQueryStringParamMethod · 0.45

Tested by

no test coverage detected