TraceService extends SearchableService { public StringHandle getTraces(TraceQuery traceQuery) { queryMgr.setPageLength(traceQuery.count); StructuredQueryBuilder sb = queryMgr.newStructuredQueryBuilder(SEARCH_OPTIONS_NAME); ArrayList<StructuredQueryDefinition> queries = new ArrayList<>(); if (traceQuery.query != null && !traceQuery.query.equals("")) { queries.add(sb.term(traceQuery.query)); } StructuredQueryDefinition def = addRangeConstraint(sb, "identifier", traceQuery.identifier); if (def != null) { queries.add(def); } def = addRangeConstraint(sb, "jobId", traceQuery.jobId); if (def != null) { queries.add(def); } if (traceQuery.hasError != null) { def = addRangeConstraint(sb, "hasError", Boolean.toString(traceQuery.hasError)); if (def != null) { queries.add(def); } } def = addRangeConstraint(sb, "flowType", traceQuery.flowType); if (def != null) { queries.add(def); } StructuredQueryDefinition sqd = sb.and(queries.toArray(new StructuredQueryDefinition[0])); String searchXml = sqd.serialize(); RawCombinedQueryDefinition querydef = queryMgr.newRawCombinedQueryDefinition(new StringHandle(searchXml), SEARCH_OPTIONS_NAME); querydef.setResponseTransform(new ServerTransform("mlTraceSearchResults")); StringHandle sh = new StringHandle(); sh.setFormat(Format.JSON); return queryMgr.search(querydef, sh, traceQuery.start); } TraceService(DatabaseClient client); StringHandle getTraces(TraceQuery traceQuery); JsonNode getTrace(String traceId);  }
@Test public void getTraces() { TraceService tm = new TraceService(traceClient); TraceQuery traceQuery = new TraceQuery(); traceQuery.start = 1L; traceQuery.count = 10L; tm.getTraces(traceQuery); }