Search in sources :

Example 1 with GetVisitor

use of com.yahoo.elide.jsonapi.parser.GetVisitor in project elide by yahoo.

the class Elide method get.

/**
 * Handle GET.
 *
 * @param baseUrlEndPoint base URL with prefix endpoint
 * @param path the path
 * @param queryParams the query params
 * @param requestHeaders the request headers
 * @param opaqueUser the opaque user
 * @param apiVersion the API version
 * @param requestId the request ID
 * @return Elide response object
 */
public ElideResponse get(String baseUrlEndPoint, String path, MultivaluedMap<String, String> queryParams, Map<String, List<String>> requestHeaders, User opaqueUser, String apiVersion, UUID requestId) {
    if (elideSettings.isStrictQueryParams()) {
        try {
            verifyQueryParams(queryParams);
        } catch (BadRequestException e) {
            return buildErrorResponse(e, false);
        }
    }
    return handleRequest(true, opaqueUser, dataStore::beginReadTransaction, requestId, (tx, user) -> {
        JsonApiDocument jsonApiDoc = new JsonApiDocument();
        RequestScope requestScope = new RequestScope(baseUrlEndPoint, path, apiVersion, jsonApiDoc, tx, user, queryParams, requestHeaders, requestId, elideSettings);
        requestScope.setEntityProjection(new EntityProjectionMaker(elideSettings.getDictionary(), requestScope).parsePath(path));
        BaseVisitor visitor = new GetVisitor(requestScope);
        return visit(path, requestScope, visitor);
    });
}
Also used : JsonApiDocument(com.yahoo.elide.jsonapi.models.JsonApiDocument) BaseVisitor(com.yahoo.elide.jsonapi.parser.BaseVisitor) BadRequestException(com.yahoo.elide.core.exceptions.BadRequestException) GetVisitor(com.yahoo.elide.jsonapi.parser.GetVisitor) EntityProjectionMaker(com.yahoo.elide.jsonapi.EntityProjectionMaker) PatchRequestScope(com.yahoo.elide.jsonapi.extensions.PatchRequestScope) RequestScope(com.yahoo.elide.core.RequestScope)

Aggregations

RequestScope (com.yahoo.elide.core.RequestScope)1 BadRequestException (com.yahoo.elide.core.exceptions.BadRequestException)1 EntityProjectionMaker (com.yahoo.elide.jsonapi.EntityProjectionMaker)1 PatchRequestScope (com.yahoo.elide.jsonapi.extensions.PatchRequestScope)1 JsonApiDocument (com.yahoo.elide.jsonapi.models.JsonApiDocument)1 BaseVisitor (com.yahoo.elide.jsonapi.parser.BaseVisitor)1 GetVisitor (com.yahoo.elide.jsonapi.parser.GetVisitor)1