You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2026/09/26 15:04:11 UTC
(cayenne) branch master updated (c0cb4fb38 -> a261a675c)
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git
from c0cb4fb38 CAY-3034 Remove "cayenne-osgi" module
new daa401a03 cleanup
new a261a675c CAY-3035 Remove "cayenne-lifecycle" module
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
CLAUDE.md | 2 +-
RELEASE-NOTES.txt | 1 +
UPGRADE.md | 26 +--
cayenne-assembly/pom.xml | 6 -
.../assemblies/generic/assembly-generic.xml | 1 -
.../main/resources/assemblies/mac/assembly-mac.xml | 1 -
.../assemblies/windows/assembly-windows.xml | 1 -
cayenne-lifecycle/README.txt | 12 --
cayenne-lifecycle/pom.xml | 73 -------
.../apache/cayenne/lifecycle/id/EntityIdCoder.java | 237 ---------------------
.../org/apache/cayenne/lifecycle/id/IdCoder.java | 93 --------
.../cayenne/lifecycle/id/StringIdFetcher.java | 106 ---------
.../lifecycle/relationship/ObjectIdBatchFault.java | 69 ------
.../relationship/ObjectIdBatchSourceItem.java | 46 ----
.../lifecycle/relationship/ObjectIdFault.java | 41 ----
.../ObjectIdPropagatedValueFactory.java | 42 ----
.../relationship/ObjectIdRelationship.java | 48 -----
.../ObjectIdRelationshipBatchFaultingStrategy.java | 100 ---------
.../ObjectIdRelationshipFaultingStrategy.java | 33 ---
.../relationship/ObjectIdRelationshipFilter.java | 74 -------
.../relationship/ObjectIdRelationshipHandler.java | 98 ---------
.../java/org/apache/cayenne/lifecycle/db/E1.java | 24 ---
.../java/org/apache/cayenne/lifecycle/db/E2.java | 24 ---
.../java/org/apache/cayenne/lifecycle/db/E3.java | 25 ---
.../java/org/apache/cayenne/lifecycle/db/E4.java | 25 ---
.../org/apache/cayenne/lifecycle/db/SortDep.java | 24 ---
.../org/apache/cayenne/lifecycle/db/SortRoot.java | 24 ---
.../org/apache/cayenne/lifecycle/db/UuidRoot1.java | 26 ---
.../org/apache/cayenne/lifecycle/db/auto/_E1.java | 16 --
.../org/apache/cayenne/lifecycle/db/auto/_E2.java | 16 --
.../org/apache/cayenne/lifecycle/db/auto/_E3.java | 34 ---
.../org/apache/cayenne/lifecycle/db/auto/_E4.java | 34 ---
.../apache/cayenne/lifecycle/db/auto/_SortDep.java | 29 ---
.../cayenne/lifecycle/db/auto/_SortRoot.java | 34 ---
.../cayenne/lifecycle/db/auto/_UuidRoot1.java | 26 ---
.../cayenne/lifecycle/id/EntityIdCoderIT.java | 217 -------------------
.../org/apache/cayenne/lifecycle/id/IdCoderIT.java | 112 ----------
.../cayenne/lifecycle/id/StringIdFetcherIT.java | 128 -----------
.../ObjectIdRelationshipHandlerIT.java | 163 --------------
.../src/test/resources/cayenne-lifecycle.xml | 5 -
.../src/test/resources/lifecycle-map.map.xml | 65 ------
.../compatibility/DefaultDocumentProvider.java | 6 +-
.../CompatibilityDataChannelDescriptorLoader.java | 21 +-
.../commitlog/unit/AuditableRuntimeCase.java | 2 +-
pom.xml | 1 -
45 files changed, 22 insertions(+), 2169 deletions(-)
delete mode 100644 cayenne-lifecycle/README.txt
delete mode 100644 cayenne-lifecycle/pom.xml
delete mode 100644 cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/id/EntityIdCoder.java
delete mode 100644 cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/id/IdCoder.java
delete mode 100644 cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/id/StringIdFetcher.java
delete mode 100644 cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdBatchFault.java
delete mode 100644 cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdBatchSourceItem.java
delete mode 100644 cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdFault.java
delete mode 100644 cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdPropagatedValueFactory.java
delete mode 100644 cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdRelationship.java
delete mode 100644 cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdRelationshipBatchFaultingStrategy.java
delete mode 100644 cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdRelationshipFaultingStrategy.java
delete mode 100644 cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdRelationshipFilter.java
delete mode 100644 cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdRelationshipHandler.java
delete mode 100644 cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/E1.java
delete mode 100644 cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/E2.java
delete mode 100644 cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/E3.java
delete mode 100644 cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/E4.java
delete mode 100644 cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/SortDep.java
delete mode 100644 cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/SortRoot.java
delete mode 100644 cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/UuidRoot1.java
delete mode 100644 cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_E1.java
delete mode 100644 cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_E2.java
delete mode 100644 cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_E3.java
delete mode 100644 cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_E4.java
delete mode 100644 cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_SortDep.java
delete mode 100644 cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_SortRoot.java
delete mode 100644 cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_UuidRoot1.java
delete mode 100644 cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/id/EntityIdCoderIT.java
delete mode 100644 cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/id/IdCoderIT.java
delete mode 100644 cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/id/StringIdFetcherIT.java
delete mode 100644 cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/relationship/ObjectIdRelationshipHandlerIT.java
delete mode 100644 cayenne-lifecycle/src/test/resources/cayenne-lifecycle.xml
delete mode 100644 cayenne-lifecycle/src/test/resources/lifecycle-map.map.xml
(cayenne) 02/02: CAY-3035 Remove "cayenne-lifecycle" module
Posted by aa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git
commit a261a675cffe3869b1f09ab346360fa094a6bb49
Author: Andrus Adamchik <an...@objectstyle.com>
AuthorDate: Sat Sep 26 11:02:54 2026 -0400
CAY-3035 Remove "cayenne-lifecycle" module
---
CLAUDE.md | 2 +-
RELEASE-NOTES.txt | 1 +
UPGRADE.md | 26 +--
cayenne-assembly/pom.xml | 6 -
.../assemblies/generic/assembly-generic.xml | 1 -
.../main/resources/assemblies/mac/assembly-mac.xml | 1 -
.../assemblies/windows/assembly-windows.xml | 1 -
cayenne-lifecycle/README.txt | 12 --
cayenne-lifecycle/pom.xml | 73 -------
.../apache/cayenne/lifecycle/id/EntityIdCoder.java | 237 ---------------------
.../org/apache/cayenne/lifecycle/id/IdCoder.java | 93 --------
.../cayenne/lifecycle/id/StringIdFetcher.java | 106 ---------
.../lifecycle/relationship/ObjectIdBatchFault.java | 69 ------
.../relationship/ObjectIdBatchSourceItem.java | 46 ----
.../lifecycle/relationship/ObjectIdFault.java | 41 ----
.../ObjectIdPropagatedValueFactory.java | 42 ----
.../relationship/ObjectIdRelationship.java | 48 -----
.../ObjectIdRelationshipBatchFaultingStrategy.java | 100 ---------
.../ObjectIdRelationshipFaultingStrategy.java | 33 ---
.../relationship/ObjectIdRelationshipFilter.java | 74 -------
.../relationship/ObjectIdRelationshipHandler.java | 98 ---------
.../java/org/apache/cayenne/lifecycle/db/E1.java | 24 ---
.../java/org/apache/cayenne/lifecycle/db/E2.java | 24 ---
.../java/org/apache/cayenne/lifecycle/db/E3.java | 25 ---
.../java/org/apache/cayenne/lifecycle/db/E4.java | 25 ---
.../org/apache/cayenne/lifecycle/db/SortDep.java | 24 ---
.../org/apache/cayenne/lifecycle/db/SortRoot.java | 24 ---
.../org/apache/cayenne/lifecycle/db/UuidRoot1.java | 26 ---
.../org/apache/cayenne/lifecycle/db/auto/_E1.java | 16 --
.../org/apache/cayenne/lifecycle/db/auto/_E2.java | 16 --
.../org/apache/cayenne/lifecycle/db/auto/_E3.java | 34 ---
.../org/apache/cayenne/lifecycle/db/auto/_E4.java | 34 ---
.../apache/cayenne/lifecycle/db/auto/_SortDep.java | 29 ---
.../cayenne/lifecycle/db/auto/_SortRoot.java | 34 ---
.../cayenne/lifecycle/db/auto/_UuidRoot1.java | 26 ---
.../cayenne/lifecycle/id/EntityIdCoderIT.java | 217 -------------------
.../org/apache/cayenne/lifecycle/id/IdCoderIT.java | 112 ----------
.../cayenne/lifecycle/id/StringIdFetcherIT.java | 128 -----------
.../ObjectIdRelationshipHandlerIT.java | 163 --------------
.../src/test/resources/cayenne-lifecycle.xml | 5 -
.../src/test/resources/lifecycle-map.map.xml | 65 ------
.../commitlog/unit/AuditableRuntimeCase.java | 2 +-
pom.xml | 1 -
43 files changed, 10 insertions(+), 2154 deletions(-)
diff --git a/CLAUDE.md b/CLAUDE.md
index cdbf63f64..2ad5c01dd 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -91,7 +91,7 @@ Why the `failIfNoSpecifiedTests=false` flags are needed when using `-am`: Surefi
- **cayenne-cgen** — Code generation from database schemas
- **cayenne-dbsync** — Database schema synchronization
- **cayenne-gradle-plugin**, **cayenne-maven-plugin**, **cayenne-ant** — Build tool integrations
-- **cayenne-crypto**, **cayenne-commitlog**, **cayenne-lifecycle**, **cayenne-jcache**, **cayenne-cache-invalidation** — Optional extension modules
+- **cayenne-crypto**, **cayenne-commitlog**, **cayenne-jcache**, **cayenne-cache-invalidation** — Optional extension modules
- **cayenne-modeler** — CayenneModeler GUI application (Swing)
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index f11975e87..155a19a62 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -36,6 +36,7 @@ CAY-3026 Parseable ObjectSelect / ColumnSelect
CAY-3027 Replace StringIdQuery with StringIdFetcher
CAY-3028 Im-memory evaluation of ASTSum
CAY-3034 Remove "cayenne-osgi" module
+CAY-3035 Remove "cayenne-lifecycle" module
Bug Fixes:
diff --git a/UPGRADE.md b/UPGRADE.md
index 2d35856ca..30626c685 100644
--- a/UPGRADE.md
+++ b/UPGRADE.md
@@ -269,25 +269,6 @@ List<Artist> withExpensivePaintings = ObjectSelect
`DataChannelQueryFilter` implementations now require a new signature.
-* Per [CAY-3027](https://issues.apache.org/jira/browse/CAY-3027) `org.apache.cayenne.lifecycle.id.StringIdQuery`
- was removed from `cayenne-lifecycle`. It was a pseudo-query that could only return `DataRow`s and needed
- `ObjectContext.execute(..)` to run. Its replacement is `org.apache.cayenne.lifecycle.id.StringIdFetcher`, a
- set of static methods that fetch persistent objects for one or more String IDs, possibly spanning multiple
- entities:
-
- ```java
- // before
- StringIdQuery query = new StringIdQuery("E1:3", "E1:4", "E2:6");
- List<QueryResult> response = context.execute(query);
- // ... convert DataRows to objects per entity
-
- // after
- Map<String, Persistent> objects = StringIdFetcher.fetch(context, "E1:3", "E1:4", "E2:6");
- Persistent e1 = StringIdFetcher.fetchOne(context, "E1:3");
- ```
-
- The map is keyed by the String IDs passed in, and IDs with no matching object are absent from it.
-
* Per [CAY-3032](https://issues.apache.org/jira/browse/CAY-3032) a `ColumnSelect` with an entity column over a
to-many relationship no longer filters out the root rows that have no related objects. It now uses an outer join,
same as the to-one entity columns always did, so such rows are returned with a `null` in place of the related
@@ -366,6 +347,13 @@ List<Artist> withExpensivePaintings = ObjectSelect
that provide an OSGi-aware `ClassLoaderManager` and a `Provider<DataDomain>` that swaps the thread context
ClassLoader while the `DataDomain` is created, bound via a `CayenneRuntime` module.
+* Per [CAY-3035](https://issues.apache.org/jira/browse/CAY-3035) the `cayenne-lifecycle` module was removed. It was
+ an opinionated way of encoding `ObjectId`s as Strings (`IdCoder`, `EntityIdCoder`, `StringIdFetcher`), with an
+ even more opinionated `@ObjectIdRelationship` annotation and `ObjectIdRelationshipFilter` on top of it to resolve
+ "virtual" relationships stored as such String IDs. There's no appetite to keep supporting this in Cayenne. The users
+ who still need it are welcome to grab the source code of `IdCoder` and friends from the Cayenne git history and
+ incorporate it in their projects.
+
## Upgrading to 5.0-M3
diff --git a/cayenne-assembly/pom.xml b/cayenne-assembly/pom.xml
index a3904fe40..e28936a24 100644
--- a/cayenne-assembly/pom.xml
+++ b/cayenne-assembly/pom.xml
@@ -64,12 +64,6 @@
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.cayenne</groupId>
- <artifactId>cayenne-lifecycle</artifactId>
- <version>${project.version}</version>
- </dependency>
-
<dependency>
<groupId>org.apache.cayenne</groupId>
<artifactId>cayenne-crypto</artifactId>
diff --git a/cayenne-assembly/src/main/resources/assemblies/generic/assembly-generic.xml b/cayenne-assembly/src/main/resources/assemblies/generic/assembly-generic.xml
index 3caa0f2ed..c0233f3a4 100644
--- a/cayenne-assembly/src/main/resources/assemblies/generic/assembly-generic.xml
+++ b/cayenne-assembly/src/main/resources/assemblies/generic/assembly-generic.xml
@@ -73,7 +73,6 @@
<include>org.apache.cayenne:cayenne-dbsync</include>
<include>org.apache.cayenne:cayenne-di</include>
<include>org.apache.cayenne:cayenne-jcache</include>
- <include>org.apache.cayenne:cayenne-lifecycle</include>
<include>org.apache.cayenne:cayenne-project</include>
<include>org.apache.cayenne:cayenne-project-compatibility</include>
<include>org.apache.cayenne:cayenne-velocity</include>
diff --git a/cayenne-assembly/src/main/resources/assemblies/mac/assembly-mac.xml b/cayenne-assembly/src/main/resources/assemblies/mac/assembly-mac.xml
index 229527719..8866804ef 100644
--- a/cayenne-assembly/src/main/resources/assemblies/mac/assembly-mac.xml
+++ b/cayenne-assembly/src/main/resources/assemblies/mac/assembly-mac.xml
@@ -80,7 +80,6 @@
<include>org.apache.cayenne:cayenne-dbsync</include>
<include>org.apache.cayenne:cayenne-di</include>
<include>org.apache.cayenne:cayenne-jcache</include>
- <include>org.apache.cayenne:cayenne-lifecycle</include>
<include>org.apache.cayenne:cayenne-project</include>
<include>org.apache.cayenne:cayenne-project-compatibility</include>
<include>org.apache.cayenne:cayenne-velocity</include>
diff --git a/cayenne-assembly/src/main/resources/assemblies/windows/assembly-windows.xml b/cayenne-assembly/src/main/resources/assemblies/windows/assembly-windows.xml
index 1335ab2ce..9ab45ec21 100644
--- a/cayenne-assembly/src/main/resources/assemblies/windows/assembly-windows.xml
+++ b/cayenne-assembly/src/main/resources/assemblies/windows/assembly-windows.xml
@@ -73,7 +73,6 @@
<include>org.apache.cayenne:cayenne-dbsync</include>
<include>org.apache.cayenne:cayenne-di</include>
<include>org.apache.cayenne:cayenne-jcache</include>
- <include>org.apache.cayenne:cayenne-lifecycle</include>
<include>org.apache.cayenne:cayenne-project</include>
<include>org.apache.cayenne:cayenne-project-compatibility</include>
<include>org.apache.cayenne:cayenne-velocity</include>
diff --git a/cayenne-lifecycle/README.txt b/cayenne-lifecycle/README.txt
deleted file mode 100644
index 6ba2a36b8..000000000
--- a/cayenne-lifecycle/README.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-TODO:
-
-1. A reverse of @MixinRelationship - injecting mixin records into objects annotated with some mixin annotation.
-2. Transactional auditable processing (with a mix of AuditableChild changes, multiple audit events are generated for the same object)
-
-IMPLEMENTED:
-
-5. @AuditableChild
-4. Changeset tracking functionality
-3. @MixinRelationship and MixinRelationshipFilter to batch-fault and inject related objects into mixin entity (e.g. Audit entity)
-2. @Auditable mixin with abstract handler allowing to store audit records in an arbitrary format.
-1. @Referenceable mixin and generic UUID processing classes
diff --git a/cayenne-lifecycle/pom.xml b/cayenne-lifecycle/pom.xml
deleted file mode 100644
index 366205b30..000000000
--- a/cayenne-lifecycle/pom.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- you under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of
- the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required
- by applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, either express or implied. See the License for the specific
- language governing permissions and limitations under the License. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>cayenne-parent</artifactId>
- <groupId>org.apache.cayenne</groupId>
- <version>5.0-SNAPSHOT</version>
- </parent>
- <artifactId>cayenne-lifecycle</artifactId>
- <name>cayenne-lifecycle: Cayenne Lifecycle Utilities</name>
- <packaging>jar</packaging>
- <dependencies>
-
- <!-- Compile dependencies -->
- <dependency>
- <groupId>org.apache.cayenne</groupId>
- <artifactId>cayenne</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!-- Test dependencies -->
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter</artifactId>
- <scope>test</scope>
- </dependency>
-<dependency>
- <groupId>org.apache.cayenne.build-tools</groupId>
- <artifactId>cayenne-test-utilities</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <!-- This ensures LICENSE and NOTICE inclusion in all jars -->
- <plugin>
- <artifactId>maven-remote-resources-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>process</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/id/EntityIdCoder.java b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/id/EntityIdCoder.java
deleted file mode 100644
index 4c4599ac5..000000000
--- a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/id/EntityIdCoder.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.lifecycle.id;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.SortedMap;
-import java.util.StringTokenizer;
-import java.util.TreeMap;
-
-import org.apache.cayenne.CayenneRuntimeException;
-import org.apache.cayenne.ObjectId;
-import org.apache.cayenne.dba.TypesMapping;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.map.ObjAttribute;
-import org.apache.cayenne.map.ObjEntity;
-import org.apache.cayenne.util.IDUtil;
-import org.apache.cayenne.util.Util;
-
-/**
- * An object to encode/decode ObjectIds for a single mapped entity.
- *
- * @since 3.1
- */
-public class EntityIdCoder {
-
- static final String ID_SEPARATOR = ":";
- static final String TEMP_ID_PREFIX = ".";
- private static final int TEMP_PREFIX_LENGTH = TEMP_ID_PREFIX.length();
-
- private String entityName;
- private SortedMap<String, Converter<?>> converters;
- private int idSize;
-
- public static String getEntityName(String id) {
- int separator = id.indexOf(ID_SEPARATOR);
- if (separator <= 0 || separator == id.length() - 1) {
- throw new IllegalArgumentException("Invalid String id: " + id);
- }
-
- String name = id.substring(0, separator);
-
- if (name.startsWith(TEMP_ID_PREFIX)) {
- name = name.substring(TEMP_PREFIX_LENGTH);
- }
-
- return name;
- }
-
- public EntityIdCoder(ObjEntity entity) {
-
- this.entityName = entity.getName();
- this.converters = new TreeMap<>();
-
- for (ObjAttribute attribute : entity.getAttributes()) {
- if (attribute.isPrimaryKey()) {
- converters.put(attribute.getDbAttributeName(), create(attribute.getJavaClass()));
- }
- }
-
- for (DbAttribute attribute : entity.getDbEntity().getPrimaryKeys()) {
- if (!converters.containsKey(attribute.getName())) {
- String type = TypesMapping.getJavaBySqlType(attribute);
- try {
- converters.put(attribute.getName(), create(Util.getJavaClass(type)));
- } catch (ClassNotFoundException e) {
- throw new CayenneRuntimeException("Can't instantiate class " + type, e);
- }
- }
- }
-
- if (converters.isEmpty()) {
- throw new IllegalArgumentException("Entity has no PK defined: " + entity.getName());
- }
-
- this.idSize = (int) Math.ceil(converters.size() / 0.75d);
- }
-
- /**
- * Returns a consistent String representation of the ObjectId
- */
- public String toStringId(ObjectId id) {
-
- // deal with temp that have attached replacement ID as permanent IDs...
- // AuditableFilter, etc. all rely on the ability to find the temp object
- // after the transaction end
-
- // TODO: support encoding format for temp+replacement
- if (id.isTemporary() && !id.isReplacementIdAttached()) {
- return toTempIdString(id);
- } else {
- return toPermIdString(id);
- }
- }
-
- private String toTempIdString(ObjectId id) {
- StringBuilder buffer = new StringBuilder();
-
- buffer.append(TEMP_ID_PREFIX);
-
- buffer.append(id.getEntityName());
-
- buffer.append(ID_SEPARATOR);
-
- for (byte b : id.getKey()) {
- IDUtil.appendFormattedByte(buffer, b);
- }
- return buffer.toString();
- }
-
- private String toPermIdString(ObjectId id) {
- StringBuilder buffer = new StringBuilder();
- buffer.append(id.getEntityName());
- Map<String, Object> idValues = id.getIdSnapshot();
-
- for (Entry<String, Converter<?>> entry : converters.entrySet()) {
- Object value = idValues.get(entry.getKey());
- buffer.append(ID_SEPARATOR).append(entry.getValue().toUuid(value));
- }
-
- return buffer.toString();
- }
-
- public ObjectId toObjectId(String stringId) {
-
- if (stringId.startsWith(TEMP_ID_PREFIX)) {
- String idValues = stringId.substring(entityName.length() + 1 + TEMP_PREFIX_LENGTH);
- return ObjectId.of(entityName, decodeTemp(idValues));
- }
-
- String idValues = stringId.substring(entityName.length() + 1);
-
- if (converters.size() == 1) {
- Entry<String, Converter<?>> entry = converters.entrySet().iterator().next();
-
- String decoded;
- try {
- decoded = URLDecoder.decode(idValues, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- // unexpected
- throw new CayenneRuntimeException("Unsupported encoding", e);
- }
- return ObjectId.of(entityName, entry.getKey(), entry.getValue().fromStringId(decoded));
- }
-
- Map<String, Object> idMap = new HashMap<>(idSize);
- StringTokenizer toks = new StringTokenizer(idValues, ID_SEPARATOR);
-
- if (toks.countTokens() != converters.size()) {
- throw new IllegalArgumentException("Invalid String ID for entity "
- + entityName + ": " + idValues);
- }
-
- for (Entry<String, Converter<?>> entry : converters.entrySet()) {
- String value = toks.nextToken();
-
- String decoded;
- try {
- decoded = URLDecoder.decode(value, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- // unexpected
- throw new CayenneRuntimeException("Unsupported encoding", e);
- }
-
- idMap.put(entry.getKey(), entry.getValue().fromStringId(decoded));
- }
-
- return ObjectId.of(entityName, idMap);
- }
-
- private byte[] decodeTemp(String byteString) {
-
- byte[] bytes = new byte[byteString.length() / 2];
- for (int i = 0; i < bytes.length; i++) {
- int index = i * 2;
-
- // this is better than Byte.parseByte which can't parse values >=
- // 128 as negative bytes
- int c1 = byteString.charAt(index);
- int c2 = byteString.charAt(index + 1);
- bytes[i] = (byte) ((Character.digit(c1, 16) << 4) + Character.digit(c2, 16));
- }
-
- return bytes;
- }
-
- private Converter<?> create(Class<?> type) {
-
- if (type == null) {
- throw new NullPointerException("Null type");
- }
-
- if (Long.class.isAssignableFrom(type)) {
- return Long::valueOf;
- } else if (Integer.class.isAssignableFrom(type)) {
- return Integer::valueOf;
- } else if (String.class.isAssignableFrom(type)) {
- return stringId -> stringId;
- }
-
- throw new IllegalArgumentException("Unsupported ID type: " + type.getName());
- }
-
- interface Converter<T> {
-
- default String toUuid(Object value) {
- try {
- return URLEncoder.encode(String.valueOf(value), "UTF-8");
- } catch (UnsupportedEncodingException e) {
- // unexpected
- throw new CayenneRuntimeException("Unsupported encoding", e);
- }
- }
-
- T fromStringId(String stringId);
- }
-}
diff --git a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/id/IdCoder.java b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/id/IdCoder.java
deleted file mode 100644
index 17ada69db..000000000
--- a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/id/IdCoder.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.lifecycle.id;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.cayenne.ObjectId;
-import org.apache.cayenne.Persistent;
-import org.apache.cayenne.map.EntityResolver;
-import org.apache.cayenne.map.ObjEntity;
-
-/**
- * An object to encode/decode ObjectIds for all entities found in a mapping
- * namespace.
- *
- * @since 3.1
- */
-public class IdCoder {
-
- protected EntityResolver entityResolver;
- protected Map<String, EntityIdCoder> coders;
-
- public IdCoder(EntityResolver entityResolver) {
- this.entityResolver = entityResolver;
- this.coders = new ConcurrentHashMap<>();
- }
-
- /**
- * Returns an ObjectId for a given String ID.
- */
- public ObjectId getObjectId(String id) {
-
- String entityName = EntityIdCoder.getEntityName(id);
- EntityIdCoder coder = getCoder(entityName);
- return coder.toObjectId(id);
- }
-
- /**
- * @since 4.0
- */
- public String getStringId(ObjectId id) {
- EntityIdCoder coder = getCoder(id.getEntityName());
- return coder.toStringId(id);
- }
-
- public String getStringId(Persistent object) {
-
- if (object == null) {
- throw new NullPointerException("Null object");
- }
-
- ObjectId id = object.getObjectId();
- return getStringId(id);
- }
-
- protected EntityIdCoder getCoder(String entityName) {
- EntityIdCoder coder = coders.get(entityName);
- if (coder == null) {
-
- coder = createCoder(entityName);
- coders.put(entityName, coder);
- }
-
- return coder;
- }
-
- protected EntityIdCoder createCoder(String entityName) {
- ObjEntity entity = entityResolver.getObjEntity(entityName);
- if (entity == null) {
- throw new IllegalArgumentException("Entity '" + entityName
- + "' is not mapped");
- }
-
- return new EntityIdCoder(entity);
- }
-}
diff --git a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/id/StringIdFetcher.java b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/id/StringIdFetcher.java
deleted file mode 100644
index 8f823d303..000000000
--- a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/id/StringIdFetcher.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.lifecycle.id;
-
-import org.apache.cayenne.ObjectContext;
-import org.apache.cayenne.ObjectId;
-import org.apache.cayenne.Persistent;
-import org.apache.cayenne.query.ObjectSelect;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-/**
- * Fetches objects by their String IDs (see {@link IdCoder}). The IDs do not have to belong to the same entity: a
- * single call may span multiple entities and DB tables, and results in one query per distinct entity.
- *
- * @since 5.0
- */
-public final class StringIdFetcher {
-
- private StringIdFetcher() {
- }
-
- /**
- * Returns an object matching the String ID, or null if no such object exists.
- */
- public static Persistent fetchOne(ObjectContext context, String stringId) {
- Objects.requireNonNull(stringId, "Null stringId");
- ObjectId id = new IdCoder(context.getEntityResolver()).getObjectId(stringId);
- return ObjectSelect.query(Persistent.class, id.getEntityName()).byId(id).selectOne(context);
- }
-
- /**
- * Returns a map of fetched objects keyed by their String IDs. IDs with no matching object are absent from
- * the map.
- */
- public static Map<String, Persistent> fetch(ObjectContext context, String... stringIds) {
- Objects.requireNonNull(stringIds, "Null stringIds");
- return fetch(context, Arrays.asList(stringIds));
- }
-
- /**
- * Returns a map of fetched objects keyed by their String IDs. IDs with no matching object are absent from
- * the map.
- */
- public static Map<String, Persistent> fetch(ObjectContext context, Collection<String> stringIds) {
- Objects.requireNonNull(stringIds, "Null stringIds");
-
- if (stringIds.isEmpty()) {
- return Map.of();
- }
-
- IdCoder coder = new IdCoder(context.getEntityResolver());
-
- // LinkedHashMap keeps entity groups in first-seen order, so the queries run in a predictable sequence
- Map<String, Map<ObjectId, String>> idsByEntity = new LinkedHashMap<>();
- for (String stringId : stringIds) {
- ObjectId id = coder.getObjectId(stringId);
- idsByEntity.computeIfAbsent(id.getEntityName(), n -> new HashMap<>()).put(id, stringId);
- }
-
- Map<String, Persistent> result = new HashMap<>();
- for (Map.Entry<String, Map<ObjectId, String>> entry : idsByEntity.entrySet()) {
- String entityName = entry.getKey();
- Map<ObjectId, String> ids = entry.getValue();
-
- List<Persistent> objects = ObjectSelect.query(Persistent.class, entityName)
- .byIds(ids.keySet())
- .select(context);
-
- for (Persistent object : objects) {
- ObjectId id = object.getObjectId();
- String stringId = ids.get(id);
- if (stringId == null) {
- // a fetched object may be an instance of a subentity, in which case its ObjectId is not among
- // the keys and must be looked up under the entity that was requested
- stringId = ids.get(ObjectId.of(entityName, id.getIdSnapshot()));
- }
- result.put(stringId, object);
- }
- }
-
- return result;
- }
-}
diff --git a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdBatchFault.java b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdBatchFault.java
deleted file mode 100644
index 778891973..000000000
--- a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdBatchFault.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.lifecycle.relationship;
-
-import org.apache.cayenne.ObjectContext;
-import org.apache.cayenne.Persistent;
-import org.apache.cayenne.lifecycle.id.StringIdFetcher;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Provides lazy faulting functionality for a map of objects identified by
- * String ObjectId.
- *
- * @since 3.1
- */
-class ObjectIdBatchFault {
-
- private final ObjectContext context;
- private final List<ObjectIdBatchSourceItem> sources;
- private volatile Map<String, Persistent> resolved;
-
- ObjectIdBatchFault(ObjectContext context, List<ObjectIdBatchSourceItem> sources) {
- this.context = context;
- this.sources = sources;
- }
-
- Map<String, Persistent> getObjects() {
-
- if (resolved == null) {
-
- synchronized (this) {
-
- if (resolved == null) {
- resolved = fetchObjects();
- }
- }
- }
-
- return resolved;
- }
-
- private Map<String, Persistent> fetchObjects() {
-
- if (sources == null) {
- return Map.of();
- }
-
- List<String> ids = sources.stream().map(ObjectIdBatchSourceItem::getId).toList();
- return StringIdFetcher.fetch(context, ids);
- }
-}
diff --git a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdBatchSourceItem.java b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdBatchSourceItem.java
deleted file mode 100644
index 56dba4269..000000000
--- a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdBatchSourceItem.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.lifecycle.relationship;
-
-import org.apache.cayenne.Persistent;
-
-final class ObjectIdBatchSourceItem {
-
- private final Persistent object;
- private final String id;
- private final String objectIdRelationship;
-
- ObjectIdBatchSourceItem(Persistent object, String id, String objectIdRelationship) {
- this.object = object;
- this.id = id;
- this.objectIdRelationship = objectIdRelationship;
- }
-
- Persistent getObject() {
- return object;
- }
-
- String getObjectIdRelationship() {
- return objectIdRelationship;
- }
-
- String getId() {
- return id;
- }
-}
diff --git a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdFault.java b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdFault.java
deleted file mode 100644
index 413b075f2..000000000
--- a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdFault.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.lifecycle.relationship;
-
-import org.apache.cayenne.Fault;
-import org.apache.cayenne.Persistent;
-
-/**
- * @since 3.1
- */
-class ObjectIdFault extends Fault {
-
- private String id;
- private ObjectIdBatchFault batchFault;
-
- ObjectIdFault(ObjectIdBatchFault batchFault, String id) {
- this.batchFault = batchFault;
- this.id = id;
- }
-
- @Override
- public Object resolveFault(Persistent sourceObject, String relationshipName) {
- return id != null ? batchFault.getObjects().get(id) : null;
- }
-}
diff --git a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdPropagatedValueFactory.java b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdPropagatedValueFactory.java
deleted file mode 100644
index d5066a09f..000000000
--- a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdPropagatedValueFactory.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.lifecycle.relationship;
-
-import org.apache.cayenne.Persistent;
-import org.apache.cayenne.access.DeferredValue;
-import org.apache.cayenne.lifecycle.id.IdCoder;
-
-/**
- * @since 3.1
- */
-class ObjectIdPropagatedValueFactory implements DeferredValue {
-
- private IdCoder referenceableHandler;
- private Persistent to;
-
- ObjectIdPropagatedValueFactory(IdCoder referenceableHandler, Persistent to) {
- this.referenceableHandler = referenceableHandler;
- this.to = to;
- }
-
- @Override
- public String get() {
- return referenceableHandler.getStringId(to);
- }
-}
diff --git a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdRelationship.java b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdRelationship.java
deleted file mode 100644
index 0e80658e8..000000000
--- a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdRelationship.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.lifecycle.relationship;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Defines a "virtual" read-only to-one relationship based on an FK that is a String
- * representation of Cayenne ObjectId. A target object of this relationship can be of any
- * entity type.
- *
- * @since 3.1
- */
-@Target({
- ElementType.TYPE
-})
-@Retention(RetentionPolicy.RUNTIME)
-@Documented
-@Inherited
-public @interface ObjectIdRelationship {
-
- /**
- * Returns the name of the property of the annotated entity that stores a String "FK"
- * of a related entity.
- */
- String value() default "";
-}
diff --git a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdRelationshipBatchFaultingStrategy.java b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdRelationshipBatchFaultingStrategy.java
deleted file mode 100644
index cbcdf3818..000000000
--- a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdRelationshipBatchFaultingStrategy.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.lifecycle.relationship;
-
-import org.apache.cayenne.Persistent;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A faulting strategy that does batch-faulting of related objects whenever a first
- * ObjectId relationship is accessed.
- *
- * @since 3.1
- */
-public class ObjectIdRelationshipBatchFaultingStrategy implements ObjectIdRelationshipFaultingStrategy {
-
- private ThreadLocal<List<ObjectIdBatchSourceItem>> batchSources;
-
- public ObjectIdRelationshipBatchFaultingStrategy() {
- this.batchSources = new ThreadLocal<>();
- }
-
- public void afterObjectLoaded(Persistent object) {
-
- String uuidProperty = objectIdPropertyName(object);
- String uuidRelationship = objectIdRelationshipName(uuidProperty);
- String uuid = (String) object.readProperty(uuidProperty);
- if (uuid == null) {
- object.writePropertyDirectly(uuidRelationship, null);
- }
- else {
- List<ObjectIdBatchSourceItem> sources = batchSources.get();
-
- if (sources == null) {
- sources = new ArrayList<>();
- batchSources.set(sources);
- }
-
- sources.add(new ObjectIdBatchSourceItem(object, uuid, uuidRelationship));
- }
- }
-
- public void afterQuery() {
-
- List<ObjectIdBatchSourceItem> sources = batchSources.get();
- if (sources != null) {
- batchSources.set(null);
-
- ObjectIdBatchFault batchFault = new ObjectIdBatchFault(sources
- .get(0)
- .getObject()
- .getObjectContext(), sources);
-
- for (ObjectIdBatchSourceItem source : sources) {
- source.getObject().writePropertyDirectly(
- source.getObjectIdRelationship(),
- new ObjectIdFault(batchFault, source.getId()));
- }
- }
- }
-
- String objectIdRelationshipName(String uuidPropertyName) {
- return "cay:related:" + uuidPropertyName;
- }
-
- String objectIdPropertyName(Persistent object) {
-
- ObjectIdRelationship annotation = object.getClass().getAnnotation(
- ObjectIdRelationship.class);
-
- if (annotation == null) {
- throw new IllegalArgumentException(
- "Object class is not annotated with @UuidRelationship: "
- + object.getClass().getName());
- }
-
- // TODO: I guess we'll need to cache this metadata for performance if we are to
- // support inheritance lookups, etc.
-
- return annotation.value();
- }
-
-}
diff --git a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdRelationshipFaultingStrategy.java b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdRelationshipFaultingStrategy.java
deleted file mode 100644
index f0d5333c6..000000000
--- a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdRelationshipFaultingStrategy.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.lifecycle.relationship;
-
-import org.apache.cayenne.Persistent;
-
-/**
- * An abstract strategy for resolving ObjectId relationships.
- *
- * @since 3.1
- */
-public interface ObjectIdRelationshipFaultingStrategy {
-
- void afterObjectLoaded(Persistent object);
-
- void afterQuery();
-}
diff --git a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdRelationshipFilter.java b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdRelationshipFilter.java
deleted file mode 100644
index d85bddff6..000000000
--- a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdRelationshipFilter.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.lifecycle.relationship;
-
-import org.apache.cayenne.DataChannelQueryFilter;
-import org.apache.cayenne.DataChannelQueryFilterChain;
-import org.apache.cayenne.ObjectContext;
-import org.apache.cayenne.Persistent;
-import org.apache.cayenne.QueryResult;
-import org.apache.cayenne.annotation.PostLoad;
-import org.apache.cayenne.annotation.PostPersist;
-import org.apache.cayenne.annotation.PostUpdate;
-import org.apache.cayenne.query.Query;
-
-import java.util.List;
-
-/**
- * A {@link DataChannelQueryFilter} that implements ObjectId relationships read functionality.
- *
- * @since 3.1
- */
-public class ObjectIdRelationshipFilter implements DataChannelQueryFilter {
-
- private final ObjectIdRelationshipFaultingStrategy faultingStrategy;
-
- public ObjectIdRelationshipFilter() {
- this.faultingStrategy = createFaultingStrategy();
- }
-
- protected ObjectIdRelationshipFaultingStrategy createFaultingStrategy() {
- return new ObjectIdRelationshipBatchFaultingStrategy();
- }
-
- public List<QueryResult> onQuery(ObjectContext context, Query query, boolean iteratedResult,
- DataChannelQueryFilterChain chain) {
- try {
- return chain.onQuery(context, query, iteratedResult);
- } finally {
- faultingStrategy.afterQuery();
- }
- }
-
- @PostUpdate(entityAnnotations = ObjectIdRelationship.class)
- @PostPersist(entityAnnotations = ObjectIdRelationship.class)
- void postCommit(Persistent object) {
- // invalidate after commit to ensure UUID property is re-read...
- object.getObjectContext().invalidateObjects(object);
- }
-
- /**
- * A lifecycle callback method that delegates object post load event processing to the
- * underlying faulting strategy.
- */
- @PostLoad(entityAnnotations = ObjectIdRelationship.class)
- void postLoad(Persistent object) {
- faultingStrategy.afterObjectLoaded(object);
- }
-}
diff --git a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdRelationshipHandler.java b/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdRelationshipHandler.java
deleted file mode 100644
index 49ff1f5cb..000000000
--- a/cayenne-lifecycle/src/main/java/org/apache/cayenne/lifecycle/relationship/ObjectIdRelationshipHandler.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.lifecycle.relationship;
-
-import org.apache.cayenne.Persistent;
-import org.apache.cayenne.lifecycle.id.IdCoder;
-
-/**
- * @since 3.1
- */
-public class ObjectIdRelationshipHandler {
-
- protected IdCoder referenceableHandler;
-
- public ObjectIdRelationshipHandler(IdCoder referenceableHandler) {
- this.referenceableHandler = referenceableHandler;
- }
-
- public String objectIdRelationshipName(String uuidPropertyName) {
- return "cay:related:" + uuidPropertyName;
- }
-
- public String objectIdPropertyName(Persistent object) {
-
- ObjectIdRelationship annotation = object.getClass().getAnnotation(
- ObjectIdRelationship.class);
-
- if (annotation == null) {
- throw new IllegalArgumentException(
- "Object class is not annotated with @UuidRelationship: "
- + object.getClass().getName());
- }
-
- // TODO: I guess we'll need to cache this metadata for performance if we are to support inheritance lookups, etc.
- return annotation.value();
- }
-
- /**
- * Establishes an ObjectId relationship between two objects. Objects must be
- * registered in the same ObjectContext. "from" argument is the object annotated with
- * UuidRelationship. Second argument can optionally be null.
- */
- public void relate(Persistent from, Persistent to) {
-
- if (from.getObjectContext() == null) {
- throw new IllegalArgumentException("'from' has null ObjectContext");
- }
-
- String property = objectIdPropertyName(from);
- String relationship = objectIdRelationshipName(property);
-
- if (to != null) {
- if (to.getObjectContext() == null) {
- throw new IllegalArgumentException("'to' has null ObjectContext");
- }
-
- if (from.getObjectContext() != to.getObjectContext()) {
- throw new IllegalArgumentException(
- "'from' and 'to' objects are registered in different ObjectContexts");
- }
-
- from.writePropertyDirectly(relationship, to);
-
- if (to.getObjectId().isTemporary()
- && !to.getObjectId().isReplacementIdAttached()) {
-
- // defer ObjectId resolving till commit
- from.writeProperty(property, new ObjectIdPropagatedValueFactory(
- referenceableHandler,
- to));
- }
- else {
- String uuid = referenceableHandler.getStringId(to);
- from.writeProperty(property, uuid);
- }
- }
- else {
- from.writeProperty(property, null);
- from.writePropertyDirectly(relationship, null);
- }
- }
-}
diff --git a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/E1.java b/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/E1.java
deleted file mode 100644
index 5eb7835bb..000000000
--- a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/E1.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.lifecycle.db;
-
-import org.apache.cayenne.lifecycle.db.auto._E1;
-
-public class E1 extends _E1 {
-}
diff --git a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/E2.java b/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/E2.java
deleted file mode 100644
index 2c236fa3b..000000000
--- a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/E2.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.lifecycle.db;
-
-import org.apache.cayenne.lifecycle.db.auto._E2;
-
-public class E2 extends _E2 {
-}
diff --git a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/E3.java b/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/E3.java
deleted file mode 100644
index 2de5b82d5..000000000
--- a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/E3.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.lifecycle.db;
-
-import org.apache.cayenne.lifecycle.db.auto._E3;
-
-public class E3 extends _E3 {
-
-}
diff --git a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/E4.java b/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/E4.java
deleted file mode 100644
index 9d2600ee3..000000000
--- a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/E4.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.lifecycle.db;
-
-import org.apache.cayenne.lifecycle.db.auto._E4;
-
-public class E4 extends _E4 {
-
-}
diff --git a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/SortDep.java b/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/SortDep.java
deleted file mode 100644
index 212153dcb..000000000
--- a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/SortDep.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.lifecycle.db;
-
-import org.apache.cayenne.lifecycle.db.auto._SortDep;
-
-public class SortDep extends _SortDep {
-}
diff --git a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/SortRoot.java b/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/SortRoot.java
deleted file mode 100644
index a6fc23b35..000000000
--- a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/SortRoot.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.lifecycle.db;
-
-import org.apache.cayenne.lifecycle.db.auto._SortRoot;
-
-public class SortRoot extends _SortRoot {
-}
diff --git a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/UuidRoot1.java b/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/UuidRoot1.java
deleted file mode 100644
index fc291f8a2..000000000
--- a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/UuidRoot1.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.lifecycle.db;
-
-import org.apache.cayenne.lifecycle.db.auto._UuidRoot1;
-import org.apache.cayenne.lifecycle.relationship.ObjectIdRelationship;
-
-@ObjectIdRelationship("uuid")
-public class UuidRoot1 extends _UuidRoot1 {
-}
diff --git a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_E1.java b/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_E1.java
deleted file mode 100644
index abb281840..000000000
--- a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_E1.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.apache.cayenne.lifecycle.db.auto;
-
-import org.apache.cayenne.GenericPersistentObject;
-
-/**
- * Class _E1 was generated by Cayenne.
- * It is probably a good idea to avoid changing this class manually,
- * since it may be overwritten next time code is regenerated.
- * If you need to make any customizations, please use subclass.
- */
-public abstract class _E1 extends GenericPersistentObject {
-
- public static final String ID_PK_COLUMN = "ID";
-
-
-}
diff --git a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_E2.java b/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_E2.java
deleted file mode 100644
index 633850911..000000000
--- a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_E2.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.apache.cayenne.lifecycle.db.auto;
-
-import org.apache.cayenne.GenericPersistentObject;
-
-/**
- * Class _E2 was generated by Cayenne.
- * It is probably a good idea to avoid changing this class manually,
- * since it may be overwritten next time code is regenerated.
- * If you need to make any customizations, please use subclass.
- */
-public abstract class _E2 extends GenericPersistentObject {
-
- public static final String ID_PK_COLUMN = "ID";
-
-
-}
diff --git a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_E3.java b/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_E3.java
deleted file mode 100644
index f4279ad4c..000000000
--- a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_E3.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.apache.cayenne.lifecycle.db.auto;
-
-import java.util.List;
-
-import org.apache.cayenne.GenericPersistentObject;
-import org.apache.cayenne.exp.property.ListProperty;
-import org.apache.cayenne.exp.property.PropertyFactory;
-import org.apache.cayenne.lifecycle.db.E4;
-
-/**
- * Class _E3 was generated by Cayenne.
- * It is probably a good idea to avoid changing this class manually,
- * since it may be overwritten next time code is regenerated.
- * If you need to make any customizations, please use subclass.
- */
-public abstract class _E3 extends GenericPersistentObject {
-
- public static final String ID_PK_COLUMN = "ID";
-
- public static final ListProperty<E4> E4S = PropertyFactory.createList("e4s", E4.class);
-
- public void addToE4s(E4 obj) {
- addToManyTarget("e4s", obj, true);
- }
- public void removeFromE4s(E4 obj) {
- removeToManyTarget("e4s", obj, true);
- }
- @SuppressWarnings("unchecked")
- public List<E4> getE4s() {
- return (List<E4>)readProperty("e4s");
- }
-
-
-}
diff --git a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_E4.java b/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_E4.java
deleted file mode 100644
index f579ef216..000000000
--- a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_E4.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.apache.cayenne.lifecycle.db.auto;
-
-import java.util.List;
-
-import org.apache.cayenne.GenericPersistentObject;
-import org.apache.cayenne.exp.property.ListProperty;
-import org.apache.cayenne.exp.property.PropertyFactory;
-import org.apache.cayenne.lifecycle.db.E3;
-
-/**
- * Class _E4 was generated by Cayenne.
- * It is probably a good idea to avoid changing this class manually,
- * since it may be overwritten next time code is regenerated.
- * If you need to make any customizations, please use subclass.
- */
-public abstract class _E4 extends GenericPersistentObject {
-
- public static final String ID_PK_COLUMN = "ID";
-
- public static final ListProperty<E3> E3S = PropertyFactory.createList("e3s", E3.class);
-
- public void addToE3s(E3 obj) {
- addToManyTarget("e3s", obj, true);
- }
- public void removeFromE3s(E3 obj) {
- removeToManyTarget("e3s", obj, true);
- }
- @SuppressWarnings("unchecked")
- public List<E3> getE3s() {
- return (List<E3>)readProperty("e3s");
- }
-
-
-}
diff --git a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_SortDep.java b/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_SortDep.java
deleted file mode 100644
index 074c337c6..000000000
--- a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_SortDep.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.apache.cayenne.lifecycle.db.auto;
-
-import org.apache.cayenne.GenericPersistentObject;
-import org.apache.cayenne.exp.property.EntityProperty;
-import org.apache.cayenne.exp.property.PropertyFactory;
-import org.apache.cayenne.lifecycle.db.SortRoot;
-
-/**
- * Class _SortDep was generated by Cayenne.
- * It is probably a good idea to avoid changing this class manually,
- * since it may be overwritten next time code is regenerated.
- * If you need to make any customizations, please use subclass.
- */
-public abstract class _SortDep extends GenericPersistentObject {
-
- public static final String ID_PK_COLUMN = "ID";
-
- public static final EntityProperty<SortRoot> ROOT = PropertyFactory.createEntity("root", SortRoot.class);
-
- public void setRoot(SortRoot root) {
- setToOneTarget("root", root, true);
- }
-
- public SortRoot getRoot() {
- return (SortRoot)readProperty("root");
- }
-
-
-}
diff --git a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_SortRoot.java b/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_SortRoot.java
deleted file mode 100644
index 246531bee..000000000
--- a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_SortRoot.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.apache.cayenne.lifecycle.db.auto;
-
-import java.util.List;
-
-import org.apache.cayenne.GenericPersistentObject;
-import org.apache.cayenne.exp.property.ListProperty;
-import org.apache.cayenne.exp.property.PropertyFactory;
-import org.apache.cayenne.lifecycle.db.SortDep;
-
-/**
- * Class _SortRoot was generated by Cayenne.
- * It is probably a good idea to avoid changing this class manually,
- * since it may be overwritten next time code is regenerated.
- * If you need to make any customizations, please use subclass.
- */
-public abstract class _SortRoot extends GenericPersistentObject {
-
- public static final String ID_PK_COLUMN = "ID";
-
- public static final ListProperty<SortDep> DEPS = PropertyFactory.createList("deps", SortDep.class);
-
- public void addToDeps(SortDep obj) {
- addToManyTarget("deps", obj, true);
- }
- public void removeFromDeps(SortDep obj) {
- removeToManyTarget("deps", obj, true);
- }
- @SuppressWarnings("unchecked")
- public List<SortDep> getDeps() {
- return (List<SortDep>)readProperty("deps");
- }
-
-
-}
diff --git a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_UuidRoot1.java b/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_UuidRoot1.java
deleted file mode 100644
index 6ed69bd35..000000000
--- a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/db/auto/_UuidRoot1.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.apache.cayenne.lifecycle.db.auto;
-
-import org.apache.cayenne.GenericPersistentObject;
-import org.apache.cayenne.exp.property.PropertyFactory;
-import org.apache.cayenne.exp.property.StringProperty;
-
-/**
- * Class _UuidRoot1 was generated by Cayenne.
- * It is probably a good idea to avoid changing this class manually,
- * since it may be overwritten next time code is regenerated.
- * If you need to make any customizations, please use subclass.
- */
-public abstract class _UuidRoot1 extends GenericPersistentObject {
-
- public static final String ID_PK_COLUMN = "ID";
-
- public static final StringProperty<String> UUID = PropertyFactory.createString("uuid", String.class);
-
- public void setUuid(String uuid) {
- writeProperty("uuid", uuid);
- }
- public String getUuid() {
- return (String)readProperty("uuid");
- }
-
-}
diff --git a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/id/EntityIdCoderIT.java b/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/id/EntityIdCoderIT.java
deleted file mode 100644
index 2b84cb0bb..000000000
--- a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/id/EntityIdCoderIT.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.lifecycle.id;
-
-import org.apache.cayenne.ObjectId;
-import org.apache.cayenne.configuration.DataNodeDescriptor;
-import org.apache.cayenne.datasource.CayenneDataSource;
-import org.apache.cayenne.map.DbAttribute;
-import org.apache.cayenne.map.DbEntity;
-import org.apache.cayenne.map.ObjEntity;
-import org.apache.cayenne.runtime.CayenneRuntime;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import javax.sql.DataSource;
-
-import java.sql.Types;
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class EntityIdCoderIT {
-
- private CayenneRuntime runtime;
-
- @BeforeEach
- public void setUp() throws Exception {
- DataSource dataSource = CayenneDataSource.of("jdbc:hsqldb:mem:lifecycle")
- .driverClass("org.hsqldb.jdbcDriver")
- .userName("sa")
- .pool(1, 1)
- .build();
-
- DataNodeDescriptor dataNode = DataNodeDescriptor.of("lifecycle")
- .dataSource(dataSource)
- .createSchemaIfNeeded()
- .build();
-
- runtime = CayenneRuntime.of()
- .addConfig("cayenne-lifecycle.xml")
- .defaultDataNode(dataNode)
- .build();
- }
-
- @AfterEach
- public void tearDown() throws Exception {
- runtime.shutdown();
- }
-
- @Test
- public void getEntityName() {
- assertEquals("M", EntityIdCoder.getEntityName("M:N:K"));
- assertEquals("M", EntityIdCoder.getEntityName(".M:N:K"));
- }
-
- @Test
- public void tempId() {
-
- ObjEntity e1 = runtime.getDataDomain().getEntityResolver().getObjEntity("E1");
- EntityIdCoder coder = new EntityIdCoder(e1);
-
- byte[] key = new byte[] { 2, 2, 10, 100 };
- ObjectId encoded = ObjectId.of("E1", key);
-
- String string = coder.toStringId(encoded);
- assertEquals(".E1:02020A64", string);
-
- ObjectId decoded = coder.toObjectId(string);
- assertTrue(decoded.isTemporary());
- assertEquals(encoded, decoded);
- }
-
- @Test
- public void singleIntPk() {
- DbEntity dbEntity = new DbEntity("X");
- DbAttribute pk = new DbAttribute("ID");
- pk.setType(Types.INTEGER);
- pk.setPrimaryKey(true);
- dbEntity.addAttribute(pk);
-
- ObjEntity entity = mock(ObjEntity.class);
- when(entity.getName()).thenReturn("x");
- when(entity.getDbEntityName()).thenReturn(dbEntity.getName());
- when(entity.getDbEntity()).thenReturn(dbEntity);
-
- ObjectId id = ObjectId.of("x", "ID", 3);
-
- EntityIdCoder coder = new EntityIdCoder(entity);
- assertEquals("x:3", coder.toStringId(id));
-
- ObjectId parsedId = coder.toObjectId("x:3");
- assertEquals(id, parsedId);
- }
-
- @Test
- public void singleLongPk() {
- DbEntity dbEntity = new DbEntity("X");
- DbAttribute pk = new DbAttribute("ID");
- pk.setType(Types.BIGINT);
- pk.setPrimaryKey(true);
- dbEntity.addAttribute(pk);
-
- ObjEntity entity = mock(ObjEntity.class);
- when(entity.getName()).thenReturn("x");
- when(entity.getDbEntityName()).thenReturn(dbEntity.getName());
- when(entity.getDbEntity()).thenReturn(dbEntity);
-
- ObjectId id = ObjectId.of("x", "ID", 3L);
-
- EntityIdCoder coder = new EntityIdCoder(entity);
- assertEquals("x:3", coder.toStringId(id));
-
- ObjectId parsedId = coder.toObjectId("x:3");
- assertEquals(id, parsedId);
- }
-
- @Test
- public void singleStringPk() {
- DbEntity dbEntity = new DbEntity("X");
- DbAttribute pk = new DbAttribute("ID");
- pk.setType(Types.VARCHAR);
- pk.setPrimaryKey(true);
- dbEntity.addAttribute(pk);
-
- ObjEntity entity = mock(ObjEntity.class);
- when(entity.getName()).thenReturn("x");
- when(entity.getDbEntityName()).thenReturn(dbEntity.getName());
- when(entity.getDbEntity()).thenReturn(dbEntity);
-
- EntityIdCoder coder = new EntityIdCoder(entity);
-
- ObjectId id = ObjectId.of("x", "ID", "AbC");
- assertEquals("x:AbC", coder.toStringId(id));
-
- ObjectId parsedId = coder.toObjectId("x:AbC");
- assertEquals(id, parsedId);
- }
-
- @Test
- public void idEncoding() {
- DbEntity dbEntity = new DbEntity("X");
- DbAttribute pk = new DbAttribute("ID");
- pk.setType(Types.VARCHAR);
- pk.setPrimaryKey(true);
- dbEntity.addAttribute(pk);
-
- ObjEntity entity = mock(ObjEntity.class);
- when(entity.getName()).thenReturn("x");
- when(entity.getDbEntityName()).thenReturn(dbEntity.getName());
- when(entity.getDbEntity()).thenReturn(dbEntity);
-
- EntityIdCoder coder = new EntityIdCoder(entity);
-
- ObjectId id = ObjectId.of("x", "ID", "Ab:C");
- assertEquals("x:Ab%3AC", coder.toStringId(id));
-
- ObjectId parsedId = coder.toObjectId("x:Ab%3AC");
- assertEquals(id, parsedId);
- }
-
- @Test
- public void mixedCompoundPk() {
- DbEntity dbEntity = new DbEntity("X");
- DbAttribute pk1 = new DbAttribute("ID");
- pk1.setType(Types.VARCHAR);
- pk1.setPrimaryKey(true);
- dbEntity.addAttribute(pk1);
-
- DbAttribute pk2 = new DbAttribute("ABC");
- pk2.setType(Types.BIGINT);
- pk2.setPrimaryKey(true);
- dbEntity.addAttribute(pk2);
-
- DbAttribute pk3 = new DbAttribute("ZZZ");
- pk3.setType(Types.VARCHAR);
- pk3.setPrimaryKey(true);
- dbEntity.addAttribute(pk3);
-
- ObjEntity entity = mock(ObjEntity.class);
- when(entity.getName()).thenReturn("x");
- when(entity.getDbEntityName()).thenReturn(dbEntity.getName());
- when(entity.getDbEntity()).thenReturn(dbEntity);
-
- EntityIdCoder coder = new EntityIdCoder(entity);
-
- Map<String, Object> idMap = new HashMap<>();
- idMap.put("ID", "X;Y");
- idMap.put("ABC", 6783463L);
- idMap.put("ZZZ", "'_'");
- ObjectId id = ObjectId.of("x", idMap);
- assertEquals("x:6783463:X%3BY:%27_%27", coder.toStringId(id));
-
- ObjectId parsedId = coder.toObjectId("x:6783463:X%3BY:%27_%27");
- assertEquals(id, parsedId);
- }
-}
diff --git a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/id/IdCoderIT.java b/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/id/IdCoderIT.java
deleted file mode 100644
index d8fff7c19..000000000
--- a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/id/IdCoderIT.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.lifecycle.id;
-
-import org.apache.cayenne.ObjectId;
-import org.apache.cayenne.configuration.DataNodeDescriptor;
-import org.apache.cayenne.datasource.CayenneDataSource;
-import org.apache.cayenne.lifecycle.db.E1;
-import org.apache.cayenne.runtime.CayenneRuntime;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import javax.sql.DataSource;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-public class IdCoderIT {
-
- private CayenneRuntime runtime;
-
- @BeforeEach
- public void setUp() throws Exception {
- DataSource dataSource = CayenneDataSource.of("jdbc:hsqldb:mem:lifecycle")
- .driverClass("org.hsqldb.jdbcDriver")
- .userName("sa")
- .pool(1, 1)
- .build();
-
- DataNodeDescriptor dataNode = DataNodeDescriptor.of("lifecycle")
- .dataSource(dataSource)
- .createSchemaIfNeeded()
- .build();
-
- runtime = CayenneRuntime.of()
- .addConfig("cayenne-lifecycle.xml")
- .defaultDataNode(dataNode)
- .build();
- }
-
- @AfterEach
- public void tearDown() throws Exception {
- runtime.shutdown();
- }
-
- @Test
- public void getStringId() {
- IdCoder handler = new IdCoder(runtime.getDataDomain().getEntityResolver());
-
- E1 e1 = new E1();
- e1.setObjectId(ObjectId.of("E1", "ID", 5));
- assertEquals("E1:5", handler.getStringId(e1));
- }
-
- @Test
- public void getStringId_ObjectId() {
- IdCoder handler = new IdCoder(runtime.getDataDomain().getEntityResolver());
- assertEquals("E1:5", handler.getStringId(ObjectId.of("E1", "ID", 5)));
- }
-
- @Test
- public void getStringId_Temp() {
- IdCoder handler = new IdCoder(runtime.getDataDomain().getEntityResolver());
-
- byte[] key = new byte[] { 1, 2, 10, 100 };
-
- E1 e1 = new E1();
- e1.setObjectId(ObjectId.of("E1", key));
-
- assertEquals(".E1:01020A64", handler.getStringId(e1));
- }
-
- @Test
- public void getObjectId_Temp() {
- IdCoder handler = new IdCoder(runtime.getDataDomain().getEntityResolver());
-
- byte[] key = new byte[] { 1, (byte) 0xD7, 10, 100 };
-
- ObjectId decoded = handler.getObjectId(".E1:01D70A64");
- assertEquals(ObjectId.of("E1", key), decoded);
- }
-
- @Test
- public void getSringId_TempWithReplacement() {
- IdCoder handler = new IdCoder(runtime.getDataDomain().getEntityResolver());
-
- byte[] key = new byte[] { 5, 2, 11, 99 };
- ObjectId id = ObjectId.of("E1", key);
- id.getReplacementIdMap().put("ID", 6);
-
- E1 e1 = new E1();
- e1.setObjectId(id);
-
- assertEquals("E1:6", handler.getStringId(e1));
- }
-}
diff --git a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/id/StringIdFetcherIT.java b/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/id/StringIdFetcherIT.java
deleted file mode 100644
index d2ac1fd66..000000000
--- a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/id/StringIdFetcherIT.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.lifecycle.id;
-
-import org.apache.cayenne.ObjectContext;
-import org.apache.cayenne.Persistent;
-import org.apache.cayenne.configuration.DataNodeDescriptor;
-import org.apache.cayenne.datasource.CayenneDataSource;
-import org.apache.cayenne.runtime.CayenneRuntime;
-import org.apache.cayenne.test.jdbc.DbHelper;
-import org.apache.cayenne.test.jdbc.TableHelper;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import javax.sql.DataSource;
-
-import java.util.List;
-import java.util.Map;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-public class StringIdFetcherIT {
-
- private CayenneRuntime runtime;
- private TableHelper e1Helper;
- private TableHelper e2Helper;
-
- @BeforeEach
- public void setUp() throws Exception {
- DataSource dataSource = CayenneDataSource.of("jdbc:hsqldb:mem:lifecycle")
- .driverClass("org.hsqldb.jdbcDriver")
- .userName("sa")
- .pool(1, 1)
- .build();
-
- DataNodeDescriptor dataNode = DataNodeDescriptor.of("lifecycle")
- .dataSource(dataSource)
- .createSchemaIfNeeded()
- .build();
-
- runtime = CayenneRuntime.of()
- .addConfig("cayenne-lifecycle.xml")
- .defaultDataNode(dataNode)
- .build();
- DbHelper dbHelper = new DbHelper(runtime.getDataSource());
- e1Helper = new TableHelper(dbHelper, "E1", "ID");
- e2Helper = new TableHelper(dbHelper, "E2", "ID");
-
- e1Helper.deleteAll();
- e2Helper.deleteAll();
- }
-
- @AfterEach
- public void tearDown() {
- runtime.shutdown();
- }
-
- @Test
- public void fetchOne() throws Exception {
- e1Helper.insert(3).insert(4);
-
- ObjectContext context = runtime.newContext();
- Persistent e1 = StringIdFetcher.fetchOne(context, "E1:3");
- assertNotNull(e1);
- assertEquals("E1", e1.getObjectId().getEntityName());
- assertEquals(3L, e1.getObjectId().getIdSnapshot().get("ID"));
-
- assertNull(StringIdFetcher.fetchOne(context, "E1:5"));
- }
-
- @Test
- public void fetch_Empty() {
- assertTrue(StringIdFetcher.fetch(runtime.newContext()).isEmpty());
- assertTrue(StringIdFetcher.fetch(runtime.newContext(), List.of()).isEmpty());
- }
-
- @Test
- public void fetch_SingleEntity() throws Exception {
- e1Helper.insert(3).insert(4);
-
- Map<String, Persistent> objects = StringIdFetcher
- .fetch(runtime.newContext(), "E1:3", "E1:4", "E1:5", "E1:3");
- assertEquals(2, objects.size());
- assertEquals(3L, objects.get("E1:3").getObjectId().getIdSnapshot().get("ID"));
- assertEquals(4L, objects.get("E1:4").getObjectId().getIdSnapshot().get("ID"));
- }
-
- @Test
- public void fetch_MultipleEntities() throws Exception {
- e1Helper.insert(3).insert(4);
- e2Helper.insert(5).insert(6).insert(7);
-
- Map<String, Persistent> objects = StringIdFetcher
- .fetch(runtime.newContext(), List.of("E1:3", "E1:4", "E2:6", "E1:5"));
- assertEquals(3L, objects.size());
- assertEquals("E1", objects.get("E1:3").getObjectId().getEntityName());
- assertEquals("E1", objects.get("E1:4").getObjectId().getEntityName());
- assertEquals("E2", objects.get("E2:6").getObjectId().getEntityName());
- assertEquals(6L, objects.get("E2:6").getObjectId().getIdSnapshot().get("ID"));
- }
-
- @Test
- public void fetch_UnknownEntity() {
- assertThrows(IllegalArgumentException.class,
- () -> StringIdFetcher.fetch(runtime.newContext(), "NoSuchEntity:1"));
- }
-}
diff --git a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/relationship/ObjectIdRelationshipHandlerIT.java b/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/relationship/ObjectIdRelationshipHandlerIT.java
deleted file mode 100644
index 2ac680f98..000000000
--- a/cayenne-lifecycle/src/test/java/org/apache/cayenne/lifecycle/relationship/ObjectIdRelationshipHandlerIT.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- ****************************************************************/
-package org.apache.cayenne.lifecycle.relationship;
-
-import org.apache.cayenne.Cayenne;
-import org.apache.cayenne.ObjectContext;
-import org.apache.cayenne.configuration.DataNodeDescriptor;
-import org.apache.cayenne.datasource.CayenneDataSource;
-import org.apache.cayenne.lifecycle.db.E1;
-import org.apache.cayenne.lifecycle.db.UuidRoot1;
-import org.apache.cayenne.lifecycle.id.IdCoder;
-import org.apache.cayenne.query.ObjectSelect;
-import org.apache.cayenne.runtime.CayenneRuntime;
-import org.apache.cayenne.test.jdbc.DbHelper;
-import org.apache.cayenne.test.jdbc.TableHelper;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import javax.sql.DataSource;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotEquals;
-import static org.junit.jupiter.api.Assertions.assertSame;
-
-public class ObjectIdRelationshipHandlerIT {
-
- private CayenneRuntime runtime;
-
- private TableHelper rootTable;
- private TableHelper e1Table;
-
- @BeforeEach
- public void setUp() throws Exception {
- DataSource dataSource = CayenneDataSource.of("jdbc:hsqldb:mem:lifecycle")
- .driverClass("org.hsqldb.jdbcDriver")
- .userName("sa")
- .pool(1, 1)
- .build();
-
- DataNodeDescriptor dataNode = DataNodeDescriptor.of("lifecycle")
- .dataSource(dataSource)
- .createSchemaIfNeeded()
- .build();
-
- runtime = CayenneRuntime.of()
- .addConfig("cayenne-lifecycle.xml")
- .defaultDataNode(dataNode)
- .build();
-
- // a filter is required to invalidate root objects after commit
- ObjectIdRelationshipFilter filter = new ObjectIdRelationshipFilter();
- runtime.getDataDomain().addQueryFilter(filter);
- runtime.getDataDomain().getEntityResolver().getCallbackRegistry().addListener(filter);
-
- DbHelper dbHelper = new DbHelper(runtime.getDataSource(null));
-
- rootTable = new TableHelper(dbHelper, "UUID_ROOT1").setColumns("ID", "UUID");
- rootTable.deleteAll();
-
- e1Table = new TableHelper(dbHelper, "E1").setColumns("ID");
- e1Table.deleteAll();
- }
-
- @AfterEach
- public void tearDown() {
- runtime.shutdown();
- }
-
- @Test
- public void relate_Existing() throws Exception {
-
- e1Table.insert(1);
-
- ObjectContext context = runtime.newContext();
- E1 e1 = (E1) context.selectOne(ObjectSelect.query(E1.class));
-
- UuidRoot1 r1 = context.newObject(UuidRoot1.class);
-
- IdCoder refHandler = new IdCoder(context.getEntityResolver());
- ObjectIdRelationshipHandler handler = new ObjectIdRelationshipHandler(refHandler);
- handler.relate(r1, e1);
-
- assertEquals("E1:1", r1.getUuid());
- assertSame(e1, r1.readPropertyDirectly("cay:related:uuid"));
-
- context.commitChanges();
-
- Object[] r1x = rootTable.select();
- assertEquals("E1:1", r1x[1]);
- }
-
- @Test
- public void relate_New() throws Exception {
-
- ObjectContext context = runtime.newContext();
- E1 e1 = context.newObject(E1.class);
-
- UuidRoot1 r1 = context.newObject(UuidRoot1.class);
-
- IdCoder refHandler = new IdCoder(context
- .getEntityResolver());
- ObjectIdRelationshipHandler handler = new ObjectIdRelationshipHandler(refHandler);
- handler.relate(r1, e1);
-
- assertSame(e1, r1.readPropertyDirectly("cay:related:uuid"));
-
- context.commitChanges();
-
- int id = Cayenne.intPKForObject(e1);
-
- Object[] r1x = rootTable.select();
- assertEquals("E1:" + id, r1x[1]);
- assertEquals("E1:" + id, r1.getUuid());
- }
-
- @Test
- public void relate_Change() throws Exception {
-
- e1Table.insert(1);
- rootTable.insert(1, "E1:1");
-
- ObjectContext context = runtime.newContext();
-
- UuidRoot1 r1 = Cayenne.objectForPK(context, UuidRoot1.class, 1);
- assertEquals("E1:1", r1.getUuid());
-
- E1 e1 = context.newObject(E1.class);
-
- IdCoder refHandler = new IdCoder(context
- .getEntityResolver());
- ObjectIdRelationshipHandler handler = new ObjectIdRelationshipHandler(refHandler);
- handler.relate(r1, e1);
-
- assertSame(e1, r1.readPropertyDirectly("cay:related:uuid"));
-
- context.commitChanges();
-
- int id = Cayenne.intPKForObject(e1);
- assertNotEquals(1, id);
-
- Object[] r1x = rootTable.select();
- assertEquals("E1:" + id, r1x[1]);
- assertEquals("E1:" + id, r1.getUuid());
- assertSame(e1, r1.readProperty("cay:related:uuid"));
- }
-}
diff --git a/cayenne-lifecycle/src/test/resources/cayenne-lifecycle.xml b/cayenne-lifecycle/src/test/resources/cayenne-lifecycle.xml
deleted file mode 100644
index 57e5ba437..000000000
--- a/cayenne-lifecycle/src/test/resources/cayenne-lifecycle.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<domain xmlns="http://cayenne.apache.org/schema/13/domain"
- project-version="13">
- <map name="lifecycle-map"/>
-</domain>
diff --git a/cayenne-lifecycle/src/test/resources/lifecycle-map.map.xml b/cayenne-lifecycle/src/test/resources/lifecycle-map.map.xml
deleted file mode 100644
index fa9de8724..000000000
--- a/cayenne-lifecycle/src/test/resources/lifecycle-map.map.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<data-map xmlns="http://cayenne.apache.org/schema/13/modelMap"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://cayenne.apache.org/schema/13/modelMap http://cayenne.apache.org/schema/13/modelMap.xsd"
- project-version="13">
- <property name="defaultPackage" value="org.apache.cayenne.lifecycle.db"/>
- <db-entity name="E1">
- <db-attribute name="ID" type="BIGINT" isPrimaryKey="true" isMandatory="true"/>
- </db-entity>
- <db-entity name="E2">
- <db-attribute name="ID" type="BIGINT" isPrimaryKey="true" isMandatory="true"/>
- </db-entity>
- <db-entity name="E3">
- <db-attribute name="ID" type="BIGINT" isPrimaryKey="true" isMandatory="true"/>
- </db-entity>
- <db-entity name="E34">
- <db-attribute name="E3_ID" type="BIGINT" isPrimaryKey="true" isMandatory="true"/>
- <db-attribute name="E4_ID" type="BIGINT" isPrimaryKey="true" isMandatory="true"/>
- </db-entity>
- <db-entity name="E4">
- <db-attribute name="ID" type="BIGINT" isPrimaryKey="true" isMandatory="true"/>
- </db-entity>
- <db-entity name="SORT_DEP">
- <db-attribute name="ID" type="BIGINT" isPrimaryKey="true" isMandatory="true"/>
- <db-attribute name="ROOT_ID" type="BIGINT" isMandatory="true"/>
- </db-entity>
- <db-entity name="SORT_ROOT">
- <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
- </db-entity>
- <db-entity name="UUID_ROOT1">
- <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
- <db-attribute name="UUID" type="VARCHAR" length="200"/>
- </db-entity>
- <obj-entity name="E1" className="org.apache.cayenne.lifecycle.db.E1" dbEntityName="E1"/>
- <obj-entity name="E2" className="org.apache.cayenne.lifecycle.db.E2" dbEntityName="E2"/>
- <obj-entity name="E3" className="org.apache.cayenne.lifecycle.db.E3" dbEntityName="E3"/>
- <obj-entity name="E4" className="org.apache.cayenne.lifecycle.db.E4" dbEntityName="E4"/>
- <obj-entity name="SortDep" className="org.apache.cayenne.lifecycle.db.SortDep" dbEntityName="SORT_DEP"/>
- <obj-entity name="SortRoot" className="org.apache.cayenne.lifecycle.db.SortRoot" dbEntityName="SORT_ROOT"/>
- <obj-entity name="UuidRoot1" className="org.apache.cayenne.lifecycle.db.UuidRoot1" dbEntityName="UUID_ROOT1">
- <obj-attribute name="uuid" type="java.lang.String" db-attribute-path="UUID"/>
- </obj-entity>
- <db-relationship name="e34s" source="E3" target="E34" toDependentPK="true" toMany="true">
- <db-attribute-pair source="ID" target="E3_ID"/>
- </db-relationship>
- <db-relationship name="e3" source="E34" target="E3">
- <db-attribute-pair source="E3_ID" target="ID"/>
- </db-relationship>
- <db-relationship name="e4" source="E34" target="E4">
- <db-attribute-pair source="E4_ID" target="ID"/>
- </db-relationship>
- <db-relationship name="e34s" source="E4" target="E34" toDependentPK="true" toMany="true">
- <db-attribute-pair source="ID" target="E4_ID"/>
- </db-relationship>
- <db-relationship name="root" source="SORT_DEP" target="SORT_ROOT">
- <db-attribute-pair source="ROOT_ID" target="ID"/>
- </db-relationship>
- <db-relationship name="deps" source="SORT_ROOT" target="SORT_DEP" toMany="true">
- <db-attribute-pair source="ID" target="ROOT_ID"/>
- </db-relationship>
- <obj-relationship name="e4s" source="E3" target="E4" deleteRule="Deny" db-relationship-path="e34s.e4"/>
- <obj-relationship name="e3s" source="E4" target="E3" deleteRule="Deny" db-relationship-path="e34s.e3"/>
- <obj-relationship name="root" source="SortDep" target="SortRoot" deleteRule="Nullify" db-relationship-path="root"/>
- <obj-relationship name="deps" source="SortRoot" target="SortDep" deleteRule="Deny" db-relationship-path="deps"/>
-</data-map>
diff --git a/cayenne/src/test/java/org/apache/cayenne/commitlog/unit/AuditableRuntimeCase.java b/cayenne/src/test/java/org/apache/cayenne/commitlog/unit/AuditableRuntimeCase.java
index cf51a012e..ba989deba 100644
--- a/cayenne/src/test/java/org/apache/cayenne/commitlog/unit/AuditableRuntimeCase.java
+++ b/cayenne/src/test/java/org/apache/cayenne/commitlog/unit/AuditableRuntimeCase.java
@@ -30,7 +30,7 @@ import org.junit.jupiter.api.BeforeEach;
import javax.sql.DataSource;
/**
- * A superclass of integration tests for cayenne-lifecycle.
+ * A superclass of integration tests for cayenne-commitlog.
*/
public abstract class AuditableRuntimeCase {
diff --git a/pom.xml b/pom.xml
index 6b9a49cd1..4a25fcbf3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -115,7 +115,6 @@
<module>cayenne-di</module>
<module>cayenne-gradle-plugin</module>
<module>cayenne-jcache</module>
- <module>cayenne-lifecycle</module>
<module>cayenne-mcp-server</module>
<module>cayenne-modeler</module>
<module>cayenne-modeler-prefs</module>
(cayenne) 01/02: cleanup
Posted by aa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git
commit daa401a03b80b63ff8b90a188220e3abd6961dcf
Author: Andrus Adamchik <an...@objectstyle.com>
AuthorDate: Sat Sep 26 10:00:28 2026 -0400
cleanup
---
.../compatibility/DefaultDocumentProvider.java | 6 +++---
.../CompatibilityDataChannelDescriptorLoader.java | 21 +++++++++------------
2 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/cayenne-project-compatibility/src/main/java/org/apache/cayenne/project/compatibility/DefaultDocumentProvider.java b/cayenne-project-compatibility/src/main/java/org/apache/cayenne/project/compatibility/DefaultDocumentProvider.java
index afd315c4e..22cf146aa 100644
--- a/cayenne-project-compatibility/src/main/java/org/apache/cayenne/project/compatibility/DefaultDocumentProvider.java
+++ b/cayenne-project-compatibility/src/main/java/org/apache/cayenne/project/compatibility/DefaultDocumentProvider.java
@@ -19,18 +19,18 @@
package org.apache.cayenne.project.compatibility;
+import org.w3c.dom.Document;
+
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
-import org.w3c.dom.Document;
-
/**
* @since 4.1
*/
public class DefaultDocumentProvider implements DocumentProvider {
- private Map<String, Document> documentMap = new HashMap<>();
+ private final Map<String, Document> documentMap = new HashMap<>();
@Override
public Document getDocument(URL url) {
diff --git a/cayenne-project-compatibility/src/main/java/org/apache/cayenne/project/compatibility/configuration/CompatibilityDataChannelDescriptorLoader.java b/cayenne-project-compatibility/src/main/java/org/apache/cayenne/project/compatibility/configuration/CompatibilityDataChannelDescriptorLoader.java
index 5dd1feffe..f377723dd 100644
--- a/cayenne-project-compatibility/src/main/java/org/apache/cayenne/project/compatibility/configuration/CompatibilityDataChannelDescriptorLoader.java
+++ b/cayenne-project-compatibility/src/main/java/org/apache/cayenne/project/compatibility/configuration/CompatibilityDataChannelDescriptorLoader.java
@@ -19,14 +19,6 @@
package org.apache.cayenne.project.compatibility.configuration;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.net.URL;
-
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
import org.apache.cayenne.ConfigurationException;
import org.apache.cayenne.configuration.ConfigurationTree;
import org.apache.cayenne.configuration.DataChannelDescriptor;
@@ -48,13 +40,20 @@ import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.net.URL;
+
/**
* @since 4.1
*/
public class CompatibilityDataChannelDescriptorLoader extends XMLDataChannelDescriptorLoader {
- private static final Logger LOGGER = LoggerFactory.getLogger(XMLDataChannelDescriptorLoader.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(CompatibilityDataChannelDescriptorLoader.class);
@Inject
Provider<ProjectUpgrader> upgradeServiceProvider;
@@ -68,12 +67,10 @@ public class CompatibilityDataChannelDescriptorLoader extends XMLDataChannelDesc
throw new NullPointerException("Null configurationResource");
}
- if(!(upgradeServiceProvider.get() instanceof CompatibilityProjectUpgrader)) {
+ if(!(upgradeServiceProvider.get() instanceof CompatibilityProjectUpgrader upgradeService)) {
throw new ConfigurationException("CompatibilityUpgradeService expected");
}
- CompatibilityProjectUpgrader upgradeService = (CompatibilityProjectUpgrader)upgradeServiceProvider.get();
-
PreUpgradeState metaData = upgradeService.checkUpgradeNeeded(configurationResource);
if(metaData.requiredUpgrade() == UpgradeType.UPGRADE_NOT_NEEDED) {
return super.load(configurationResource);