You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2022/08/17 06:49:09 UTC

[isis] branch master updated: ISIS-3123: templates: support jdo/jpa/jaxb type support notices

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

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new 96bbf424de ISIS-3123: templates: support jdo/jpa/jaxb type support notices
96bbf424de is described below

commit 96bbf424deef048ff650133d3b51783bb073e398
Author: andi-huber <ah...@apache.org>
AuthorDate: Wed Aug 17 08:48:59 2022 +0200

    ISIS-3123: templates: support jdo/jpa/jaxb type support notices
---
 .../javalang/longs/jdo/WrapperLongJdo-description.adoc    |  2 +-
 .../javalang/longs/jpa/WrapperLongJpa-description.adoc    | 13 ++++---------
 .../dom/types/javalang/longs/jpa/WrapperLongJpa.java      |  2 +-
 .../javalang/longs/vm/WrapperLongVm-description.adoc      |  2 +-
 .../javautil/uuids/jpa/JavaUtilUuidJpa-description.adoc   | 13 ++++---------
 .../dom/types/javautil/uuids/jpa/JavaUtilUuidJpa.java     |  2 +-
 .../demoshowcases/value/ValueTypeGenTemplate.java         | 14 ++++++++++++++
 .../src/main/resources/jdo/$TemplateJdo-description.adoc  |  2 +-
 .../src/main/resources/jpa/$TemplateJpa-description.adoc  | 13 ++++---------
 tooling/metaprog/src/main/resources/jpa/$TemplateJpa.java |  2 +-
 .../src/main/resources/vm/$TemplateVm-description.adoc    |  2 +-
 .../demoshowcases/value/ValueTypeGenTemplateTest.java     | 15 +++++++++++++--
 12 files changed, 46 insertions(+), 36 deletions(-)

diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/jdo/WrapperLongJdo-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/jdo/WrapperLongJdo-description.adoc
index 5ad32c4396..af8bac8bf7 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/jdo/WrapperLongJdo-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/jdo/WrapperLongJdo-description.adoc
@@ -2,7 +2,7 @@
 
 // // This file was GENERATED by the showcase generator (tooling). Do NOT edit!
 
-JDO supports `java.lang.Long` out-of-the-box, so no special annotations are required.
+JDO supports `java.lang.Long` out-of-the-box, so no special annotations are required. see link:https://www.datanucleus.org/products/accessplatform_6_0/jdo/mapping.html#_primitive_and_java_lang_types[DataNucleus]
 
 [source,java]
 ----
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/jpa/WrapperLongJpa-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/jpa/WrapperLongJpa-description.adoc
index de7d26a049..c4293ac726 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/jpa/WrapperLongJpa-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/jpa/WrapperLongJpa-description.adoc
@@ -2,24 +2,19 @@
 
 // // This file was GENERATED by the showcase generator (tooling). Do NOT edit!
 
-[WARNING]
-==== 
-TODO this yet is just a copy from JDO
-====
-
-JDO supports `java.lang.Long` out-of-the-box, so no special annotations are required.
+JDO supports `java.lang.Long` out-of-the-box, so no special annotations are required. see link:https://www.objectdb.com/java/jpa/entity/types#simple_java_data_types[ObjectDB]
 
 [source,java]
 ----
 include::WrapperLongJpa.java[tags=class]
 ----
-<.> a no-arg constructor is introduced by JDO enhancer
-<.> required property as defined to JDO/DataNucleus.
+<.> a no-arg constructor for convenience
+<.> required property as defined to JPA.
 +
 Apache Isis assumes properties are mandatory, so no additional annotation is required.
 <.> directly editable property as defined to Apache Isis
 <.> optional property as defined to Apache Isis
