Source:
<code>public void init() { get( "/queries", (req, res) -> { <START> QueryRequestWrapper queryRequestWrapper = new QueryRequestWrapper(req, filterBuilder); <END> return ResultIterable.resultIterable( catalogFramework, queryRequestWrapper.getQueryRequest(), queryRequestWrapper.getCount()) .stream() .filter(Objects::nonNull) .map(Result::getMetacard) .filter(Objects::nonNull) .map(QueryBasic::new) .collect(Collectors.toList()); }, GSON::toJson); get( "/queries/:id", (req, res) -> { String id = req.params("id"); Metacard metacard = endpointUtil.getMetacardById(id); QueryBasic query = new QueryBasic(metacard); return GSON.toJson(query); }); post( "/queries", (req, res) -> { String body = endpointUtil.safeGetBody(req); QueryBasic query = GSON.fromJson(body, QueryBasic.class); query.setOwner(getSubjectIdentifier()); CreateRequest createRequest = new CreateRequestImpl(query.getMetacard()); CreateResponse createResponse = catalogFramework.create(createRequest); Metacard metacard = createResponse.getCreatedMetacards().get(0); QueryBasic created = new QueryBasic(metacard); res.status(201); return GSON.toJson(created); }); put( "/queries/:id", (req, res) -> { String id = req.params("id"); String body = endpointUtil.safeGetBody(req); QueryBasic query = GSON.fromJson(body, QueryBasic.class); UpdateRequest request = new UpdateRequestImpl(id, query.getMetacard()); UpdateResponse response = catalogFramework.update(request); Metacard metacard = response.getUpdatedMetacards().get(0).getNewMetacard(); QueryBasic updated = new QueryBasic(metacard); return GSON.toJson(updated); }); delete( "/queries/:id", (req, res) -> { String id = req.params("id"); catalogFramework.delete(new DeleteRequestImpl(id)); res.status(204); return null; }, GSON::toJson); }</code><technical_language>a QueryRequest object this confusing. more aptly named RetrieveAllRequest that</technical_language>

Target:
public void init() { get( "/queries", (req, res) -> { RetreiveAllQueryRequests retreiveAllQueryRequests = new RetreiveAllQueryRequests(req, filterBuilder); return ResultIterable.resultIterable( catalogFramework, retreiveAllQueryRequests.getQueryRequest(), retreiveAllQueryRequests.getCount()) .stream() .filter(Objects::nonNull) .map(Result::getMetacard) .filter(Objects::nonNull) .map(QueryBasic::new) .collect(Collectors.toList()); }, GSON::toJson); get( "/queries/:id", (req, res) -> { String id = req.params("id"); Metacard metacard = endpointUtil.getMetacardById(id); QueryBasic query = new QueryBasic(metacard); return GSON.toJson(query); }); post( "/queries", (req, res) -> { String body = endpointUtil.safeGetBody(req); QueryBasic query = GSON.fromJson(body, QueryBasic.class); query.setOwner(getSubjectIdentifier()); CreateRequest createRequest = new CreateRequestImpl(query.getMetacard()); CreateResponse createResponse = catalogFramework.create(createRequest); Metacard metacard = createResponse.getCreatedMetacards().get(0); QueryBasic created = new QueryBasic(metacard); res.status(201); return GSON.toJson(created); }); put( "/queries/:id", (req, res) -> { String id = req.params("id"); String body = endpointUtil.safeGetBody(req); QueryBasic query = GSON.fromJson(body, QueryBasic.class); UpdateRequest request = new UpdateRequestImpl(id, query.getMetacard()); UpdateResponse response = catalogFramework.update(request); Metacard metacard = response.getUpdatedMetacards().get(0).getNewMetacard(); QueryBasic updated = new QueryBasic(metacard); return GSON.toJson(updated); }); delete( "/queries/:id", (req, res) -> { String id = req.params("id"); catalogFramework.delete(new DeleteRequestImpl(id)); res.status(204); return null; }, GSON::toJson); }