private Optional<RoadPlacement> getResults( String paramName, String queryParam, Projection projection) { UriBuilder url = endpoint(); url.queryParam(paramName, queryParam); Optional.ofNullable(projection).ifPresent(p -> url.queryParam("srid", projection.getSrid())); WebTarget target = getClient().target(url); return JerseyHelper.executeOptional(target) .map(JsonElement::getAsJsonObject) .map(RoadPlacementParser::parseRoadPlacement); }
private List<RoadPlacementBulkResult> getRoadPlacementsInBatch( String paramName, String queryParam, Projection projection) { UriBuilder url = bulkEndpoint(); url.queryParam(paramName, queryParam); Optional.ofNullable(projection).ifPresent(p -> url.queryParam("srid", projection.getSrid())); WebTarget target = getClient().target(url); JsonObject resultMap = JerseyHelper.execute(target).getAsJsonObject(); return resultMap .entrySet() .stream() .map(r -> RoadPlacementParser.parseRoadPlacementBulkResult(r.getKey(), r.getValue())) .collect(Collectors.toList()); }