From 18be05c312bfe34d4ee1f95a865c68bb3f663a75 Mon Sep 17 00:00:00 2001 From: Laura Schanno Date: Thu, 3 Oct 2024 14:27:17 -0400 Subject: [PATCH 1/2] Add skeleton query validation endpoint Add a skeleton implementation of a query validation endpoint to allow partners to begin implementation. Part of work for #2585 --- .../query/runner/QueryExecutorBean.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/web-services/query/src/main/java/datawave/webservice/query/runner/QueryExecutorBean.java b/web-services/query/src/main/java/datawave/webservice/query/runner/QueryExecutorBean.java index 4044facb91..3ca3bb12b6 100644 --- a/web-services/query/src/main/java/datawave/webservice/query/runner/QueryExecutorBean.java +++ b/web-services/query/src/main/java/datawave/webservice/query/runner/QueryExecutorBean.java @@ -2997,6 +2997,26 @@ private void updateQueryParams(Query q, String queryLogicName, String query, Dat } } + /** + * @param queryLogicName + * the logic name + * @param queryParameters + * the query parameters + * @return the generic response + */ + @POST + @Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf", + "application/x-protostuff"}) + @Path("/{logicName}/validateQuery") + @Interceptors({RequiredInterceptor.class, ResponseInterceptor.class}) + @Timed(name = "dw.query.validateQuery", absolute = true) + public GenericResponse validateQuery(@Required("logicName") @PathParam("logicName") String queryLogicName, + MultivaluedMap queryParameters) { + GenericResponse response = new GenericResponse<>(); + response.setMessages(Collections.singletonList("Query validator coming soon.")); + throw new DatawaveWebApplicationException(new UnsupportedOperationException("Query validator not implemented"), response, 501); + } + /** * Administrator credentials required. Returns list of queries for some other user * From 29a7bd3fd0ec6b39a27df34c8afc16a0d9f09d75 Mon Sep 17 00:00:00 2001 From: Laura Schanno Date: Wed, 9 Oct 2024 16:25:24 -0400 Subject: [PATCH 2/2] Rename endpoint to validate --- .../datawave/webservice/query/runner/QueryExecutorBean.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web-services/query/src/main/java/datawave/webservice/query/runner/QueryExecutorBean.java b/web-services/query/src/main/java/datawave/webservice/query/runner/QueryExecutorBean.java index 3ca3bb12b6..ddb81dc9a7 100644 --- a/web-services/query/src/main/java/datawave/webservice/query/runner/QueryExecutorBean.java +++ b/web-services/query/src/main/java/datawave/webservice/query/runner/QueryExecutorBean.java @@ -3007,7 +3007,7 @@ private void updateQueryParams(Query q, String queryLogicName, String query, Dat @POST @Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf", "application/x-protostuff"}) - @Path("/{logicName}/validateQuery") + @Path("/{logicName}/validate") @Interceptors({RequiredInterceptor.class, ResponseInterceptor.class}) @Timed(name = "dw.query.validateQuery", absolute = true) public GenericResponse validateQuery(@Required("logicName") @PathParam("logicName") String queryLogicName,