Search in sources :

Example 1 with Patch

use of com.yahoo.elide.jsonapi.models.Patch in project elide by yahoo.

the class JsonApiPatch method processJsonPatch.

/**
 * Process json patch.
 *
 * @param dataStore the dataStore
 * @param uri the uri
 * @param patchDoc the patch doc
 * @param requestScope request scope
 * @return pair
 */
public static Supplier<Pair<Integer, JsonNode>> processJsonPatch(DataStore dataStore, String uri, String patchDoc, PatchRequestScope requestScope) {
    List<Patch> actions;
    try {
        actions = requestScope.getMapper().readJsonApiPatchExtDoc(patchDoc);
    } catch (IOException e) {
        throw new InvalidEntityBodyException(patchDoc);
    }
    JsonApiPatch processor = new JsonApiPatch(dataStore, actions, uri, requestScope);
    return processor.processActions(requestScope);
}
Also used : InvalidEntityBodyException(com.yahoo.elide.core.exceptions.InvalidEntityBodyException) IOException(java.io.IOException) Patch(com.yahoo.elide.jsonapi.models.Patch)

Aggregations

InvalidEntityBodyException (com.yahoo.elide.core.exceptions.InvalidEntityBodyException)1 Patch (com.yahoo.elide.jsonapi.models.Patch)1 IOException (java.io.IOException)1