pefernan commented on code in PR #1962:
URL: 
https://github.com/apache/incubator-kie-kogito-apps/pull/1962#discussion_r1469432984


##########
data-audit/kogito-addons-data-audit-quarkus/src/main/java/org/kie/kogito/app/audit/quarkus/GraphQLDataAuditRouter.java:
##########
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.app.audit.quarkus;
+
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.kie.kogito.app.audit.api.DataAuditQuery;
+import org.kie.kogito.app.audit.api.DataAuditQueryService;
+import org.kie.kogito.app.audit.api.DataAuditStoreProxyService;
+import org.kie.kogito.app.audit.graphql.GraphQLSchemaBuild;
+import org.kie.kogito.app.audit.spi.DataAuditContextFactory;
+
+import io.quarkus.vertx.web.Route;
+import io.vertx.core.json.JsonObject;
+import io.vertx.ext.web.RoutingContext;
+import io.vertx.ext.web.handler.graphql.ExecutionInputBuilderWithContext;
+import io.vertx.ext.web.handler.graphql.GraphQLHandler;
+import io.vertx.ext.web.handler.graphql.GraphQLHandlerOptions;
+
+import graphql.GraphQL;
+import jakarta.annotation.PostConstruct;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+import jakarta.transaction.Status;
+import jakarta.transaction.Synchronization;
+import jakarta.transaction.TransactionSynchronizationRegistry;
+import jakarta.transaction.Transactional;
+
+import static io.quarkus.vertx.web.Route.HttpMethod.GET;
+import static io.quarkus.vertx.web.Route.HttpMethod.POST;
+import static 
org.kie.kogito.app.audit.api.SubsystemConstants.DATA_AUDIT_QUERY_PATH;
+import static 
org.kie.kogito.app.audit.api.SubsystemConstants.DATA_AUDIT_REGISTRY_PATH;
+import static 
org.kie.kogito.app.audit.graphql.GraphQLSchemaManager.graphQLSchemaManagerInstance;
+
+@ApplicationScoped
+@Transactional
+public class GraphQLDataAuditRouter {
+
+    GraphQL graphQL;
+
+    GraphQLHandler graphQLHandler;
+
+    @Inject
+    DataAuditContextFactory dataAuditContextFactory;
+
+    private DataAuditQueryService dataAuditQueryService;
+
+    private DataAuditStoreProxyService dataAuditStoreProxyService;
+
+    @Inject
+    TransactionSynchronizationRegistry registry;
+
+    @PostConstruct
+    public void init() {
+        dataAuditStoreProxyService = 
DataAuditStoreProxyService.newAuditStoreService();
+        dataAuditQueryService = DataAuditQueryService.newAuditQuerySerice();
+
+        Map<String, String> queries =
+                
dataAuditStoreProxyService.findQueries(dataAuditContextFactory.newDataAuditContext()).stream().collect(Collectors.toMap(e
 -> e.getIdentifier(), e -> e.getQuery()));

Review Comment:
   ```suggestion
                   
dataAuditStoreProxyService.findQueries(dataAuditContextFactory.newDataAuditContext()).stream().collect(Collectors.toMap(DataAuditQuery::getIdentifier,
 DataAuditQuery::getGraphQLDefinition));
   ```
   
   @elguardian it was loading the SQL query instead of the graphql definition 
so the router couldn't startup properly.



##########
data-audit/kogito-addons-data-audit-springboot/src/main/java/org/kie/kogito/app/audit/springboot/GraphQLAuditDataRouteMapping.java:
##########
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.kie.kogito.app.audit.springboot;
+
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.kie.kogito.app.audit.api.DataAuditQuery;
+import org.kie.kogito.app.audit.api.DataAuditQueryService;
+import org.kie.kogito.app.audit.api.DataAuditStoreProxyService;
+import org.kie.kogito.app.audit.graphql.GraphQLSchemaBuild;
+import org.kie.kogito.app.audit.spi.DataAuditContextFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.support.TransactionSynchronization;
+import 
org.springframework.transaction.support.TransactionSynchronizationManager;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+import graphql.ExecutionResult;
+import jakarta.annotation.PostConstruct;
+
+import static 
org.kie.kogito.app.audit.api.SubsystemConstants.DATA_AUDIT_QUERY_PATH;
+import static 
org.kie.kogito.app.audit.api.SubsystemConstants.DATA_AUDIT_REGISTRY_PATH;
+import static 
org.kie.kogito.app.audit.graphql.GraphQLSchemaManager.graphQLSchemaManagerInstance;
+
+@RestController
+@Transactional
+public class GraphQLAuditDataRouteMapping {
+
+    private DataAuditQueryService dataAuditQueryService;
+
+    @Autowired
+    DataAuditContextFactory dataAuditContextFactory;
+
+    private DataAuditStoreProxyService dataAuditStoreProxyService;
+
+    @PostConstruct
+    public void init() {
+        dataAuditQueryService = DataAuditQueryService.newAuditQuerySerice();
+        dataAuditStoreProxyService = 
DataAuditStoreProxyService.newAuditStoreService();
+
+        Map<String, String> queries =
+                
dataAuditStoreProxyService.findQueries(dataAuditContextFactory.newDataAuditContext()).stream().collect(Collectors.toMap(e
 -> e.getIdentifier(), e -> e.getQuery()));

Review Comment:
   ```suggestion
                   
dataAuditStoreProxyService.findQueries(dataAuditContextFactory.newDataAuditContext()).stream().collect(Collectors.toMap(DataAuditQuery::getIdentifier,
 DataAuditQuery::getGraphQLDefinition));
   ```
   
   Same here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to