/** * Handle DELETE. * * @param path the path * @param jsonApiDocument the json api document * @param opaqueUser the opaque user * @return Elide response object */ public ElideResponse delete(String path, String jsonApiDocument, Object opaqueUser) { return handleRequest(false, opaqueUser, dataStore::beginTransaction, (tx, user) -> { JsonApiDocument jsonApiDoc = StringUtils.isEmpty(jsonApiDocument) ? new JsonApiDocument() : mapper.readJsonApiDocument(jsonApiDocument); RequestScope requestScope = new RequestScope(path, jsonApiDoc, tx, user, null, elideSettings, false); BaseVisitor visitor = new DeleteVisitor(requestScope); return visit(path, requestScope, visitor); }); }
/** * Handle POST. * * @param path the path * @param jsonApiDocument the json api document * @param opaqueUser the opaque user * @return Elide response object */ public ElideResponse post(String path, String jsonApiDocument, Object opaqueUser) { return handleRequest(false, opaqueUser, dataStore::beginTransaction, (tx, user) -> { JsonApiDocument jsonApiDoc = mapper.readJsonApiDocument(jsonApiDocument); RequestScope requestScope = new RequestScope(path, jsonApiDoc, tx, user, null, elideSettings, false); BaseVisitor visitor = new PostVisitor(requestScope); return visit(path, requestScope, visitor); }); }
/** * Handle GET. * * @param path the path * @param queryParams the query params * @param opaqueUser the opaque user * @return Elide response object */ public ElideResponse get(String path, MultivaluedMap<String, String> queryParams, Object opaqueUser) { return handleRequest(true, opaqueUser, dataStore::beginReadTransaction, (tx, user) -> { JsonApiDocument jsonApiDoc = new JsonApiDocument(); RequestScope requestScope = new RequestScope(path, jsonApiDoc, tx, user, queryParams, elideSettings, false); BaseVisitor visitor = new GetVisitor(requestScope); return visit(path, requestScope, visitor); }); }
/** * Handle DELETE. * * @param path the path * @param jsonApiDocument the json api document * @param opaqueUser the opaque user * @return Elide response object */ public ElideResponse delete(String path, String jsonApiDocument, Object opaqueUser) { return handleRequest(false, opaqueUser, dataStore::beginTransaction, (tx, user) -> { JsonApiDocument jsonApiDoc = StringUtils.isEmpty(jsonApiDocument) ? new JsonApiDocument() : mapper.readJsonApiDocument(jsonApiDocument); RequestScope requestScope = new RequestScope(path, jsonApiDoc, tx, user, null, elideSettings, false); BaseVisitor visitor = new DeleteVisitor(requestScope); return visit(path, requestScope, visitor); }); }
/** * Handle GET. * * @param path the path * @param queryParams the query params * @param opaqueUser the opaque user * @return Elide response object */ public ElideResponse get(String path, MultivaluedMap<String, String> queryParams, Object opaqueUser) { return handleRequest(true, opaqueUser, dataStore::beginReadTransaction, (tx, user) -> { JsonApiDocument jsonApiDoc = new JsonApiDocument(); RequestScope requestScope = new RequestScope(path, jsonApiDoc, tx, user, queryParams, elideSettings, false); BaseVisitor visitor = new GetVisitor(requestScope); return visit(path, requestScope, visitor); }); }
/** * Handle POST. * * @param path the path * @param jsonApiDocument the json api document * @param opaqueUser the opaque user * @return Elide response object */ public ElideResponse post(String path, String jsonApiDocument, Object opaqueUser) { return handleRequest(false, opaqueUser, dataStore::beginTransaction, (tx, user) -> { JsonApiDocument jsonApiDoc = mapper.readJsonApiDocument(jsonApiDocument); RequestScope requestScope = new RequestScope(path, jsonApiDoc, tx, user, null, elideSettings, false); BaseVisitor visitor = new PostVisitor(requestScope); return visit(path, requestScope, visitor); }); }
handler = (tx, user) -> { JsonApiDocument jsonApiDoc = mapper.readJsonApiDocument(jsonApiDocument); RequestScope requestScope = new RequestScope(path, jsonApiDoc, tx, user, null, elideSettings, false); BaseVisitor visitor = new PatchVisitor(requestScope); return visit(path, requestScope, visitor);
handler = (tx, user) -> { JsonApiDocument jsonApiDoc = mapper.readJsonApiDocument(jsonApiDocument); RequestScope requestScope = new RequestScope(path, jsonApiDoc, tx, user, null, elideSettings, false); BaseVisitor visitor = new PatchVisitor(requestScope); return visit(path, requestScope, visitor);