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/29 00:19:49 UTC

(causeway-app-simpleapp) branch jpa-SNAPSHOT updated: updates to include graphql viewer

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

danhaywood pushed a commit to branch jpa-SNAPSHOT
in repository https://gitbox.apache.org/repos/asf/causeway-app-simpleapp.git


The following commit(s) were added to refs/heads/jpa-SNAPSHOT by this push:
     new 308057e  updates to include graphql viewer
308057e is described below

commit 308057e0b6530ce0adb6d31d8f07ec97de3f41af
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Mon Jan 29 00:17:41 2024 +0000

    updates to include graphql viewer
---
 .../java/domainapp/modules/simple/dom/so/SimpleObject.java |  2 +-
 webapp/pom.xml                                             |  5 +++++
 webapp/src/main/java/domainapp/webapp/AppManifest.java     |  6 ++++++
 webapp/src/main/resources/application.yml                  | 14 ++++++++++++++
 webapp/src/main/resources/config/application.properties    |  4 ++++
 webapp/src/main/resources/static/index.html                | 10 ++++++++++
 6 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/module-simple/src/main/java/domainapp/modules/simple/dom/so/SimpleObject.java b/module-simple/src/main/java/domainapp/modules/simple/dom/so/SimpleObject.java
index e633933..c28dd9d 100644
--- a/module-simple/src/main/java/domainapp/modules/simple/dom/so/SimpleObject.java
+++ b/module-simple/src/main/java/domainapp/modules/simple/dom/so/SimpleObject.java
@@ -140,7 +140,7 @@ public class SimpleObject implements Comparable<SimpleObject>, CalendarEventable
     private BlobJpaEmbeddable attachment;
 
     @PdfJsViewer
-    @Property()
+    @Property(optionality = Optionality.OPTIONAL)
     @PropertyLayout(fieldSetId = "content", sequence = "1")
     public Blob getAttachment() {
         return BlobJpaEmbeddable.toBlob(attachment);
diff --git a/webapp/pom.xml b/webapp/pom.xml
index 5d1d581..9e67d66 100644
--- a/webapp/pom.xml
+++ b/webapp/pom.xml
@@ -187,6 +187,11 @@
             <artifactId>causeway-extensions-executionoutbox-persistence-jpa</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.apache.causeway.viewer</groupId>
+            <artifactId>causeway-viewer-graphql-viewer</artifactId>
+        </dependency>
+
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-actuator-autoconfigure</artifactId>
diff --git a/webapp/src/main/java/domainapp/webapp/AppManifest.java b/webapp/src/main/java/domainapp/webapp/AppManifest.java
index 21f3ffb..4f84e33 100644
--- a/webapp/src/main/java/domainapp/webapp/AppManifest.java
+++ b/webapp/src/main/java/domainapp/webapp/AppManifest.java
@@ -3,6 +3,9 @@ package domainapp.webapp;
 import org.apache.causeway.extensions.fullcalendar.wkt.ui.viewer.CausewayModuleExtFullCalendarWicketUi;
 import org.apache.causeway.extensions.layoutloaders.github.CausewayModuleExtLayoutLoadersGithub;
 
+
+import org.apache.causeway.viewer.graphql.viewer.CausewayModuleViewerGraphqlViewer;
+
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Import;
 import org.springframework.context.annotation.PropertySource;
@@ -50,6 +53,8 @@ import domainapp.webapp.quartz.QuartzModule;
         CausewayModuleViewerRestfulObjectsJaxrsResteasy.class,
         CausewayModuleViewerWicketViewer.class,
 
+        CausewayModuleViewerGraphqlViewer.class,
+
         CausewayModuleTestingFixturesApplib.class,
         CausewayModuleTestingH2ConsoleUi.class,
 
@@ -75,6 +80,7 @@ import domainapp.webapp.quartz.QuartzModule;
         CustomModule.class,
         QuartzModule.class,
 
+
         // discoverable fixtures
         DomainAppDemo.class
 })
diff --git a/webapp/src/main/resources/application.yml b/webapp/src/main/resources/application.yml
index 95d04cf..d775be6 100644
--- a/webapp/src/main/resources/application.yml
+++ b/webapp/src/main/resources/application.yml
@@ -27,6 +27,7 @@ causeway:
     meta-model:
       introspector:
         lock-after-full-introspection: true
+        mode: full
       validator:
         allow-deprecated: false
         no-params-only: true
@@ -100,6 +101,15 @@ causeway:
         decoration:
           data-tables-net:
             options: "info: false, pagingType: 'numbers'"
+    graphql:
+      api-variant: query_with_mutations_non_spec_compliant
+      authentication:
+        fallback:
+          username: sven
+          roles:
+            - simple-superuser
+            - foo
+            - bar
 
   testing:
     fixtures:
@@ -133,6 +143,10 @@ spring:
 
   quartz:
     job-store-type: memory
+  graphql:
+    graphiql:
+      enabled: true
+      path: "/graphiql"
 
 management:
   endpoint:
diff --git a/webapp/src/main/resources/config/application.properties b/webapp/src/main/resources/config/application.properties
index 70a2bb2..eb02764 100644
--- a/webapp/src/main/resources/config/application.properties
+++ b/webapp/src/main/resources/config/application.properties
@@ -44,3 +44,7 @@ decorator.datasource.p6spy.multiline=true
 
 # Use logging for default listeners [slf4j, sysout, file, custom]
 decorator.datasource.p6spy.logging=sysout
+
+
+#logging.level.org.springframework=DEBUG
+#logging.level.graphql=DEBUG
diff --git a/webapp/src/main/resources/static/index.html b/webapp/src/main/resources/static/index.html
index 3c4cb6d..c9c413d 100644
--- a/webapp/src/main/resources/static/index.html
+++ b/webapp/src/main/resources/static/index.html
@@ -27,6 +27,16 @@
                         viewer is built with <a href="http://wicket.apache.org" target="_blank">Apache Wicket</a>&trade;.
                     </p>
                 </li>
+                <li>
+                    <p>
+                        <b>
+                            <a href="graphiql">GraphQL</a>
+                        </b>
+                    </p>
+                    <p>
+                        provides access to the GraphQL API using the <a href="https://github.com/graphql/graphiql">GraphiQL</a> console.
+                    </p>
+                </li>
                 <li>
                     <p>
                         <b>