-<.> optional property as defined to JDO/DataNucleus
+<.> optional property as defined to JPA
 
 
 include::../WrapperLongs-common.adoc[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/jpa/WrapperLongJpa.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/jpa/WrapperLongJpa.java
index 0e4c136a5a..412e57e785 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/jpa/WrapperLongJpa.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/jpa/WrapperLongJpa.java
@@ -53,7 +53,7 @@ import demoapp.dom.types.javalang.longs.persistence.WrapperLongEntity;
 @EntityListeners(IsisEntityListener.class)
 @Named("demo.WrapperLongEntity")
 @DomainObject
-@NoArgsConstructor
+@NoArgsConstructor                                                             // <.>
 public class WrapperLongJpa
         extends WrapperLongEntity {
 
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/vm/WrapperLongVm-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/vm/WrapperLongVm-description.adoc
index dcd8f8d422..1e60801abb 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/vm/WrapperLongVm-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javalang/longs/vm/WrapperLongVm-description.adoc
@@ -2,7 +2,7 @@
 
 // // This file was GENERATED by the showcase generator (tooling). Do NOT edit!
 
-JAXB supports `java.lang.Long` out-of-the-box, so no special annotations are required.
+JAXB supports `java.lang.Long` out-of-the-box, so no special annotations are required. see link:https://docs.oracle.com/cd/E12840_01/wls/docs103/webserv/data_types.html#wp223908[Oracle]
 
 [source,java]
 ----
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javautil/uuids/jpa/JavaUtilUuidJpa-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/types/javautil/uuids/jpa/JavaUtilUuidJpa-description.adoc
index b644f2d411..ee56c0f147 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javautil/uuids/jpa/JavaUtilUuidJpa-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javautil/uuids/jpa/JavaUtilUuidJpa-description.adoc
@@ -2,24 +2,19 @@
 
 // // This file was GENERATED by the showcase generator (tooling). Do NOT edit!
 
-[WARNING]
-==== 
-TODO this yet is just a copy from JDO
-====
-
-JDO supports `java.util.UUID` out-of-the-box, so no special annotations are required.
+JPA supports `java.util.UUID` out-of-the-box, so no special annotations are required.
 
 [source,java]
 ----
 include::JavaUtilUuidJpa.java[tags=class]
 ----
-<.> a no-arg constructor is introduced by JDO enhancer
-<.> required property as defined to JDO/DataNucleus.
+<.> a no-arg constructor for convenience
+<.> required property as defined to JPA.
 +
 Apache Isis assumes properties are mandatory, so no additional annotation is required.
 <.> directly editable property as defined to Apache Isis
 <.> optional property as defined to Apache Isis
-<.> optional property as defined to JDO/DataNucleus
+<.> optional property as defined to JPA
 
 
 include::../JavaUtilUuids-common.adoc[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/types/javautil/uuids/jpa/JavaUtilUuidJpa.java b/examples/demo/domain/src/main/java/demoapp/dom/types/javautil/uuids/jpa/JavaUtilUuidJpa.java
index 1a7c8194d9..3659229ee2 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/types/javautil/uuids/jpa/JavaUtilUuidJpa.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/types/javautil/uuids/jpa/JavaUtilUuidJpa.java
@@ -53,7 +53,7 @@ import demoapp.dom.types.javautil.uuids.persistence.JavaUtilUuidEntity;
 @EntityListeners(IsisEntityListener.class)
 @Named("demo.JavaUtilUuidEntity")
 @DomainObject
-@NoArgsConstructor
+@NoArgsConstructor                                                             // <.>
 public class JavaUtilUuidJpa
         extends JavaUtilUuidEntity {
 
diff --git a/tooling/metaprog/src/main/java/org/apache/isis/tooling/metaprog/demoshowcases/value/ValueTypeGenTemplate.java b/tooling/metaprog/src/main/java/org/apache/isis/tooling/metaprog/demoshowcases/value/ValueTypeGenTemplate.java
index 024e7b4767..373bfe947a 100644
--- a/tooling/metaprog/src/main/java/org/apache/isis/tooling/metaprog/demoshowcases/value/ValueTypeGenTemplate.java
+++ b/tooling/metaprog/src/main/java/org/apache/isis/tooling/metaprog/demoshowcases/value/ValueTypeGenTemplate.java
@@ -45,6 +45,15 @@ public class ValueTypeGenTemplate {
         final String showcaseName;
         final String showcaseValueType;
         final String showcaseValueSemantics;
+        @Builder.Default
+        final String jdoTypeSupportNotice =
+            "JDO supports `#{showcase-type}` out-of-the-box, so no special annotations are required.";
+        @Builder.Default
+        final String jpaTypeSupportNotice =
+            "JPA supports `#{showcase-type}` out-of-the-box, so no special annotations are required.";
+        @Builder.Default
+        final String jaxbTypeSupportNotice =
+            "JAXB supports `#{showcase-type}` out-of-the-box, so no special annotations are required.";
         final String javaPackage;
         @Builder.Default
         final String fileNamePlaceholderForShowcaseName = "$Template";
@@ -172,6 +181,11 @@ public class ValueTypeGenTemplate {
             templateVars.put("showcase-value-semantics-provider", config.showcaseValueSemantics);
             templateVars.put("generated-file-notice", source.generator.formatAsComment(config.generatedFileNotice));
 
+            templateVars.put("jdo-type-support-notice", config.jdoTypeSupportNotice);
+            templateVars.put("jpa-type-support-notice", config.jpaTypeSupportNotice);
+            templateVars.put("jaxb-type-support-notice", config.jaxbTypeSupportNotice);
+
+
             // allow for ADOC IDE tools, to properly resolve include statements,
             // that is referenced (template) files should exist
             if(source.generator.isDoc()) {
diff --git a/tooling/metaprog/src/main/resources/jdo/$TemplateJdo-description.adoc b/tooling/metaprog/src/main/resources/jdo/$TemplateJdo-description.adoc
index 42351b3e24..cae6190d57 100644
--- a/tooling/metaprog/src/main/resources/jdo/$TemplateJdo-description.adoc
+++ b/tooling/metaprog/src/main/resources/jdo/$TemplateJdo-description.adoc
@@ -2,7 +2,7 @@
 
 //#{generated-file-notice}
 
-JDO supports `#{showcase-type}` out-of-the-box, so no special annotations are required.
+#{jdo-type-support-notice}
 
 [source,java]
 ----
diff --git a/tooling/metaprog/src/main/resources/jpa/$TemplateJpa-description.adoc b/tooling/metaprog/src/main/resources/jpa/$TemplateJpa-description.adoc
index 0d4ce9d167..8af1ad50ad 100644
--- a/tooling/metaprog/src/main/resources/jpa/$TemplateJpa-description.adoc
+++ b/tooling/metaprog/src/main/resources/jpa/$TemplateJpa-description.adoc
@@ -2,24 +2,19 @@
 
 //#{generated-file-notice}
 
-[WARNING]
-==== 
-TODO this yet is just a copy from JDO
-====
-
-JDO supports `#{showcase-type}` out-of-the-box, so no special annotations are required.
+#{jpa-type-support-notice}
 
 [source,java]
 ----
 include::$TemplateJpa.java[tags=class]
 ----
-<.> a no-arg constructor is introduced by JDO enhancer
-<.> required property as defined to JDO/DataNucleus.
+<.> a no-arg constructor for convenience
+<.> required property as defined to JPA.
 +
 Apache Isis assumes properties are mandatory, so no additional annotation is required.
 <.> directly editable property as defined to Apache Isis
 <.> optional property as defined to Apache Isis
-<.> optional property as defined to JDO/DataNucleus
+<.> optional property as defined to JPA
 
 
 include::../$Templates-common.adoc[]
\ No newline at end of file
diff --git a/tooling/metaprog/src/main/resources/jpa/$TemplateJpa.java b/tooling/metaprog/src/main/resources/jpa/$TemplateJpa.java
index 9662565540..4483102e9e 100644
--- a/tooling/metaprog/src/main/resources/jpa/$TemplateJpa.java
+++ b/tooling/metaprog/src/main/resources/jpa/$TemplateJpa.java
@@ -53,7 +53,7 @@ import /*${showcase-java-package}*/.persistence./*${showcase-name}*/Entity;
 @EntityListeners(IsisEntityListener.class)
 @Named("demo./*${showcase-name}*/Entity")
 @DomainObject
-@NoArgsConstructor
+@NoArgsConstructor                                                             // <.>
 public class /*${showcase-name}*/Jpa
         extends /*${showcase-name}*/Entity {
 
diff --git a/tooling/metaprog/src/main/resources/vm/$TemplateVm-description.adoc b/tooling/metaprog/src/main/resources/vm/$TemplateVm-description.adoc
index 56a77909b8..f0658ab66f 100644
--- a/tooling/metaprog/src/main/resources/vm/$TemplateVm-description.adoc
+++ b/tooling/metaprog/src/main/resources/vm/$TemplateVm-description.adoc
@@ -2,7 +2,7 @@
 
 //#{generated-file-notice}
 
-JAXB supports `#{showcase-type}` out-of-the-box, so no special annotations are required.
+#{jaxb-type-support-notice}
 
 [source,java]
 ----
diff --git a/tooling/metaprog/src/test/java/org/apache/isis/tooling/metaprog/demoshowcases/value/ValueTypeGenTemplateTest.java b/tooling/metaprog/src/test/java/org/apache/isis/tooling/metaprog/demoshowcases/value/ValueTypeGenTemplateTest.java
index cbe5f33048..606d4ea70e 100644
--- a/tooling/metaprog/src/test/java/org/apache/isis/tooling/metaprog/demoshowcases/value/ValueTypeGenTemplateTest.java
+++ b/tooling/metaprog/src/test/java/org/apache/isis/tooling/metaprog/demoshowcases/value/ValueTypeGenTemplateTest.java
@@ -45,12 +45,20 @@ class ValueTypeGenTemplateTest {
     @Test //@Disabled("WIP")
     void testLong() throws IOException {
 
+        val defaults = Config.builder().build();
+
         val config = Config.builder()
                 .outputRootDir(outputDir("wlong"))
                 .showcaseName("WrapperLong")
                 .javaPackage("demoapp.dom.types.javalang.longs")
                 .showcaseValueType("java.lang.Long")
                 .showcaseValueSemantics("org.apache.isis.core.metamodel.valuesemantics.LongValueSemantics")
+                .jdoTypeSupportNotice(defaults.getJdoTypeSupportNotice()
+                        + " see link:https://www.datanucleus.org/products/accessplatform_6_0/jdo/mapping.html#_primitive_and_java_lang_types[DataNucleus]")
+                .jpaTypeSupportNotice(defaults.getJdoTypeSupportNotice()
+                        + " see link:https://www.objectdb.com/java/jpa/entity/types#simple_java_data_types[ObjectDB]")
+                .jaxbTypeSupportNotice(defaults.getJaxbTypeSupportNotice()
+                        + " see link:https://docs.oracle.com/cd/E12840_01/wls/docs103/webserv/data_types.html#wp223908[Oracle]")
                 .build();
 
         testShowcase(config);
@@ -83,12 +91,15 @@ class ValueTypeGenTemplateTest {
 
     }
 
+    static boolean PERSIST = false;
     static File outputRootDir;
 
     @BeforeAll
     static void setup() {
-        outputRootDir = _Files.tempDir("isis-tooling-showcases");
-                //new File("D:/tmp");
+        outputRootDir = PERSIST
+                ? new File("D:/tmp")
+                : _Files.tempDir("isis-tooling-showcases");
+
         log.info("tmp dir created in {}", outputRootDir);
     }