You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by da...@apache.org on 2024/01/19 17:36:56 UTC

(causeway) branch CAUSEWAY-3676 updated: CAUSEWAY-3676: towards moving addAction onto service structure

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch CAUSEWAY-3676
in repository https://gitbox.apache.org/repos/asf/causeway.git


The following commit(s) were added to refs/heads/CAUSEWAY-3676 by this push:
     new f31bf56c11 CAUSEWAY-3676: towards moving addAction onto service structure
f31bf56c11 is described below

commit f31bf56c11ca2f31a02b1aa0791ce39ff524b393
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Fri Jan 19 17:35:44 2024 +0000

    CAUSEWAY-3676: towards moving addAction onto service structure
---
 .../viewer/graphql/viewer/source/QueryFieldFactory.java   | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/incubator/viewers/graphql/viewer/src/main/java/org/apache/causeway/viewer/graphql/viewer/source/QueryFieldFactory.java b/incubator/viewers/graphql/viewer/src/main/java/org/apache/causeway/viewer/graphql/viewer/source/QueryFieldFactory.java
index 0cbb1c6774..4d24d5f299 100644
--- a/incubator/viewers/graphql/viewer/src/main/java/org/apache/causeway/viewer/graphql/viewer/source/QueryFieldFactory.java
+++ b/incubator/viewers/graphql/viewer/src/main/java/org/apache/causeway/viewer/graphql/viewer/source/QueryFieldFactory.java
@@ -56,6 +56,7 @@ import lombok.val;
 @RequiredArgsConstructor(onConstructor_ = {@Inject})
 public class QueryFieldFactory {
 
+    private static ObjectAction objectAction;
     private final ServiceRegistry serviceRegistry;
     private final SpecificationLoader specificationLoader;
 
@@ -88,11 +89,9 @@ public class QueryFieldFactory {
             val serviceAsGraphQlType = gqlvServiceStructure.getGraphQlTypeBuilder();
 
             objectActionList
-            .forEach(objectAction -> {
-                addAction(objectAction, serviceAsGraphQlType);
-            });
+            .forEach(objectAction -> addAction(objectAction, gqlvServiceStructure));
 
-            GraphQLObjectType graphQLObjectType = gqlvServiceStructure.buildObjectGqlType();
+            gqlvServiceStructure.buildObjectGqlType();
 
             objectActionList
             .forEach(objectAction -> {
@@ -156,7 +155,13 @@ public class QueryFieldFactory {
             });
     }
 
-    private static void addAction(ObjectAction objectAction, GraphQLObjectType.Builder serviceAsGraphQlType) {
+    private static void addAction(
+            final ObjectAction objectAction,
+            final GqlvServiceStructure gqlvServiceStructure) {
+
+        val serviceAsGraphQlType = gqlvServiceStructure.getGraphQlTypeBuilder();
+
+        QueryFieldFactory.objectAction = objectAction;
         String fieldName = objectAction.getId();
 
         GraphQLFieldDefinition.Builder builder = newFieldDefinition()