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

Method parseTree

src/tsd/TreeRpc.java:574–610  ·  view source on GitHub ↗

Parses query string parameters into a blank tree object. Used for updating tree meta data. @param query The HTTP query to work with @return A tree object filled in with changes @throws BadRequestException if some of the data was invalid

(HttpQuery query)

Source from the content-addressed store, hash-verified

572 * @throws BadRequestException if some of the data was invalid
573 */
574 private Tree parseTree(HttpQuery query) {
575 final Tree tree = new Tree(parseTreeId(query, false));
576 if (query.hasQueryStringParam("name")) {
577 tree.setName(query.getQueryStringParam("name"));
578 }
579 if (query.hasQueryStringParam("description")) {
580 tree.setDescription(query.getQueryStringParam("description"));
581 }
582 if (query.hasQueryStringParam("notes")) {
583 tree.setNotes(query.getQueryStringParam("notes"));
584 }
585 if (query.hasQueryStringParam("strict_match")) {
586 if (query.getQueryStringParam("strict_match").toLowerCase()
587 .equals("true")) {
588 tree.setStrictMatch(true);
589 } else {
590 tree.setStrictMatch(false);
591 }
592 }
593 if (query.hasQueryStringParam("enabled")) {
594 final String enabled = query.getQueryStringParam("enabled");
595 if (enabled.toLowerCase().equals("true")) {
596 tree.setEnabled(true);
597 } else {
598 tree.setEnabled(false);
599 }
600 }
601 if (query.hasQueryStringParam("store_failures")) {
602 if (query.getQueryStringParam("store_failures").toLowerCase()
603 .equals("true")) {
604 tree.setStoreFailures(true);
605 } else {
606 tree.setStoreFailures(false);
607 }
608 }
609 return tree;
610 }
611
612 /**
613 * Parses query string parameters into a blank tree rule object. Used for

Callers 1

handleTreeMethod · 0.95

Calls 10

parseTreeIdMethod · 0.95
setNameMethod · 0.95
setDescriptionMethod · 0.95
setNotesMethod · 0.95
setStrictMatchMethod · 0.95
setEnabledMethod · 0.95
setStoreFailuresMethod · 0.95
hasQueryStringParamMethod · 0.45
getQueryStringParamMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected