MCPcopy
hub / github.com/OpenTSDB/opentsdb / parseQS

Method parseQS

src/tsd/AnnotationRpc.java:311–343  ·  view source on GitHub ↗

Parses a query string for annotation information. Note that custom key/values are not supported via query string. Users must issue a POST or PUT with content data. @param query The query to parse @return An annotation object if parsing was successful @throws IllegalArgumentException - if the

(final HttpQuery query)

Source from the content-addressed store, hash-verified

309 * @throws IllegalArgumentException - if the request was malformed
310 */
311 private Annotation parseQS(final HttpQuery query) {
312 final Annotation note = new Annotation();
313
314 final String tsuid = query.getQueryStringParam("tsuid");
315 if (tsuid != null) {
316 note.setTSUID(tsuid);
317 }
318
319 final String start = query.getQueryStringParam("start_time");
320 final Long start_time = DateTime.parseDateTimeString(start, "");
321 if (start_time < 1) {
322 throw new BadRequestException("Missing start time");
323 }
324 // TODO - fix for ms support in the future
325 note.setStartTime(start_time / 1000);
326
327 final String end = query.getQueryStringParam("end_time");
328 final Long end_time = DateTime.parseDateTimeString(end, "");
329 // TODO - fix for ms support in the future
330 note.setEndTime(end_time / 1000);
331
332 final String description = query.getQueryStringParam("description");
333 if (description != null) {
334 note.setDescription(description);
335 }
336
337 final String notes = query.getQueryStringParam("notes");
338 if (notes != null) {
339 note.setNotes(notes);
340 }
341
342 return note;
343 }
344
345 private void fetchSingleAnnotation(final TSDB tsdb, final Annotation note,
346 final HttpQuery query) throws Exception {

Callers 1

executeMethod · 0.95

Calls 7

setTSUIDMethod · 0.95
parseDateTimeStringMethod · 0.95
setStartTimeMethod · 0.95
setEndTimeMethod · 0.95
setDescriptionMethod · 0.95
setNotesMethod · 0.95
getQueryStringParamMethod · 0.45

Tested by

no test coverage detected