@Test public void testTransformerObjectGroupSuccess() throws Exception { final JsonNode sampleObjectGroup = JsonHandler.getFromFile(PropertiesUtils.findFile("sample_objectGroup_document.json")); assertNotNull(JsonTransformer.transformResultObjects(sampleObjectGroup)); }
public static JsonNode transformResultObjects(JsonNode searchResult) { ParametersChecker.checkParameter("Result cannot be empty", searchResult); final ObjectNode resultNode = JsonHandler.createObjectNode(); long nbObjects = 0; final JsonNode result = searchResult.get("$results").get(0); final ArrayNode arrayNode = JsonHandler.createArrayNode(); if (result != null) { final JsonNode qualifiers = result.get("#qualifiers"); final List<JsonNode> versions = qualifiers.findValues("versions"); final Map<String, Integer> usages = new HashMap<>(); for (final JsonNode version : versions) { for (final JsonNode object : version) { arrayNode.add(getDataObject(usages, object)); nbObjects++; } } } resultNode.put("nbObjects", nbObjects); resultNode.set("versions", arrayNode); return resultNode; }
JsonTransformer { public static JsonNode transformResultObjects(JsonNode searchResult) { ParametersChecker.checkParameter("Result cannot be empty", searchResult); final ObjectNode resultNode = JsonHandler.createObjectNode(); long nbObjects = 0; final JsonNode result = searchResult.get("$results").get(0); final ArrayNode arrayNode = JsonHandler.createArrayNode(); if (result != null) { final JsonNode qualifiers = result.get("#qualifiers"); final List<JsonNode> versions = qualifiers.findValues("versions"); final Map<String, Integer> usages = new HashMap<>(); for (final JsonNode version : versions) { for (final JsonNode object : version) { arrayNode.add(getDataObject(usages, object)); nbObjects++; } } } resultNode.put("nbObjects", nbObjects); resultNode.set("versions", arrayNode); return resultNode; } }
JsonTransformer { public static JsonNode transformResultObjects(JsonNode searchResult) { ParametersChecker.checkParameter("Result cannot be empty", searchResult); final ObjectNode resultNode = JsonHandler.createObjectNode(); long nbObjects = 0; final JsonNode result = searchResult.get("$results").get(0); final ArrayNode arrayNode = JsonHandler.createArrayNode(); if (result != null) { final JsonNode qualifiers = result.get("#qualifiers"); final List<JsonNode> versions = qualifiers.findValues("versions"); final Map<String, Integer> usages = new HashMap<>(); for (final JsonNode version : versions) { for (final JsonNode object : version) { arrayNode.add(getDataObject(usages, object)); nbObjects++; } } } resultNode.put("nbObjects", nbObjects); resultNode.set("versions", arrayNode); return resultNode; } private  JsonTransformer(); }
JsonTransformer { public static JsonNode transformResultObjects(JsonNode searchResult) { ParametersChecker.checkParameter("Result cannot be empty", searchResult); final ObjectNode resultNode = JsonHandler.createObjectNode(); long nbObjects = 0; final JsonNode result = searchResult.get("$results").get(0); final ArrayNode arrayNode = JsonHandler.createArrayNode(); if (result != null) { final JsonNode qualifiers = result.get("#qualifiers"); final List<JsonNode> versions = qualifiers.findValues("versions"); final Map<String, Integer> usages = new HashMap<>(); for (final JsonNode version : versions) { for (final JsonNode object : version) { arrayNode.add(getDataObject(usages, object)); nbObjects++; } } } resultNode.put("nbObjects", nbObjects); resultNode.set("versions", arrayNode); return resultNode; } private  JsonTransformer(); static JsonNode transformResultObjects(JsonNode searchResult); static ObjectNode buildAllParentsRef(String unitId, JsonNode allParents); static ByteArrayOutputStream buildLogbookStatCsvFile(JsonNode logbookOperation); }
JsonTransformer { public static JsonNode transformResultObjects(JsonNode searchResult) { ParametersChecker.checkParameter("Result cannot be empty", searchResult); final ObjectNode resultNode = JsonHandler.createObjectNode(); long nbObjects = 0; final JsonNode result = searchResult.get("$results").get(0); final ArrayNode arrayNode = JsonHandler.createArrayNode(); if (result != null) { final JsonNode qualifiers = result.get("#qualifiers"); final List<JsonNode> versions = qualifiers.findValues("versions"); final Map<String, Integer> usages = new HashMap<>(); for (final JsonNode version : versions) { for (final JsonNode object : version) { arrayNode.add(getDataObject(usages, object)); nbObjects++; } } } resultNode.put("nbObjects", nbObjects); resultNode.set("versions", arrayNode); return resultNode; } private  JsonTransformer(); static JsonNode transformResultObjects(JsonNode searchResult); static ObjectNode buildAllParentsRef(String unitId, JsonNode allParents); static ByteArrayOutputStream buildLogbookStatCsvFile(JsonNode logbookOperation);  }