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/04/15 14:06:38 UTC

[isis] branch master updated: ISIS-3010: extensions: enable DN enhancer JPA annot. processing

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 d9a6964394 ISIS-3010: extensions: enable DN enhancer JPA annot. processing
d9a6964394 is described below

commit d9a6964394182a294845983ca95ae36b7ce31b17
Author: andi-huber <ah...@apache.org>
AuthorDate: Fri Apr 15 16:06:30 2022 +0200

    ISIS-3010: extensions: enable DN enhancer JPA annot. processing
    
    - only kicks in when ${basedir}/logging-dn-enhance.properties exists
    
    - DN enhance must not run when entities are meant to be managed by
    EclipseLink instead
---
 bom/pom.xml                                                 |  3 ++-
 core/pom.xml                                                | 10 ++++++++++
 extensions/pom.xml                                          |  7 ++++++-
 .../JdoPersistenceCapableFacetFactory.java                  | 13 ++++++++-----
 starters/pom.xml                                            |  2 +-
 5 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/bom/pom.xml b/bom/pom.xml
index 45e853c655..d18368d0b7 100644
--- a/bom/pom.xml
+++ b/bom/pom.xml
@@ -75,7 +75,7 @@ under the License.
 	<name>Apache Isis</name>
 	<description>
 		Apache Isis Bill of Material (BOM).
-		Also the parent POM for the core framework, extensions and starter apps.
+		Also the parent POM for the core framework and extensions.
 	</description>
 
     <url>https://isis.apache.org</url>
@@ -364,6 +364,7 @@ under the License.
 		<danhaywood-java-testsupport.version>1.0.0</danhaywood-java-testsupport.version>
 
 		<datanucleus-api-jdo.version>6.0.0-m4</datanucleus-api-jdo.version>
+		<datanucleus-api-jpa.version>6.0.0-m4</datanucleus-api-jpa.version>
 		<datanucleus-core.version>6.0.0-m4</datanucleus-core.version>
 		<datanucleus-jdo-api.version>3.2.0-release</datanucleus-jdo-api.version>
 		<datanucleus-jdo-query.version>6.0.0-m1</datanucleus-jdo-query.version>
diff --git a/core/pom.xml b/core/pom.xml
index c24b149e13..44acfcb5be 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -1053,6 +1053,11 @@
 				<artifactId>datanucleus-api-jdo</artifactId>
 				<version>${datanucleus-api-jdo.version}</version>
 			</dependency>
+			<dependency>
+				<groupId>org.datanucleus</groupId>
+				<artifactId>datanucleus-api-jpa</artifactId>
+				<version>${datanucleus-api-jpa.version}</version>
+			</dependency>
 			<dependency>
 				<groupId>org.datanucleus</groupId>
 				<artifactId>datanucleus-core</artifactId>
@@ -1544,6 +1549,11 @@
 								<artifactId>datanucleus-api-jdo</artifactId>
 								<version>${datanucleus-api-jdo.version}</version>
 							</dependency>
+							<dependency>
+								<groupId>org.datanucleus</groupId>
+								<artifactId>datanucleus-api-jpa</artifactId>
+								<version>${datanucleus-api-jpa.version}</version>
+							</dependency>
 							<dependency>
 								<groupId>org.datanucleus</groupId>
 								<artifactId>datanucleus-jodatime</artifactId>
diff --git a/extensions/pom.xml b/extensions/pom.xml
index 422a95c966..40c1a3bae9 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -261,7 +261,7 @@
 
 	<profiles>
 		<profile>
-			<id>isis-app-starter-datanucleusenhance</id>
+			<id>isis-extensions-datanucleusenhance</id>
 			<activation>
 				<file>
 					<exists>${basedir}/logging-dn-enhance.properties</exists>
@@ -313,6 +313,11 @@
 								<artifactId>datanucleus-api-jdo</artifactId>
 								<version>${datanucleus-api-jdo.version}</version>
 							</dependency>
+							<dependency>
+								<groupId>org.datanucleus</groupId>
+								<artifactId>datanucleus-api-jpa</artifactId>
+								<version>${datanucleus-api-jpa.version}</version>
+							</dependency>
 							<dependency>
 								<groupId>org.datanucleus</groupId>
 								<artifactId>datanucleus-jodatime</artifactId>
diff --git a/persistence/jdo/metamodel/src/main/java/org/apache/isis/persistence/jdo/metamodel/facets/object/persistencecapable/JdoPersistenceCapableFacetFactory.java b/persistence/jdo/metamodel/src/main/java/org/apache/isis/persistence/jdo/metamodel/facets/object/persistencecapable/JdoPersistenceCapableFacetFactory.java
index 727721124d..e3904db5ff 100644
--- a/persistence/jdo/metamodel/src/main/java/org/apache/isis/persistence/jdo/metamodel/facets/object/persistencecapable/JdoPersistenceCapableFacetFactory.java
+++ b/persistence/jdo/metamodel/src/main/java/org/apache/isis/persistence/jdo/metamodel/facets/object/persistencecapable/JdoPersistenceCapableFacetFactory.java
@@ -55,6 +55,14 @@ implements ObjectTypeFacetFactory {
 
     @Override
     public void process(final ObjectTypeFacetFactory.ProcessObjectTypeContext processClassContext) {
+
+        val cls = processClassContext.getCls();
+
+        // only applies to JDO entities; ignore non enhanced classes
+        if(!jdoFacetContext.isPersistenceEnhanced(cls)) {
+            return;
+        }
+
         if(!processJdoAnnotations(processClassContext)) {
             processJpaAnnotations(processClassContext);
         }
@@ -65,11 +73,6 @@ implements ObjectTypeFacetFactory {
     private boolean processJdoAnnotations(final ProcessObjectTypeContext processClassContext) {
         val cls = processClassContext.getCls();
 
-        // only applies to JDO entities; ignore any view models
-        if(!jdoFacetContext.isPersistenceEnhanced(cls)) {
-            return false;
-        }
-
         val persistenceCapableIfAny = processClassContext.synthesizeOnType(PersistenceCapable.class);
         if (!persistenceCapableIfAny.isPresent()) {
             return false;
diff --git a/starters/pom.xml b/starters/pom.xml
index 2ae7a21489..fb58e60d9b 100644
--- a/starters/pom.xml
+++ b/starters/pom.xml
@@ -143,6 +143,7 @@
 
 				<!-- keep in sync with versions used in Apache Isis -->
 				<datanucleus-api-jdo.version>6.0.0-m4</datanucleus-api-jdo.version>
+				<datanucleus-api-jpa.version>6.0.0-m4</datanucleus-api-jpa.version>
 				<datanucleus-core.version>6.0.0-m4</datanucleus-core.version>
 				<datanucleus-jodatime.version>6.0.0-m4</datanucleus-jodatime.version>
 				<datanucleus-maven-plugin.version>6.0.0-m1</datanucleus-maven-plugin.version>
@@ -150,7 +151,6 @@
 				<datanucleus-maven-plugin.log4jConfiguration>${basedir}/logging-dn-enhance.properties</datanucleus-maven-plugin.log4jConfiguration>
 				<datanucleus-maven-plugin.verbose>true</datanucleus-maven-plugin.verbose>
 				<datanucleus-maven-plugin.fork>false</datanucleus-maven-plugin.fork>
-
 			</properties>
 			<build>
 				<plugins>