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 2021/09/30 05:10:17 UTC
[isis] branch master updated: ISIS-2875 ArchitectureJdoRules should
only check root entities which have identityType defined in their
@PersistenceCapable annotation and not subclasses of that entity!
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 dada0aa ISIS-2875 ArchitectureJdoRules should only check root entities which have identityType defined in their @PersistenceCapable annotation and not subclasses of that entity!
new 95afed8 Merge pull request #745 from opencirclesolutions/ISIS-2875
dada0aa is described below
commit dada0aa2884908262f8e929040c59ffeffd882be
Author: ppjdeenen <19D11y6azInOBZPYNSoW>
AuthorDate: Wed Sep 29 17:46:23 2021 +0200
ISIS-2875 ArchitectureJdoRules should only check root entities which have identityType defined in their @PersistenceCapable annotation and not subclasses of that entity!
---
.../archtestsupport/applib/classrules/ArchitectureJdoRules.java | 6 ++++++
.../testing/archtestsupport/applib/entity/jdo/dom/JdoEntity2.java | 7 +++----
.../archtestsupport/applib/entity/jdo/dom/JdoEntitySubtype.java | 3 ++-
3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/testing/archtestsupport/applib/src/main/java/org/apache/isis/testing/archtestsupport/applib/classrules/ArchitectureJdoRules.java b/testing/archtestsupport/applib/src/main/java/org/apache/isis/testing/archtestsupport/applib/classrules/ArchitectureJdoRules.java
index bde6633..94e673e 100644
--- a/testing/archtestsupport/applib/src/main/java/org/apache/isis/testing/archtestsupport/applib/classrules/ArchitectureJdoRules.java
+++ b/testing/archtestsupport/applib/src/main/java/org/apache/isis/testing/archtestsupport/applib/classrules/ArchitectureJdoRules.java
@@ -170,10 +170,16 @@ public class ArchitectureJdoRules {
* This is so that entities will have an alternative business key in addition to the system-defined surrogate
* key.
* </p>
+ *
+ * <p>
+ * The rule does <i>not</i> apply to any entities that are subtype entities where there
+ * is a supertype entity.
+ * </p>
*/
public static ArchRule every_jdo_PersistenceCapable_with_DATASTORE_identityType_must_be_annotated_as_DataStoreIdentity() {
return classes()
.that().areAnnotatedWith(PersistenceCapable_with_DATASTORE_identityType())
+ .and(not(areSubtypeEntities()))
.should().beAnnotatedWith(javax.jdo.annotations.DatastoreIdentity.class);
}
diff --git a/testing/archtestsupport/applib/src/test/java/org/apache/isis/testing/archtestsupport/applib/entity/jdo/dom/JdoEntity2.java b/testing/archtestsupport/applib/src/test/java/org/apache/isis/testing/archtestsupport/applib/entity/jdo/dom/JdoEntity2.java
index 9b54191..ef13a13 100644
--- a/testing/archtestsupport/applib/src/test/java/org/apache/isis/testing/archtestsupport/applib/entity/jdo/dom/JdoEntity2.java
+++ b/testing/archtestsupport/applib/src/test/java/org/apache/isis/testing/archtestsupport/applib/entity/jdo/dom/JdoEntity2.java
@@ -20,16 +20,15 @@ package org.apache.isis.testing.archtestsupport.applib.entity.jdo.dom;
import java.util.Comparator;
-import javax.jdo.annotations.PersistenceCapable;
-import javax.jdo.annotations.Unique;
-import javax.jdo.annotations.Version;
+import javax.jdo.annotations.*;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.apache.isis.applib.annotation.DomainObject;
import org.apache.isis.applib.annotation.Nature;
import org.apache.isis.applib.jaxb.PersistentEntityAdapter;
-@PersistenceCapable(schema = "jdo")
+@PersistenceCapable(schema = "jdo", identityType = IdentityType.DATASTORE)
+@DatastoreIdentity
@Unique(name = "name", members = {"name"})
@Version
@DomainObject(nature = Nature.ENTITY)
diff --git a/testing/archtestsupport/applib/src/test/java/org/apache/isis/testing/archtestsupport/applib/entity/jdo/dom/JdoEntitySubtype.java b/testing/archtestsupport/applib/src/test/java/org/apache/isis/testing/archtestsupport/applib/entity/jdo/dom/JdoEntitySubtype.java
index 6dc13d3..f324404 100644
--- a/testing/archtestsupport/applib/src/test/java/org/apache/isis/testing/archtestsupport/applib/entity/jdo/dom/JdoEntitySubtype.java
+++ b/testing/archtestsupport/applib/src/test/java/org/apache/isis/testing/archtestsupport/applib/entity/jdo/dom/JdoEntitySubtype.java
@@ -18,6 +18,7 @@
*/
package org.apache.isis.testing.archtestsupport.applib.entity.jdo.dom;
+import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
@@ -25,7 +26,7 @@ import org.apache.isis.applib.annotation.DomainObject;
import org.apache.isis.applib.annotation.Nature;
import org.apache.isis.applib.jaxb.PersistentEntityAdapter;
-@PersistenceCapable(schema = "jdo")
+@PersistenceCapable(schema = "jdo", identityType = IdentityType.DATASTORE)
@DomainObject(nature = Nature.ENTITY)
@XmlJavaTypeAdapter(PersistentEntityAdapter.class)
public class JdoEntitySubtype extends JdoEntity2<JdoEntitySubtype> {