@Override public GraphRowModel next() { String json = response.next(); if (json != null) { try { GraphRowModel graphRowModel = new GraphRowModel(); JSONObject jsonObject = getOuterObject(json); JSONArray dataObject = jsonObject.getJSONArray("results").getJSONObject(0).getJSONArray("data"); for (int i = 0; i < dataObject.length(); i++) { String graphJson = dataObject.getJSONObject(i).getString("graph"); String rowJson = dataObject.getJSONObject(i).getString("row"); GraphModel graphModel = objectMapper.readValue(graphJson, GraphModel.class); Object[] rows = objectMapper.readValue(rowJson, Object[].class); graphRowModel.addGraphRowResult(graphModel, rows); } return graphRowModel; } catch (Exception e) { LOGGER.error("failed to parse: {}", json); throw new RuntimeException(e); } } else { return null; } }
@Override public int rowId() { return response.rowId(); }
@Override public String[] columns() { return response.columns(); }
@Override public void initialiseScan(ResponseRecord record) { response.initialiseScan(record); }
@Override public void close() { response.close(); }