in scim-core/src/main/java/org/apache/directory/scim/core/repository/UpdateRequest.java [267:291]
List<PatchOperation> convertToPatchOperations(JsonNode node) throws IllegalArgumentException, IllegalAccessException, JsonProcessingException {
List<PatchOperation> operations = new ArrayList<>();
if (node == null) {
return Collections.emptyList();
}
if (!(node instanceof ArrayNode)) {
throw new RuntimeException("Expecting an instance of a ArrayNode, but got: " + node.getClass());
}
ArrayNode root = (ArrayNode) node;
for (int i = 0; i < root.size(); i++) {
ObjectNode patchNode = (ObjectNode) root.get(i);
JsonNode operationNode = patchNode.get(OPERATION);
JsonNode pathNode = patchNode.get(PATH);
JsonNode valueNode = patchNode.get(VALUE);
List<PatchOperation> nodeOperations = convertNodeToPatchOperations(operationNode.asText(), pathNode.asText(), valueNode);
if (!nodeOperations.isEmpty()) {
operations.addAll(nodeOperations);
}
}
return operations;
}