This is an automated email from the ASF dual-hosted git repository. ntimofeev pushed a commit to branch 5.0-merge-persistent-and-data-objects in repository https://gitbox.apache.org/repos/asf/cayenne.git
commit 4c1c90f9a8b52ec86cbc29594900f97d2b67baed Author: stariy95 <stari...@gmail.com> AuthorDate: Wed Dec 27 11:30:17 2023 +0400 Move code from `PersistentObject` directly to `BaseDataObject` --- .../java/org/apache/cayenne/BaseDataObject.java | 70 +++++++-- .../main/java/org/apache/cayenne/DataObject.java | 40 ++--- .../java/org/apache/cayenne/PersistentObject.java | 32 ++-- .../apache/cayenne/ContextStateRecorderTest.java | 8 +- .../org/apache/cayenne/PersistentObjectIT.java | 6 +- .../org/apache/cayenne/query/RefreshQueryTest.java | 6 +- .../reflect/LifecycleCallbackEventHandlerTest.java | 4 +- .../cayenne/testdo/cay_2641/client/ArtistLazy.java | 31 ---- .../testdo/cay_2641/client/PaintingLazy.java | 31 ---- .../testdo/cay_2641/client/auto/_ArtistLazy.java | 113 --------------- .../testdo/cay_2641/client/auto/_PaintingLazy.java | 66 --------- .../testdo/deleterules/ClientDeleteCascade.java | 28 ---- .../testdo/deleterules/ClientDeleteDeny.java | 28 ---- .../testdo/deleterules/ClientDeleteNullify.java | 28 ---- .../testdo/deleterules/ClientDeleteRule.java | 28 ---- .../cayenne/testdo/deleterules/DeleteCascade.java | 28 ---- .../cayenne/testdo/deleterules/DeleteDeny.java | 28 ---- .../cayenne/testdo/deleterules/DeleteNullify.java | 28 ---- .../cayenne/testdo/deleterules/DeleteRule.java | 28 ---- .../deleterules/auto/_ClientDeleteCascade.java | 56 ------- .../testdo/deleterules/auto/_ClientDeleteDeny.java | 56 ------- .../deleterules/auto/_ClientDeleteNullify.java | 56 ------- .../testdo/deleterules/auto/_ClientDeleteRule.java | 114 --------------- .../testdo/deleterules/auto/_DeleteCascade.java | 109 -------------- .../testdo/deleterules/auto/_DeleteDeny.java | 109 -------------- .../testdo/deleterules/auto/_DeleteNullify.java | 109 -------------- .../testdo/deleterules/auto/_DeleteRule.java | 161 --------------------- .../testdo/lifecycles/ClientLifecycles.java | 28 ---- .../testdo/lifecycles/auto/_ClientLifecycles.java | 37 ----- .../testdo/map_to_many/ClientIdMapToMany.java | 28 ---- .../map_to_many/ClientIdMapToManyTarget.java | 28 ---- .../map_to_many/auto/_ClientIdMapToMany.java | 41 ------ .../map_to_many/auto/_ClientIdMapToManyTarget.java | 33 ----- .../testdo/meaningful_pk/ClientMeaningfulPk.java | 28 ---- .../meaningful_pk/ClientMeaningfulPkDep2.java | 31 ---- .../meaningful_pk/auto/_ClientMeaningfulPk.java | 62 -------- .../auto/_ClientMeaningfulPkDep2.java | 82 ----------- .../apache/cayenne/testdo/mt/ClientMtTable1.java | 94 ------------ .../cayenne/testdo/mt/ClientMtTable1Subclass1.java | 28 ---- .../cayenne/testdo/mt/ClientMtTable1Subclass2.java | 28 ---- .../apache/cayenne/testdo/mt/ClientMtTable2.java | 29 ---- .../apache/cayenne/testdo/mt/ClientMtTable3.java | 28 ---- .../apache/cayenne/testdo/mt/ClientMtTable4.java | 28 ---- .../apache/cayenne/testdo/mt/ClientMtTable5.java | 28 ---- .../cayenne/testdo/mt/auto/_ClientMtTable1.java | 91 ------------ .../testdo/mt/auto/_ClientMtTable1Subclass1.java | 35 ----- .../testdo/mt/auto/_ClientMtTable1Subclass2.java | 35 ----- .../cayenne/testdo/mt/auto/_ClientMtTable2.java | 84 ----------- .../cayenne/testdo/mt/auto/_ClientMtTable3.java | 112 -------------- .../cayenne/testdo/mt/auto/_ClientMtTable4.java | 52 ------- .../cayenne/testdo/mt/auto/_ClientMtTable5.java | 52 ------- .../cayenne/testdo/reflexive/ClientReflexive.java | 28 ---- .../testdo/reflexive/auto/_ClientReflexive.java | 82 ----------- .../table_primitives/ClientTablePrimitives.java | 28 ---- .../auto/_ClientTablePrimitives.java | 60 -------- .../cayenne/testdo/toone/ClientTooneDep.java | 28 ---- .../cayenne/testdo/toone/ClientTooneMaster.java | 28 ---- .../cayenne/testdo/toone/auto/_ClientTooneDep.java | 33 ----- .../testdo/toone/auto/_ClientTooneMaster.java | 33 ----- .../cayenne/util/PersistentObjectHolderTest.java | 73 ---------- 60 files changed, 103 insertions(+), 2813 deletions(-) diff --git a/cayenne/src/main/java/org/apache/cayenne/BaseDataObject.java b/cayenne/src/main/java/org/apache/cayenne/BaseDataObject.java index 3b8eec657..f7f79edfe 100644 --- a/cayenne/src/main/java/org/apache/cayenne/BaseDataObject.java +++ b/cayenne/src/main/java/org/apache/cayenne/BaseDataObject.java @@ -37,7 +37,10 @@ import org.apache.cayenne.map.EntityResolver; import org.apache.cayenne.map.ObjAttribute; import org.apache.cayenne.map.ObjEntity; import org.apache.cayenne.map.ObjRelationship; +import org.apache.cayenne.reflect.ClassDescriptor; +import org.apache.cayenne.reflect.PropertyDescriptor; import org.apache.cayenne.reflect.PropertyUtils; +import org.apache.cayenne.reflect.ToManyMapProperty; import org.apache.cayenne.validation.BeanValidationFailure; import org.apache.cayenne.validation.ValidationFailure; import org.apache.cayenne.validation.ValidationResult; @@ -65,11 +68,57 @@ import org.apache.cayenne.validation.ValidationResult; * * @since 4.1 */ -public abstract class BaseDataObject extends PersistentObject implements DataObject, Validating { +public abstract class BaseDataObject implements DataObject, Validating { private static final long serialVersionUID = 4598677040697008371L; + protected ObjectId objectId; + protected int persistenceState; protected long snapshotVersion = DEFAULT_VERSION; + protected transient ObjectContext objectContext; + + /** + * Creates a new transient object. + */ + public BaseDataObject() { + this.persistenceState = PersistenceState.TRANSIENT; + } + + public int getPersistenceState() { + return persistenceState; + } + + public ObjectContext getObjectContext() { + return objectContext; + } + + public ObjectId getObjectId() { + return objectId; + } + + public void setObjectId(ObjectId objectId) { + this.objectId = objectId; + } + + /** + * Returns a map key for a given to-many map relationship and a target object. + * + * @since 3.0 + */ + protected Object getMapKey(String relationshipName, Object value) { + EntityResolver resolver = objectContext.getEntityResolver(); + ClassDescriptor descriptor = resolver.getClassDescriptor(objectId.getEntityName()); + if (descriptor == null) { + throw new IllegalStateException("DataObject's entity is unmapped, objectId: " + objectId); + } + + PropertyDescriptor property = descriptor.getProperty(relationshipName); + if (property instanceof ToManyMapProperty) { + return ((ToManyMapProperty) property).getMapKey(value); + } + + throw new IllegalArgumentException("Relationship '" + relationshipName + "' is not a to-many Map"); + } @Override public Object readPropertyDirectly(String propName) { @@ -325,11 +374,11 @@ public abstract class BaseDataObject extends PersistentObject implements DataObj if(property == null) { throw new IllegalArgumentException("unknown relName " + relName); } - Collection<DataObject> old = null; + Collection<? extends DataObject> old; if (property instanceof Map) { - old = ((Map) property).values(); + old = ((Map<?, ? extends DataObject>) property).values(); } else if (property instanceof Collection) { - old = (Collection) property; + old = (Collection<? extends DataObject>) property; } else { throw new UnsupportedOperationException("setToManyTarget operates only with Map or Collection types"); } @@ -340,18 +389,17 @@ public abstract class BaseDataObject extends PersistentObject implements DataObj List<DataObject> removedObjects = new ArrayList<>(); // remove all relationships, which are missing in passed collection - Object[] oldValues = old.toArray(); - for (Object obj : oldValues) { + DataObject[] oldValues = old.toArray(new DataObject[0]); + for (DataObject obj : oldValues) { if (!values.contains(obj)) { - DataObject obj2 = (DataObject) obj; - removeToManyTarget(relName, obj2, setReverse); + removeToManyTarget(relName, obj, setReverse); // collect objects whose relationship was removed - removedObjects.add((DataObject) obj2); + removedObjects.add(obj); } } - // dont add elements which are already present - for (Object obj : old) { + // don't add elements which are already present + for (DataObject obj : old) { values.remove(obj); } diff --git a/cayenne/src/main/java/org/apache/cayenne/DataObject.java b/cayenne/src/main/java/org/apache/cayenne/DataObject.java index 0e7b2b660..abe5871df 100644 --- a/cayenne/src/main/java/org/apache/cayenne/DataObject.java +++ b/cayenne/src/main/java/org/apache/cayenne/DataObject.java @@ -24,7 +24,7 @@ package org.apache.cayenne; */ public interface DataObject extends Persistent { - public static final long DEFAULT_VERSION = Long.MIN_VALUE; + long DEFAULT_VERSION = Long.MIN_VALUE; /** * Modifies a value of a named property without altering the object state in any way, @@ -32,14 +32,14 @@ public interface DataObject extends Persistent { * internal use by Cayenne framework, and shouldn't be called from the application * code. */ - public void writePropertyDirectly(String propertyName, Object val); + void writePropertyDirectly(String propertyName, Object val); /** * Returns mapped property value as curently stored in the DataObject. Returned value * maybe a fault or a real value. This method will not attempt to resolve faults, or * to read unmapped properties. */ - public Object readPropertyDirectly(String propertyName); + Object readPropertyDirectly(String propertyName); /** * Returns a value of the property identified by a property path. Supports reading @@ -81,33 +81,33 @@ public interface DataObject extends Persistent { * <br> * </li> * </ul> - * + * * @since 1.0.5 */ - public Object readNestedProperty(String path); + Object readNestedProperty(String path); /** * Returns a value of the property identified by propName. Resolves faults if needed. * This method can safely be used instead of or in addition to the auto-generated * property accessors in subclasses of CayenneDataObject. */ - public Object readProperty(String propName); + Object readProperty(String propName); /** * Sets the property to the new value. Resolves faults if needed. This method can be * safely used instead of or in addition to the auto-generated property modifiers to * set simple properties. Note that to set to-one relationships use * {@link #setToOneTarget(String, DataObject, boolean)}. - * + * * @param propertyName a name of the bean property being modified. - * @param value a new value of the property. + * @param value a new value of the property. */ - public void writeProperty(String propertyName, Object value); + void writeProperty(String propertyName, Object value); /** * Adds an object to a to-many relationship. */ - public void addToManyTarget( + void addToManyTarget( String relationshipName, DataObject target, boolean setReverse); @@ -115,7 +115,7 @@ public interface DataObject extends Persistent { /** * Removes an object from a to-many relationship. */ - public void removeToManyTarget( + void removeToManyTarget( String relationshipName, DataObject target, boolean unsetReverse); @@ -124,27 +124,27 @@ public interface DataObject extends Persistent { * Sets to-one relationship to a new value. Resolves faults if needed. This method can * safely be used instead of or in addition to the auto-generated property modifiers * to set properties that are to-one relationships. - * + * * @param relationshipName a name of the bean property being modified - same as the - * name of ObjRelationship. - * @param value a new value of the property. - * @param setReverse whether to update the reverse relationship pointing from the old - * and new values of the property to this object. + * name of ObjRelationship. + * @param value a new value of the property. + * @param setReverse whether to update the reverse relationship pointing from the old + * and new values of the property to this object. */ - public void setToOneTarget( + void setToOneTarget( String relationshipName, DataObject value, boolean setReverse); /** * Returns a version of a DataRow snapshot that was used to create this object. - * + * * @since 1.1 */ - public long getSnapshotVersion(); + long getSnapshotVersion(); /** * @since 1.1 */ - public void setSnapshotVersion(long snapshotVersion); + void setSnapshotVersion(long snapshotVersion); } diff --git a/cayenne/src/main/java/org/apache/cayenne/PersistentObject.java b/cayenne/src/main/java/org/apache/cayenne/PersistentObject.java index bc0c0863f..84c94cdac 100644 --- a/cayenne/src/main/java/org/apache/cayenne/PersistentObject.java +++ b/cayenne/src/main/java/org/apache/cayenne/PersistentObject.java @@ -98,29 +98,21 @@ public abstract class PersistentObject implements Persistent { return ((ToManyMapProperty) property).getMapKey(value); } - throw new IllegalArgumentException("Relationship '" - + relationshipName - + "' is not a to-many Map"); + throw new IllegalArgumentException("Relationship '" + relationshipName + "' is not a to-many Map"); } @Override public String toString() { - String state = PersistenceState.persistenceStateName(getPersistenceState()); - - StringBuilder buffer = new StringBuilder(); - buffer - .append("<") - .append(getClass().getName()) - .append("@") - .append(System.identityHashCode(this)) - .append(", id=") - .append(objectId) - .append(", state=") - .append(state) - .append(", context=") - .append(objectContext) - .append(">"); - - return buffer.toString(); + return "<" + + getClass().getName() + + "@" + + System.identityHashCode(this) + + ", id=" + + objectId + + ", state=" + + PersistenceState.persistenceStateName(getPersistenceState()) + + ", context=" + + objectContext + + ">"; } } diff --git a/cayenne/src/test/java/org/apache/cayenne/ContextStateRecorderTest.java b/cayenne/src/test/java/org/apache/cayenne/ContextStateRecorderTest.java index 8d4819981..df5cad253 100644 --- a/cayenne/src/test/java/org/apache/cayenne/ContextStateRecorderTest.java +++ b/cayenne/src/test/java/org/apache/cayenne/ContextStateRecorderTest.java @@ -58,7 +58,7 @@ public class ContextStateRecorderTest { assertTrue(recorder.dirtyNodes(PersistenceState.TRANSIENT).isEmpty()); assertTrue(recorder.dirtyNodes(PersistenceState.HOLLOW).isEmpty()); - MockPersistentObject modified = new MockPersistentObject(); + MockDataObject modified = new MockDataObject(); modified.setObjectId(ObjectId.of("MockPersistentObject", "key", "value1")); modified.setPersistenceState(PersistenceState.MODIFIED); @@ -72,7 +72,7 @@ public class ContextStateRecorderTest { assertTrue(recorder.dirtyNodes(PersistenceState.TRANSIENT).isEmpty()); assertTrue(recorder.dirtyNodes(PersistenceState.HOLLOW).isEmpty()); - MockPersistentObject deleted = new MockPersistentObject(); + MockDataObject deleted = new MockDataObject(); deleted.setObjectId(ObjectId.of("MockPersistentObject", "key", "value2")); deleted.setPersistenceState(PersistenceState.DELETED); when(mockGraphManager.getNode(deleted.getObjectId())).thenReturn(deleted); @@ -93,7 +93,7 @@ public class ContextStateRecorderTest { assertTrue(recorder.dirtyNodes().isEmpty()); // introduce a fake dirty object - MockPersistentObject object = new MockPersistentObject(); + MockDataObject object = new MockDataObject(); object.setObjectId(ObjectId.of("MockPersistentObject", "key", "value")); object.setPersistenceState(PersistenceState.MODIFIED); @@ -115,7 +115,7 @@ public class ContextStateRecorderTest { assertFalse(recorder.hasChanges()); // introduce a fake dirty object - MockPersistentObject object = new MockPersistentObject(); + MockDataObject object = new MockDataObject(); object.setObjectId(ObjectId.of("MockPersistentObject", "key", "value")); object.setPersistenceState(PersistenceState.MODIFIED); recorder.nodePropertyChanged(object.getObjectId(), "xyz", "a", "b"); diff --git a/cayenne/src/test/java/org/apache/cayenne/PersistentObjectIT.java b/cayenne/src/test/java/org/apache/cayenne/PersistentObjectIT.java index 9062d63d4..a156e986d 100644 --- a/cayenne/src/test/java/org/apache/cayenne/PersistentObjectIT.java +++ b/cayenne/src/test/java/org/apache/cayenne/PersistentObjectIT.java @@ -35,7 +35,7 @@ public class PersistentObjectIT extends RuntimeCase { @Test public void testObjectContext() { ObjectContext context = mock(ObjectContext.class); - PersistentObject object = new MockPersistentObject(); + Persistent object = new MockPersistentObject(); assertNull(object.getObjectContext()); object.setObjectContext(context); @@ -44,7 +44,7 @@ public class PersistentObjectIT extends RuntimeCase { @Test public void testPersistenceState() { - PersistentObject object = new MockPersistentObject(); + Persistent object = new MockPersistentObject(); assertEquals(PersistenceState.TRANSIENT, object.getPersistenceState()); object.setPersistenceState(PersistenceState.DELETED); assertEquals(PersistenceState.DELETED, object.getPersistenceState()); @@ -54,7 +54,7 @@ public class PersistentObjectIT extends RuntimeCase { public void testObjectID() { ObjectId id = ObjectId.of("test"); - PersistentObject object = new MockPersistentObject(); + Persistent object = new MockPersistentObject(); assertNull(object.getObjectId()); object.setObjectId(id); diff --git a/cayenne/src/test/java/org/apache/cayenne/query/RefreshQueryTest.java b/cayenne/src/test/java/org/apache/cayenne/query/RefreshQueryTest.java index 8e3d7b8e4..605bc6c05 100644 --- a/cayenne/src/test/java/org/apache/cayenne/query/RefreshQueryTest.java +++ b/cayenne/src/test/java/org/apache/cayenne/query/RefreshQueryTest.java @@ -18,7 +18,7 @@ ****************************************************************/ package org.apache.cayenne.query; -import org.apache.cayenne.MockPersistentObject; +import org.apache.cayenne.MockDataObject; import org.apache.cayenne.Persistent; import org.junit.Test; @@ -47,7 +47,7 @@ public class RefreshQueryTest { @Test public void testCollectionConstructor() { - Collection c = new ArrayList(); + Collection<Object> c = new ArrayList<>(); c.add(new Object()); c.add(new Object()); @@ -60,7 +60,7 @@ public class RefreshQueryTest { @Test public void testObjectConstructor() { - Persistent p = new MockPersistentObject(); + Persistent p = new MockDataObject(); RefreshQuery q = new RefreshQuery(p); assertNotNull(q.getObjects()); diff --git a/cayenne/src/test/java/org/apache/cayenne/reflect/LifecycleCallbackEventHandlerTest.java b/cayenne/src/test/java/org/apache/cayenne/reflect/LifecycleCallbackEventHandlerTest.java index 39ff19c83..5bba63bb8 100644 --- a/cayenne/src/test/java/org/apache/cayenne/reflect/LifecycleCallbackEventHandlerTest.java +++ b/cayenne/src/test/java/org/apache/cayenne/reflect/LifecycleCallbackEventHandlerTest.java @@ -18,8 +18,8 @@ ****************************************************************/ package org.apache.cayenne.reflect; +import org.apache.cayenne.BaseDataObject; import org.apache.cayenne.ObjectId; -import org.apache.cayenne.PersistentObject; import org.junit.Test; import java.util.ArrayList; @@ -116,7 +116,7 @@ public class LifecycleCallbackEventHandlerTest { assertEquals("c2Callback", c.callbacks.get(1)); } - static class C1 extends PersistentObject { + static class C1 extends BaseDataObject { protected List callbacks = new ArrayList(); diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/cay_2641/client/ArtistLazy.java b/cayenne/src/test/java/org/apache/cayenne/testdo/cay_2641/client/ArtistLazy.java deleted file mode 100644 index 806af3998..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/cay_2641/client/ArtistLazy.java +++ /dev/null @@ -1,31 +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.testdo.cay_2641.client; - -import org.apache.cayenne.testdo.cay_2641.client.auto._ArtistLazy; - -/** - * A persistent class mapped as "ArtistLazy" Cayenne entity. - */ -public class ArtistLazy extends _ArtistLazy { - - private static final long serialVersionUID = 1L; - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/cay_2641/client/PaintingLazy.java b/cayenne/src/test/java/org/apache/cayenne/testdo/cay_2641/client/PaintingLazy.java deleted file mode 100644 index 1bd04bed2..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/cay_2641/client/PaintingLazy.java +++ /dev/null @@ -1,31 +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.testdo.cay_2641.client; - -import org.apache.cayenne.testdo.cay_2641.client.auto._PaintingLazy; - -/** - * A persistent class mapped as "PaintingLazy" Cayenne entity. - */ -public class PaintingLazy extends _PaintingLazy { - - private static final long serialVersionUID = 1L; - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/cay_2641/client/auto/_ArtistLazy.java b/cayenne/src/test/java/org/apache/cayenne/testdo/cay_2641/client/auto/_ArtistLazy.java deleted file mode 100644 index ec1111db4..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/cay_2641/client/auto/_ArtistLazy.java +++ /dev/null @@ -1,113 +0,0 @@ -package org.apache.cayenne.testdo.cay_2641.client.auto; - -import java.util.List; - -import org.apache.cayenne.Fault; -import org.apache.cayenne.PersistentObject; -import org.apache.cayenne.exp.property.ListProperty; -import org.apache.cayenne.exp.property.PropertyFactory; -import org.apache.cayenne.exp.property.StringProperty; -import org.apache.cayenne.testdo.cay_2641.client.PaintingLazy; -import org.apache.cayenne.util.PersistentObjectList; - -/** - * A generated persistent class mapped as "ArtistLazy" Cayenne entity. It is a good idea to - * avoid changing this class manually, since it will be overwritten next time code is - * regenerated. If you need to make any customizations, put them in a subclass. - */ -public abstract class _ArtistLazy extends PersistentObject { - - public static final StringProperty<String> NAME = PropertyFactory.createString("name", String.class); - public static final StringProperty<String> SURNAME = PropertyFactory.createString("surname", String.class); - public static final ListProperty<PaintingLazy> PAINTINGS = PropertyFactory.createList("paintings", PaintingLazy.class); - - protected Object name; - protected String surname; - protected List<PaintingLazy> paintings; - - public String getName() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "name", false); - } - - if(this.name instanceof Fault) { - this.name = ((Fault) this.name).resolveFault(this, "name"); - } - - return (String) name; - } - - public void setName(String name) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "name", false); - objectContext.propertyChanged(this, "name", this.name, name); - } - - this.name = name; - } - - public String getSurname() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "surname", false); - } - - - return surname; - } - - public void setSurname(String surname) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "surname", false); - objectContext.propertyChanged(this, "surname", this.surname, surname); - } - - this.surname = surname; - } - - public List<PaintingLazy> getPaintings() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "paintings", true); - } else if (this.paintings == null) { - this.paintings = new PersistentObjectList<>(this, "paintings"); - } - - return paintings; - } - - public void addToPaintings(PaintingLazy object) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "paintings", true); - } else if (this.paintings == null) { - this.paintings = new PersistentObjectList<>(this, "paintings"); - } - - this.paintings.add(object); - } - - public void removeFromPaintings(PaintingLazy object) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "paintings", true); - } else if (this.paintings == null) { - this.paintings = new PersistentObjectList<>(this, "paintings"); - } - - this.paintings.remove(object); - } - - public Object readPropertyDirectly(String propName) { - if(propName == null) { - throw new IllegalArgumentException(); - } - - switch(propName) { - case "name": - return this.name; - case "surname": - return this.surname; - case "paintings": - return this.paintings; - default: - return null; - } - } -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/cay_2641/client/auto/_PaintingLazy.java b/cayenne/src/test/java/org/apache/cayenne/testdo/cay_2641/client/auto/_PaintingLazy.java deleted file mode 100644 index 29e52dc62..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/cay_2641/client/auto/_PaintingLazy.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.apache.cayenne.testdo.cay_2641.client.auto; - -import org.apache.cayenne.Fault; -import org.apache.cayenne.PersistentObject; -import org.apache.cayenne.ValueHolder; -import org.apache.cayenne.exp.property.EntityProperty; -import org.apache.cayenne.exp.property.PropertyFactory; -import org.apache.cayenne.exp.property.StringProperty; -import org.apache.cayenne.testdo.cay_2641.client.ArtistLazy; -import org.apache.cayenne.util.PersistentObjectHolder; - -/** - * A generated persistent class mapped as "PaintingLazy" Cayenne entity. It is a good idea to - * avoid changing this class manually, since it will be overwritten next time code is - * regenerated. If you need to make any customizations, put them in a subclass. - */ -public abstract class _PaintingLazy extends PersistentObject { - - public static final StringProperty<String> NAME = PropertyFactory.createString("name", String.class); - public static final EntityProperty<ArtistLazy> ARTIST = PropertyFactory.createEntity("artist", ArtistLazy.class); - - protected Object name; - protected ValueHolder<ArtistLazy> artist; - - public String getName() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "name", false); - } - - if(this.name instanceof Fault) { - this.name = ((Fault) this.name).resolveFault(this, "name"); - } - - return (String) name; - } - - public void setName(String name) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "name", false); - objectContext.propertyChanged(this, "name", this.name, name); - } - - this.name = name; - } - - public ArtistLazy getArtist() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "artist", true); - } else if (this.artist == null) { - this.artist = new PersistentObjectHolder<>(this, "artist"); - } - - return artist.getValue(); - } - - public void setArtist(ArtistLazy artist) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "artist", true); - } else if (this.artist == null) { - this.artist = new PersistentObjectHolder<>(this, "artist"); - } - - this.artist.setValue(artist); - } - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/ClientDeleteCascade.java b/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/ClientDeleteCascade.java deleted file mode 100644 index 11fb652da..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/ClientDeleteCascade.java +++ /dev/null @@ -1,28 +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.testdo.deleterules; - -import org.apache.cayenne.testdo.deleterules.auto._ClientDeleteCascade; - -/** - * A persistent class mapped as "DeleteCascade" Cayenne entity. - */ -public class ClientDeleteCascade extends _ClientDeleteCascade { - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/ClientDeleteDeny.java b/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/ClientDeleteDeny.java deleted file mode 100644 index 407bb1b62..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/ClientDeleteDeny.java +++ /dev/null @@ -1,28 +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.testdo.deleterules; - -import org.apache.cayenne.testdo.deleterules.auto._ClientDeleteDeny; - -/** - * A persistent class mapped as "DeleteDeny" Cayenne entity. - */ -public class ClientDeleteDeny extends _ClientDeleteDeny { - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/ClientDeleteNullify.java b/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/ClientDeleteNullify.java deleted file mode 100644 index 522f6b2b9..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/ClientDeleteNullify.java +++ /dev/null @@ -1,28 +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.testdo.deleterules; - -import org.apache.cayenne.testdo.deleterules.auto._ClientDeleteNullify; - -/** - * A persistent class mapped as "DeleteNullify" Cayenne entity. - */ -public class ClientDeleteNullify extends _ClientDeleteNullify { - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/ClientDeleteRule.java b/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/ClientDeleteRule.java deleted file mode 100644 index 48f1ed779..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/ClientDeleteRule.java +++ /dev/null @@ -1,28 +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.testdo.deleterules; - -import org.apache.cayenne.testdo.deleterules.auto._ClientDeleteRule; - -/** - * A persistent class mapped as "DeleteRule" Cayenne entity. - */ -public class ClientDeleteRule extends _ClientDeleteRule { - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/DeleteCascade.java b/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/DeleteCascade.java deleted file mode 100644 index 48f6e0c61..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/DeleteCascade.java +++ /dev/null @@ -1,28 +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.testdo.deleterules; - -import org.apache.cayenne.testdo.deleterules.auto._DeleteCascade; - -public class DeleteCascade extends _DeleteCascade { - -} - - - diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/DeleteDeny.java b/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/DeleteDeny.java deleted file mode 100644 index 180476826..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/DeleteDeny.java +++ /dev/null @@ -1,28 +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.testdo.deleterules; - -import org.apache.cayenne.testdo.deleterules.auto._DeleteDeny; - -public class DeleteDeny extends _DeleteDeny { - -} - - - diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/DeleteNullify.java b/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/DeleteNullify.java deleted file mode 100644 index f4e8d1d8c..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/DeleteNullify.java +++ /dev/null @@ -1,28 +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.testdo.deleterules; - -import org.apache.cayenne.testdo.deleterules.auto._DeleteNullify; - -public class DeleteNullify extends _DeleteNullify { - -} - - - diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/DeleteRule.java b/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/DeleteRule.java deleted file mode 100644 index 03931ccfa..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/DeleteRule.java +++ /dev/null @@ -1,28 +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.testdo.deleterules; - -import org.apache.cayenne.testdo.deleterules.auto._DeleteRule; - -public class DeleteRule extends _DeleteRule { - -} - - - diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/auto/_ClientDeleteCascade.java b/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/auto/_ClientDeleteCascade.java deleted file mode 100644 index 4cc341e2a..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/auto/_ClientDeleteCascade.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.apache.cayenne.testdo.deleterules.auto; - -import org.apache.cayenne.PersistentObject; -import org.apache.cayenne.ValueHolder; -import org.apache.cayenne.testdo.deleterules.ClientDeleteRule; - -/** - * A generated persistent class mapped as "DeleteCascade" Cayenne entity. It is a good idea to - * avoid changing this class manually, since it will be overwritten next time code is - * regenerated. If you need to make any customizations, put them in a subclass. - */ -public abstract class _ClientDeleteCascade extends PersistentObject { - - public static final String NAME_PROPERTY = "name"; - public static final String CASCADE_PROPERTY = "cascade"; - - protected String name; - protected ValueHolder cascade; - - public String getName() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "name", false); - } - - return name; - } - public void setName(String name) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "name", false); - } - - Object oldValue = this.name; - this.name = name; - - // notify objectContext about simple property change - if(objectContext != null) { - objectContext.propertyChanged(this, "name", oldValue, name); - } - } - - public ClientDeleteRule getCascade() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "cascade", true); - } - - return (ClientDeleteRule) cascade.getValue(); - } - public void setCascade(ClientDeleteRule cascade) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "cascade", true); - } - - this.cascade.setValue(cascade); - } - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/auto/_ClientDeleteDeny.java b/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/auto/_ClientDeleteDeny.java deleted file mode 100644 index f16dded9d..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/auto/_ClientDeleteDeny.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.apache.cayenne.testdo.deleterules.auto; - -import org.apache.cayenne.PersistentObject; -import org.apache.cayenne.ValueHolder; -import org.apache.cayenne.testdo.deleterules.ClientDeleteRule; - -/** - * A generated persistent class mapped as "DeleteDeny" Cayenne entity. It is a good idea to - * avoid changing this class manually, since it will be overwritten next time code is - * regenerated. If you need to make any customizations, put them in a subclass. - */ -public abstract class _ClientDeleteDeny extends PersistentObject { - - public static final String NAME_PROPERTY = "name"; - public static final String DENY_PROPERTY = "deny"; - - protected String name; - protected ValueHolder deny; - - public String getName() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "name", false); - } - - return name; - } - public void setName(String name) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "name", false); - } - - Object oldValue = this.name; - this.name = name; - - // notify objectContext about simple property change - if(objectContext != null) { - objectContext.propertyChanged(this, "name", oldValue, name); - } - } - - public ClientDeleteRule getDeny() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "deny", true); - } - - return (ClientDeleteRule) deny.getValue(); - } - public void setDeny(ClientDeleteRule deny) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "deny", true); - } - - this.deny.setValue(deny); - } - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/auto/_ClientDeleteNullify.java b/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/auto/_ClientDeleteNullify.java deleted file mode 100644 index 3abc65e27..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/auto/_ClientDeleteNullify.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.apache.cayenne.testdo.deleterules.auto; - -import org.apache.cayenne.PersistentObject; -import org.apache.cayenne.ValueHolder; -import org.apache.cayenne.testdo.deleterules.ClientDeleteRule; - -/** - * A generated persistent class mapped as "DeleteNullify" Cayenne entity. It is a good idea to - * avoid changing this class manually, since it will be overwritten next time code is - * regenerated. If you need to make any customizations, put them in a subclass. - */ -public abstract class _ClientDeleteNullify extends PersistentObject { - - public static final String NAME_PROPERTY = "name"; - public static final String NULLIFY_PROPERTY = "nullify"; - - protected String name; - protected ValueHolder nullify; - - public String getName() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "name", false); - } - - return name; - } - public void setName(String name) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "name", false); - } - - Object oldValue = this.name; - this.name = name; - - // notify objectContext about simple property change - if(objectContext != null) { - objectContext.propertyChanged(this, "name", oldValue, name); - } - } - - public ClientDeleteRule getNullify() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "nullify", true); - } - - return (ClientDeleteRule) nullify.getValue(); - } - public void setNullify(ClientDeleteRule nullify) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "nullify", true); - } - - this.nullify.setValue(nullify); - } - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/auto/_ClientDeleteRule.java b/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/auto/_ClientDeleteRule.java deleted file mode 100644 index e42946b46..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/auto/_ClientDeleteRule.java +++ /dev/null @@ -1,114 +0,0 @@ -package org.apache.cayenne.testdo.deleterules.auto; - -import org.apache.cayenne.PersistentObject; -import org.apache.cayenne.testdo.deleterules.ClientDeleteCascade; -import org.apache.cayenne.testdo.deleterules.ClientDeleteDeny; -import org.apache.cayenne.testdo.deleterules.ClientDeleteNullify; - -import java.util.List; - -/** - * A generated persistent class mapped as "DeleteRule" Cayenne entity. It is a good idea to - * avoid changing this class manually, since it will be overwritten next time code is - * regenerated. If you need to make any customizations, put them in a subclass. - */ -public abstract class _ClientDeleteRule extends PersistentObject { - - public static final String NAME_PROPERTY = "name"; - public static final String FROM_CASCADE_PROPERTY = "fromCascade"; - public static final String FROM_DENY_PROPERTY = "fromDeny"; - public static final String FROM_NULLIFY_PROPERTY = "fromNullify"; - - protected String name; - protected List<ClientDeleteCascade> fromCascade; - protected List<ClientDeleteDeny> fromDeny; - protected List<ClientDeleteNullify> fromNullify; - - public String getName() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "name", false); - } - - return name; - } - public void setName(String name) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "name", false); - } - - Object oldValue = this.name; - this.name = name; - - // notify objectContext about simple property change - if(objectContext != null) { - objectContext.propertyChanged(this, "name", oldValue, name); - } - } - - public List<ClientDeleteCascade> getFromCascade() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "fromCascade", true); - } - - return fromCascade; - } - public void addToFromCascade(ClientDeleteCascade object) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "fromCascade", true); - } - - this.fromCascade.add(object); - } - public void removeFromFromCascade(ClientDeleteCascade object) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "fromCascade", true); - } - - this.fromCascade.remove(object); - } - - public List<ClientDeleteDeny> getFromDeny() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "fromDeny", true); - } - - return fromDeny; - } - public void addToFromDeny(ClientDeleteDeny object) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "fromDeny", true); - } - - this.fromDeny.add(object); - } - public void removeFromFromDeny(ClientDeleteDeny object) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "fromDeny", true); - } - - this.fromDeny.remove(object); - } - - public List<ClientDeleteNullify> getFromNullify() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "fromNullify", true); - } - - return fromNullify; - } - public void addToFromNullify(ClientDeleteNullify object) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "fromNullify", true); - } - - this.fromNullify.add(object); - } - public void removeFromFromNullify(ClientDeleteNullify object) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "fromNullify", true); - } - - this.fromNullify.remove(object); - } - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/auto/_DeleteCascade.java b/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/auto/_DeleteCascade.java deleted file mode 100644 index bb38890a8..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/auto/_DeleteCascade.java +++ /dev/null @@ -1,109 +0,0 @@ -package org.apache.cayenne.testdo.deleterules.auto; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - -import org.apache.cayenne.BaseDataObject; -import org.apache.cayenne.exp.ExpressionFactory; -import org.apache.cayenne.exp.property.EntityProperty; -import org.apache.cayenne.exp.property.NumericProperty; -import org.apache.cayenne.exp.property.PropertyFactory; -import org.apache.cayenne.exp.property.StringProperty; -import org.apache.cayenne.testdo.deleterules.DeleteRule; - -/** - * Class _DeleteCascade 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 _DeleteCascade extends BaseDataObject { - - private static final long serialVersionUID = 1L; - - public static final NumericProperty<Integer> DELETE_CASCADE_ID_PK_PROPERTY = PropertyFactory.createNumeric(ExpressionFactory.dbPathExp("DELETE_CASCADE_ID"), Integer.class); - public static final String DELETE_CASCADE_ID_PK_COLUMN = "DELETE_CASCADE_ID"; - - public static final StringProperty<String> NAME = PropertyFactory.createString("name", String.class); - public static final EntityProperty<DeleteRule> CASCADE = PropertyFactory.createEntity("cascade", DeleteRule.class); - - protected String name; - - protected Object cascade; - - public void setName(String name) { - beforePropertyWrite("name", this.name, name); - this.name = name; - } - - public String getName() { - beforePropertyRead("name"); - return this.name; - } - - public void setCascade(DeleteRule cascade) { - setToOneTarget("cascade", cascade, true); - } - - public DeleteRule getCascade() { - return (DeleteRule)readProperty("cascade"); - } - - @Override - public Object readPropertyDirectly(String propName) { - if(propName == null) { - throw new IllegalArgumentException(); - } - - switch(propName) { - case "name": - return this.name; - case "cascade": - return this.cascade; - default: - return super.readPropertyDirectly(propName); - } - } - - @Override - public void writePropertyDirectly(String propName, Object val) { - if(propName == null) { - throw new IllegalArgumentException(); - } - - switch (propName) { - case "name": - this.name = (String)val; - break; - case "cascade": - this.cascade = val; - break; - default: - super.writePropertyDirectly(propName, val); - } - } - - private void writeObject(ObjectOutputStream out) throws IOException { - writeSerialized(out); - } - - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { - readSerialized(in); - } - - @Override - protected void writeState(ObjectOutputStream out) throws IOException { - super.writeState(out); - out.writeObject(this.name); - out.writeObject(this.cascade); - } - - @Override - protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException { - super.readState(in); - this.name = (String)in.readObject(); - this.cascade = in.readObject(); - } - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/auto/_DeleteDeny.java b/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/auto/_DeleteDeny.java deleted file mode 100644 index 9cc2aa769..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/auto/_DeleteDeny.java +++ /dev/null @@ -1,109 +0,0 @@ -package org.apache.cayenne.testdo.deleterules.auto; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - -import org.apache.cayenne.BaseDataObject; -import org.apache.cayenne.exp.ExpressionFactory; -import org.apache.cayenne.exp.property.EntityProperty; -import org.apache.cayenne.exp.property.NumericProperty; -import org.apache.cayenne.exp.property.PropertyFactory; -import org.apache.cayenne.exp.property.StringProperty; -import org.apache.cayenne.testdo.deleterules.DeleteRule; - -/** - * Class _DeleteDeny 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 _DeleteDeny extends BaseDataObject { - - private static final long serialVersionUID = 1L; - - public static final NumericProperty<Integer> DELETE_DENY_ID_PK_PROPERTY = PropertyFactory.createNumeric(ExpressionFactory.dbPathExp("DELETE_DENY_ID"), Integer.class); - public static final String DELETE_DENY_ID_PK_COLUMN = "DELETE_DENY_ID"; - - public static final StringProperty<String> NAME = PropertyFactory.createString("name", String.class); - public static final EntityProperty<DeleteRule> DENY = PropertyFactory.createEntity("deny", DeleteRule.class); - - protected String name; - - protected Object deny; - - public void setName(String name) { - beforePropertyWrite("name", this.name, name); - this.name = name; - } - - public String getName() { - beforePropertyRead("name"); - return this.name; - } - - public void setDeny(DeleteRule deny) { - setToOneTarget("deny", deny, true); - } - - public DeleteRule getDeny() { - return (DeleteRule)readProperty("deny"); - } - - @Override - public Object readPropertyDirectly(String propName) { - if(propName == null) { - throw new IllegalArgumentException(); - } - - switch(propName) { - case "name": - return this.name; - case "deny": - return this.deny; - default: - return super.readPropertyDirectly(propName); - } - } - - @Override - public void writePropertyDirectly(String propName, Object val) { - if(propName == null) { - throw new IllegalArgumentException(); - } - - switch (propName) { - case "name": - this.name = (String)val; - break; - case "deny": - this.deny = val; - break; - default: - super.writePropertyDirectly(propName, val); - } - } - - private void writeObject(ObjectOutputStream out) throws IOException { - writeSerialized(out); - } - - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { - readSerialized(in); - } - - @Override - protected void writeState(ObjectOutputStream out) throws IOException { - super.writeState(out); - out.writeObject(this.name); - out.writeObject(this.deny); - } - - @Override - protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException { - super.readState(in); - this.name = (String)in.readObject(); - this.deny = in.readObject(); - } - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/auto/_DeleteNullify.java b/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/auto/_DeleteNullify.java deleted file mode 100644 index 13cd0f8fd..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/auto/_DeleteNullify.java +++ /dev/null @@ -1,109 +0,0 @@ -package org.apache.cayenne.testdo.deleterules.auto; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - -import org.apache.cayenne.BaseDataObject; -import org.apache.cayenne.exp.ExpressionFactory; -import org.apache.cayenne.exp.property.EntityProperty; -import org.apache.cayenne.exp.property.NumericProperty; -import org.apache.cayenne.exp.property.PropertyFactory; -import org.apache.cayenne.exp.property.StringProperty; -import org.apache.cayenne.testdo.deleterules.DeleteRule; - -/** - * Class _DeleteNullify 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 _DeleteNullify extends BaseDataObject { - - private static final long serialVersionUID = 1L; - - public static final NumericProperty<Integer> DELETE_NULLIFY_ID_PK_PROPERTY = PropertyFactory.createNumeric(ExpressionFactory.dbPathExp("DELETE_NULLIFY_ID"), Integer.class); - public static final String DELETE_NULLIFY_ID_PK_COLUMN = "DELETE_NULLIFY_ID"; - - public static final StringProperty<String> NAME = PropertyFactory.createString("name", String.class); - public static final EntityProperty<DeleteRule> NULLIFY = PropertyFactory.createEntity("nullify", DeleteRule.class); - - protected String name; - - protected Object nullify; - - public void setName(String name) { - beforePropertyWrite("name", this.name, name); - this.name = name; - } - - public String getName() { - beforePropertyRead("name"); - return this.name; - } - - public void setNullify(DeleteRule nullify) { - setToOneTarget("nullify", nullify, true); - } - - public DeleteRule getNullify() { - return (DeleteRule)readProperty("nullify"); - } - - @Override - public Object readPropertyDirectly(String propName) { - if(propName == null) { - throw new IllegalArgumentException(); - } - - switch(propName) { - case "name": - return this.name; - case "nullify": - return this.nullify; - default: - return super.readPropertyDirectly(propName); - } - } - - @Override - public void writePropertyDirectly(String propName, Object val) { - if(propName == null) { - throw new IllegalArgumentException(); - } - - switch (propName) { - case "name": - this.name = (String)val; - break; - case "nullify": - this.nullify = val; - break; - default: - super.writePropertyDirectly(propName, val); - } - } - - private void writeObject(ObjectOutputStream out) throws IOException { - writeSerialized(out); - } - - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { - readSerialized(in); - } - - @Override - protected void writeState(ObjectOutputStream out) throws IOException { - super.writeState(out); - out.writeObject(this.name); - out.writeObject(this.nullify); - } - - @Override - protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException { - super.readState(in); - this.name = (String)in.readObject(); - this.nullify = in.readObject(); - } - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/auto/_DeleteRule.java b/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/auto/_DeleteRule.java deleted file mode 100644 index 5a0f5a280..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/deleterules/auto/_DeleteRule.java +++ /dev/null @@ -1,161 +0,0 @@ -package org.apache.cayenne.testdo.deleterules.auto; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.util.List; - -import org.apache.cayenne.BaseDataObject; -import org.apache.cayenne.exp.ExpressionFactory; -import org.apache.cayenne.exp.property.ListProperty; -import org.apache.cayenne.exp.property.NumericProperty; -import org.apache.cayenne.exp.property.PropertyFactory; -import org.apache.cayenne.exp.property.StringProperty; -import org.apache.cayenne.testdo.deleterules.DeleteCascade; -import org.apache.cayenne.testdo.deleterules.DeleteDeny; -import org.apache.cayenne.testdo.deleterules.DeleteNullify; - -/** - * Class _DeleteRule 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 _DeleteRule extends BaseDataObject { - - private static final long serialVersionUID = 1L; - - public static final NumericProperty<Integer> DELETE_RULE_ID_PK_PROPERTY = PropertyFactory.createNumeric(ExpressionFactory.dbPathExp("DELETE_RULE_ID"), Integer.class); - public static final String DELETE_RULE_ID_PK_COLUMN = "DELETE_RULE_ID"; - - public static final StringProperty<String> NAME = PropertyFactory.createString("name", String.class); - public static final ListProperty<DeleteCascade> FROM_CASCADE = PropertyFactory.createList("fromCascade", DeleteCascade.class); - public static final ListProperty<DeleteDeny> FROM_DENY = PropertyFactory.createList("fromDeny", DeleteDeny.class); - public static final ListProperty<DeleteNullify> FROM_NULLIFY = PropertyFactory.createList("fromNullify", DeleteNullify.class); - - protected String name; - - protected Object fromCascade; - protected Object fromDeny; - protected Object fromNullify; - - public void setName(String name) { - beforePropertyWrite("name", this.name, name); - this.name = name; - } - - public String getName() { - beforePropertyRead("name"); - return this.name; - } - - public void addToFromCascade(DeleteCascade obj) { - addToManyTarget("fromCascade", obj, true); - } - - public void removeFromFromCascade(DeleteCascade obj) { - removeToManyTarget("fromCascade", obj, true); - } - - @SuppressWarnings("unchecked") - public List<DeleteCascade> getFromCascade() { - return (List<DeleteCascade>)readProperty("fromCascade"); - } - - public void addToFromDeny(DeleteDeny obj) { - addToManyTarget("fromDeny", obj, true); - } - - public void removeFromFromDeny(DeleteDeny obj) { - removeToManyTarget("fromDeny", obj, true); - } - - @SuppressWarnings("unchecked") - public List<DeleteDeny> getFromDeny() { - return (List<DeleteDeny>)readProperty("fromDeny"); - } - - public void addToFromNullify(DeleteNullify obj) { - addToManyTarget("fromNullify", obj, true); - } - - public void removeFromFromNullify(DeleteNullify obj) { - removeToManyTarget("fromNullify", obj, true); - } - - @SuppressWarnings("unchecked") - public List<DeleteNullify> getFromNullify() { - return (List<DeleteNullify>)readProperty("fromNullify"); - } - - @Override - public Object readPropertyDirectly(String propName) { - if(propName == null) { - throw new IllegalArgumentException(); - } - - switch(propName) { - case "name": - return this.name; - case "fromCascade": - return this.fromCascade; - case "fromDeny": - return this.fromDeny; - case "fromNullify": - return this.fromNullify; - default: - return super.readPropertyDirectly(propName); - } - } - - @Override - public void writePropertyDirectly(String propName, Object val) { - if(propName == null) { - throw new IllegalArgumentException(); - } - - switch (propName) { - case "name": - this.name = (String)val; - break; - case "fromCascade": - this.fromCascade = val; - break; - case "fromDeny": - this.fromDeny = val; - break; - case "fromNullify": - this.fromNullify = val; - break; - default: - super.writePropertyDirectly(propName, val); - } - } - - private void writeObject(ObjectOutputStream out) throws IOException { - writeSerialized(out); - } - - private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { - readSerialized(in); - } - - @Override - protected void writeState(ObjectOutputStream out) throws IOException { - super.writeState(out); - out.writeObject(this.name); - out.writeObject(this.fromCascade); - out.writeObject(this.fromDeny); - out.writeObject(this.fromNullify); - } - - @Override - protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException { - super.readState(in); - this.name = (String)in.readObject(); - this.fromCascade = in.readObject(); - this.fromDeny = in.readObject(); - this.fromNullify = in.readObject(); - } - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/lifecycles/ClientLifecycles.java b/cayenne/src/test/java/org/apache/cayenne/testdo/lifecycles/ClientLifecycles.java deleted file mode 100644 index af89b66f9..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/lifecycles/ClientLifecycles.java +++ /dev/null @@ -1,28 +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.testdo.lifecycles; - -import org.apache.cayenne.testdo.lifecycles.auto._ClientLifecycles; - -/** - * A persistent class mapped as "Lifecycles" Cayenne entity. - */ -public class ClientLifecycles extends _ClientLifecycles { - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/lifecycles/auto/_ClientLifecycles.java b/cayenne/src/test/java/org/apache/cayenne/testdo/lifecycles/auto/_ClientLifecycles.java deleted file mode 100644 index fa9ccd29b..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/lifecycles/auto/_ClientLifecycles.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.apache.cayenne.testdo.lifecycles.auto; - -import org.apache.cayenne.PersistentObject; - -/** - * A generated persistent class mapped as "Lifecycles" Cayenne entity. It is a good idea to - * avoid changing this class manually, since it will be overwritten next time code is - * regenerated. If you need to make any customizations, put them in a subclass. - */ -public abstract class _ClientLifecycles extends PersistentObject { - - public static final String NAME_PROPERTY = "name"; - - protected String name; - - public String getName() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "name", false); - } - - return name; - } - public void setName(String name) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "name", false); - } - - Object oldValue = this.name; - this.name = name; - - // notify objectContext about simple property change - if(objectContext != null) { - objectContext.propertyChanged(this, "name", oldValue, name); - } - } - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/map_to_many/ClientIdMapToMany.java b/cayenne/src/test/java/org/apache/cayenne/testdo/map_to_many/ClientIdMapToMany.java deleted file mode 100644 index 31b90aead..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/map_to_many/ClientIdMapToMany.java +++ /dev/null @@ -1,28 +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.testdo.map_to_many; - -import org.apache.cayenne.testdo.map_to_many.auto._ClientIdMapToMany; - -/** - * A persistent class mapped as "IdMapToMany" Cayenne entity. - */ -public class ClientIdMapToMany extends _ClientIdMapToMany { - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/map_to_many/ClientIdMapToManyTarget.java b/cayenne/src/test/java/org/apache/cayenne/testdo/map_to_many/ClientIdMapToManyTarget.java deleted file mode 100644 index 17aa94744..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/map_to_many/ClientIdMapToManyTarget.java +++ /dev/null @@ -1,28 +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.testdo.map_to_many; - -import org.apache.cayenne.testdo.map_to_many.auto._ClientIdMapToManyTarget; - -/** - * A persistent class mapped as "IdMapToManyTarget" Cayenne entity. - */ -public class ClientIdMapToManyTarget extends _ClientIdMapToManyTarget { - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/map_to_many/auto/_ClientIdMapToMany.java b/cayenne/src/test/java/org/apache/cayenne/testdo/map_to_many/auto/_ClientIdMapToMany.java deleted file mode 100644 index 43ca171c0..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/map_to_many/auto/_ClientIdMapToMany.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.apache.cayenne.testdo.map_to_many.auto; - -import org.apache.cayenne.PersistentObject; -import org.apache.cayenne.testdo.map_to_many.ClientIdMapToManyTarget; - -import java.util.Map; - -/** - * A generated persistent class mapped as "IdMapToMany" Cayenne entity. It is a good idea to - * avoid changing this class manually, since it will be overwritten next time code is - * regenerated. If you need to make any customizations, put them in a subclass. - */ -public abstract class _ClientIdMapToMany extends PersistentObject { - - public static final String TARGETS_PROPERTY = "targets"; - - protected Map<Object, ClientIdMapToManyTarget> targets; - - public Map<Object, ClientIdMapToManyTarget> getTargets() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "targets", true); - } - - return targets; - } - public void addToTargets(ClientIdMapToManyTarget object) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "targets", true); - } - - this.targets.put(getMapKey("targets", object), object); - } - public void removeFromTargets(ClientIdMapToManyTarget object) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "targets", true); - } - - this.targets.remove(getMapKey("targets", object)); - } - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/map_to_many/auto/_ClientIdMapToManyTarget.java b/cayenne/src/test/java/org/apache/cayenne/testdo/map_to_many/auto/_ClientIdMapToManyTarget.java deleted file mode 100644 index e19444769..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/map_to_many/auto/_ClientIdMapToManyTarget.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.apache.cayenne.testdo.map_to_many.auto; - -import org.apache.cayenne.PersistentObject; -import org.apache.cayenne.ValueHolder; -import org.apache.cayenne.testdo.map_to_many.ClientIdMapToMany; - -/** - * A generated persistent class mapped as "IdMapToManyTarget" Cayenne entity. It is a good idea to - * avoid changing this class manually, since it will be overwritten next time code is - * regenerated. If you need to make any customizations, put them in a subclass. - */ -public abstract class _ClientIdMapToManyTarget extends PersistentObject { - - public static final String MAP_TO_MANY_PROPERTY = "mapToMany"; - - protected ValueHolder mapToMany; - - public ClientIdMapToMany getMapToMany() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "mapToMany", true); - } - - return (ClientIdMapToMany) mapToMany.getValue(); - } - public void setMapToMany(ClientIdMapToMany mapToMany) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "mapToMany", true); - } - - this.mapToMany.setValue(mapToMany); - } - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/meaningful_pk/ClientMeaningfulPk.java b/cayenne/src/test/java/org/apache/cayenne/testdo/meaningful_pk/ClientMeaningfulPk.java deleted file mode 100644 index 820381753..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/meaningful_pk/ClientMeaningfulPk.java +++ /dev/null @@ -1,28 +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.testdo.meaningful_pk; - -import org.apache.cayenne.testdo.meaningful_pk.auto._ClientMeaningfulPk; - -/** - * A persistent class mapped as "MeaningfulPk" Cayenne entity. - */ -public class ClientMeaningfulPk extends _ClientMeaningfulPk { - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/meaningful_pk/ClientMeaningfulPkDep2.java b/cayenne/src/test/java/org/apache/cayenne/testdo/meaningful_pk/ClientMeaningfulPkDep2.java deleted file mode 100644 index 7a950b2f8..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/meaningful_pk/ClientMeaningfulPkDep2.java +++ /dev/null @@ -1,31 +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.testdo.meaningful_pk; - -import org.apache.cayenne.testdo.meaningful_pk.auto._ClientMeaningfulPkDep2; - -/** - * A persistent class mapped as "MeaningfulPkDep2" Cayenne entity. - */ -public class ClientMeaningfulPkDep2 extends _ClientMeaningfulPkDep2 { - - private static final long serialVersionUID = 1L; - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/meaningful_pk/auto/_ClientMeaningfulPk.java b/cayenne/src/test/java/org/apache/cayenne/testdo/meaningful_pk/auto/_ClientMeaningfulPk.java deleted file mode 100644 index e5de44839..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/meaningful_pk/auto/_ClientMeaningfulPk.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.apache.cayenne.testdo.meaningful_pk.auto; - -import org.apache.cayenne.PersistentObject; -import org.apache.cayenne.ValueHolder; -import org.apache.cayenne.exp.property.EntityProperty; -import org.apache.cayenne.exp.property.PropertyFactory; -import org.apache.cayenne.exp.property.StringProperty; -import org.apache.cayenne.testdo.meaningful_pk.ClientMeaningfulPkDep2; -import org.apache.cayenne.util.PersistentObjectHolder; - -/** - * A generated persistent class mapped as "MeaningfulPk" Cayenne entity. It is a good idea to - * avoid changing this class manually, since it will be overwritten next time code is - * regenerated. If you need to make any customizations, put them in a subclass. - */ -public abstract class _ClientMeaningfulPk extends PersistentObject { - - public static final StringProperty<String> PK = PropertyFactory.createString("pk", String.class); - public static final EntityProperty<ClientMeaningfulPkDep2> MEANINGFUL_PK_DEP2S = PropertyFactory.createEntity("meaningfulPkDep2s", ClientMeaningfulPkDep2.class); - - protected String pk; - protected ValueHolder<ClientMeaningfulPkDep2> meaningfulPkDep2s; - - public String getPk() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "pk", false); - } - - - return pk; - } - - public void setPk(String pk) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "pk", false); - objectContext.propertyChanged(this, "pk", this.pk, pk); - } - - this.pk = pk; - } - - public ClientMeaningfulPkDep2 getMeaningfulPkDep2s() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "meaningfulPkDep2s", true); - } else if (this.meaningfulPkDep2s == null) { - this.meaningfulPkDep2s = new PersistentObjectHolder<>(this, "meaningfulPkDep2s"); - } - - return meaningfulPkDep2s.getValue(); - } - - public void setMeaningfulPkDep2s(ClientMeaningfulPkDep2 meaningfulPkDep2s) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "meaningfulPkDep2s", true); - } else if (this.meaningfulPkDep2s == null) { - this.meaningfulPkDep2s = new PersistentObjectHolder<>(this, "meaningfulPkDep2s"); - } - - this.meaningfulPkDep2s.setValue(meaningfulPkDep2s); - } - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/meaningful_pk/auto/_ClientMeaningfulPkDep2.java b/cayenne/src/test/java/org/apache/cayenne/testdo/meaningful_pk/auto/_ClientMeaningfulPkDep2.java deleted file mode 100644 index 2e5fafbe6..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/meaningful_pk/auto/_ClientMeaningfulPkDep2.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.apache.cayenne.testdo.meaningful_pk.auto; - -import org.apache.cayenne.PersistentObject; -import org.apache.cayenne.ValueHolder; -import org.apache.cayenne.exp.property.EntityProperty; -import org.apache.cayenne.exp.property.PropertyFactory; -import org.apache.cayenne.exp.property.StringProperty; -import org.apache.cayenne.testdo.meaningful_pk.ClientMeaningfulPk; -import org.apache.cayenne.util.PersistentObjectHolder; - -/** - * A generated persistent class mapped as "MeaningfulPkDep2" Cayenne entity. It is a good idea to - * avoid changing this class manually, since it will be overwritten next time code is - * regenerated. If you need to make any customizations, put them in a subclass. - */ -public abstract class _ClientMeaningfulPkDep2 extends PersistentObject { - - public static final StringProperty<String> DESCR = PropertyFactory.createString("descr", String.class); - public static final StringProperty<String> PK = PropertyFactory.createString("pk", String.class); - public static final EntityProperty<ClientMeaningfulPk> MEANINGFUL_PK = PropertyFactory.createEntity("meaningfulPk", ClientMeaningfulPk.class); - - protected String descr; - protected String pk; - protected ValueHolder<ClientMeaningfulPk> meaningfulPk; - - public String getDescr() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "descr", false); - } - - - return descr; - } - - public void setDescr(String descr) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "descr", false); - objectContext.propertyChanged(this, "descr", this.descr, descr); - } - - this.descr = descr; - } - - public String getPk() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "pk", false); - } - - - return pk; - } - - public void setPk(String pk) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "pk", false); - objectContext.propertyChanged(this, "pk", this.pk, pk); - } - - this.pk = pk; - } - - public ClientMeaningfulPk getMeaningfulPk() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "meaningfulPk", true); - } else if (this.meaningfulPk == null) { - this.meaningfulPk = new PersistentObjectHolder<>(this, "meaningfulPk"); - } - - return meaningfulPk.getValue(); - } - - public void setMeaningfulPk(ClientMeaningfulPk meaningfulPk) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "meaningfulPk", true); - } else if (this.meaningfulPk == null) { - this.meaningfulPk = new PersistentObjectHolder<>(this, "meaningfulPk"); - } - - this.meaningfulPk.setValue(meaningfulPk); - } - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTable1.java b/cayenne/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTable1.java deleted file mode 100644 index 114b90964..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTable1.java +++ /dev/null @@ -1,94 +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.testdo.mt; - -import java.util.List; - -import org.apache.cayenne.Validating; -import org.apache.cayenne.testdo.mt.auto._ClientMtTable1; -import org.apache.cayenne.validation.SimpleValidationFailure; -import org.apache.cayenne.validation.ValidationResult; - -public class ClientMtTable1 extends _ClientMtTable1 implements Validating { - - protected boolean validatedForDelete; - protected boolean validatedForInsert; - protected boolean validatedForUpdate; - protected boolean blow; - - // provide direct access to persistent properties for testing.. - - public String getGlobalAttribute1Direct() { - return globalAttribute1; - } - - public String getServerAttribute1Direct() { - return serverAttribute1; - } - - public List getTable2ArrayDirect() { - return table2Array; - } - - public void resetValidation(boolean blow) { - this.blow = blow; - this.validatedForDelete = false; - this.validatedForInsert = false; - this.validatedForUpdate = false; - } - - public void validateForDelete(ValidationResult validationResult) { - validatedForDelete = true; - - if(blow) { - validationResult.addFailure(new SimpleValidationFailure(this, "test error")); - } - } - - public void validateForInsert(ValidationResult validationResult) { - validatedForInsert = true; - - if(blow) { - validationResult.addFailure(new SimpleValidationFailure(this, "test error")); - } - } - - public void validateForUpdate(ValidationResult validationResult) { - validatedForUpdate = true; - - if(blow) { - validationResult.addFailure(new SimpleValidationFailure(this, "test error")); - } - } - - - public boolean isValidatedForDelete() { - return validatedForDelete; - } - - - public boolean isValidatedForInsert() { - return validatedForInsert; - } - - - public boolean isValidatedForUpdate() { - return validatedForUpdate; - } -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTable1Subclass1.java b/cayenne/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTable1Subclass1.java deleted file mode 100644 index 45a346f98..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTable1Subclass1.java +++ /dev/null @@ -1,28 +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.testdo.mt; - -import org.apache.cayenne.testdo.mt.auto._ClientMtTable1Subclass1; - -/** - * A persistent class mapped as "MtTable1Subclass1" Cayenne entity. - */ -public class ClientMtTable1Subclass1 extends _ClientMtTable1Subclass1 { - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTable1Subclass2.java b/cayenne/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTable1Subclass2.java deleted file mode 100644 index 420cb08ec..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTable1Subclass2.java +++ /dev/null @@ -1,28 +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.testdo.mt; - -import org.apache.cayenne.testdo.mt.auto._ClientMtTable1Subclass2; - -/** - * A persistent class mapped as "MtTable1Subclass2" Cayenne entity. - */ -public class ClientMtTable1Subclass2 extends _ClientMtTable1Subclass2 { - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTable2.java b/cayenne/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTable2.java deleted file mode 100644 index 7879c9cb7..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTable2.java +++ /dev/null @@ -1,29 +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.testdo.mt; - -import org.apache.cayenne.ValueHolder; -import org.apache.cayenne.testdo.mt.auto._ClientMtTable2; - -public class ClientMtTable2 extends _ClientMtTable2 { - - public ValueHolder getTable1Direct() { - return table1; - } -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTable3.java b/cayenne/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTable3.java deleted file mode 100644 index 5e114d734..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTable3.java +++ /dev/null @@ -1,28 +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.testdo.mt; - -import org.apache.cayenne.testdo.mt.auto._ClientMtTable3; - -/** - * A persistent class mapped as "MtTable3" Cayenne entity. - */ -public class ClientMtTable3 extends _ClientMtTable3 { - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTable4.java b/cayenne/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTable4.java deleted file mode 100644 index 3ecad7008..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTable4.java +++ /dev/null @@ -1,28 +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.testdo.mt; - -import org.apache.cayenne.testdo.mt.auto._ClientMtTable4; - -/** - * A persistent class mapped as "MtTable4" Cayenne entity. - */ -public class ClientMtTable4 extends _ClientMtTable4 { - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTable5.java b/cayenne/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTable5.java deleted file mode 100644 index 5375d95dd..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/ClientMtTable5.java +++ /dev/null @@ -1,28 +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.testdo.mt; - -import org.apache.cayenne.testdo.mt.auto._ClientMtTable5; - -/** - * A persistent class mapped as "MtTable5" Cayenne entity. - */ -public class ClientMtTable5 extends _ClientMtTable5 { - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTable1.java b/cayenne/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTable1.java deleted file mode 100644 index e24927202..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTable1.java +++ /dev/null @@ -1,91 +0,0 @@ -package org.apache.cayenne.testdo.mt.auto; - -import java.util.List; - -import org.apache.cayenne.PersistentObject; -import org.apache.cayenne.exp.property.ListProperty; -import org.apache.cayenne.exp.property.PropertyFactory; -import org.apache.cayenne.exp.property.StringProperty; -import org.apache.cayenne.testdo.mt.ClientMtTable2; -import org.apache.cayenne.util.PersistentObjectList; - -/** - * A generated persistent class mapped as "MtTable1" Cayenne entity. It is a good idea to - * avoid changing this class manually, since it will be overwritten next time code is - * regenerated. If you need to make any customizations, put them in a subclass. - */ -public abstract class _ClientMtTable1 extends PersistentObject { - - public static final StringProperty<String> GLOBAL_ATTRIBUTE1 = PropertyFactory.createString("globalAttribute1", String.class); - public static final StringProperty<String> SERVER_ATTRIBUTE1 = PropertyFactory.createString("serverAttribute1", String.class); - public static final ListProperty<ClientMtTable2> TABLE2ARRAY = PropertyFactory.createList("table2Array", ClientMtTable2.class); - - protected String globalAttribute1; - protected String serverAttribute1; - protected List<ClientMtTable2> table2Array; - - public String getGlobalAttribute1() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "globalAttribute1", false); - } - - return globalAttribute1; - } - - public void setGlobalAttribute1(String globalAttribute1) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "globalAttribute1", false); - objectContext.propertyChanged(this, "globalAttribute1", this.globalAttribute1, globalAttribute1); - } - - this.globalAttribute1 = globalAttribute1; - } - - public String getServerAttribute1() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "serverAttribute1", false); - } - - return serverAttribute1; - } - - public void setServerAttribute1(String serverAttribute1) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "serverAttribute1", false); - objectContext.propertyChanged(this, "serverAttribute1", this.serverAttribute1, serverAttribute1); - } - - this.serverAttribute1 = serverAttribute1; - } - - public List<ClientMtTable2> getTable2Array() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "table2Array", true); - } else if (this.table2Array == null) { - this.table2Array = new PersistentObjectList<>(this, "table2Array"); - } - - return table2Array; - } - - public void addToTable2Array(ClientMtTable2 object) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "table2Array", true); - } else if (this.table2Array == null) { - this.table2Array = new PersistentObjectList<>(this, "table2Array"); - } - - this.table2Array.add(object); - } - - public void removeFromTable2Array(ClientMtTable2 object) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "table2Array", true); - } else if (this.table2Array == null) { - this.table2Array = new PersistentObjectList<>(this, "table2Array"); - } - - this.table2Array.remove(object); - } - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTable1Subclass1.java b/cayenne/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTable1Subclass1.java deleted file mode 100644 index b54bf1bd6..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTable1Subclass1.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.apache.cayenne.testdo.mt.auto; - -import org.apache.cayenne.exp.property.PropertyFactory; -import org.apache.cayenne.exp.property.StringProperty; -import org.apache.cayenne.testdo.mt.ClientMtTable1; - -/** - * A generated persistent class mapped as "MtTable1Subclass1" Cayenne entity. It is a good idea to - * avoid changing this class manually, since it will be overwritten next time code is - * regenerated. If you need to make any customizations, put them in a subclass. - */ -public abstract class _ClientMtTable1Subclass1 extends ClientMtTable1 { - - public static final StringProperty<String> SUBCLASS1ATTRIBUTE1 = PropertyFactory.createString("subclass1Attribute1", String.class); - - protected String subclass1Attribute1; - - public String getSubclass1Attribute1() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "subclass1Attribute1", false); - } - - return subclass1Attribute1; - } - - public void setSubclass1Attribute1(String subclass1Attribute1) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "subclass1Attribute1", false); - objectContext.propertyChanged(this, "subclass1Attribute1", this.subclass1Attribute1, subclass1Attribute1); - } - - this.subclass1Attribute1 = subclass1Attribute1; - } - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTable1Subclass2.java b/cayenne/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTable1Subclass2.java deleted file mode 100644 index e4efeb5e1..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTable1Subclass2.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.apache.cayenne.testdo.mt.auto; - -import org.apache.cayenne.exp.property.PropertyFactory; -import org.apache.cayenne.exp.property.StringProperty; -import org.apache.cayenne.testdo.mt.ClientMtTable1; - -/** - * A generated persistent class mapped as "MtTable1Subclass2" Cayenne entity. It is a good idea to - * avoid changing this class manually, since it will be overwritten next time code is - * regenerated. If you need to make any customizations, put them in a subclass. - */ -public abstract class _ClientMtTable1Subclass2 extends ClientMtTable1 { - - public static final StringProperty<String> SUBCLASS2ATTRIBUTE1 = PropertyFactory.createString("subclass2Attribute1", String.class); - - protected String subclass2Attribute1; - - public String getSubclass2Attribute1() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "subclass2Attribute1", false); - } - - return subclass2Attribute1; - } - - public void setSubclass2Attribute1(String subclass2Attribute1) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "subclass2Attribute1", false); - objectContext.propertyChanged(this, "subclass2Attribute1", this.subclass2Attribute1, subclass2Attribute1); - } - - this.subclass2Attribute1 = subclass2Attribute1; - } - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTable2.java b/cayenne/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTable2.java deleted file mode 100644 index 77c9b6022..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTable2.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.apache.cayenne.testdo.mt.auto; - -import org.apache.cayenne.PersistentObject; -import org.apache.cayenne.ValueHolder; -import org.apache.cayenne.exp.property.EntityProperty; -import org.apache.cayenne.exp.property.PropertyFactory; -import org.apache.cayenne.exp.property.StringProperty; -import org.apache.cayenne.testdo.mt.ClientMtTable1; -import org.apache.cayenne.testdo.mt.ClientMtTable3; -import org.apache.cayenne.util.PersistentObjectHolder; - -/** - * A generated persistent class mapped as "MtTable2" Cayenne entity. It is a good idea to - * avoid changing this class manually, since it will be overwritten next time code is - * regenerated. If you need to make any customizations, put them in a subclass. - */ -public abstract class _ClientMtTable2 extends PersistentObject { - - public static final StringProperty<String> GLOBAL_ATTRIBUTE = PropertyFactory.createString("globalAttribute", String.class); - public static final EntityProperty<ClientMtTable1> TABLE1 = PropertyFactory.createEntity("table1", ClientMtTable1.class); - public static final EntityProperty<ClientMtTable3> TABLE3 = PropertyFactory.createEntity("table3", ClientMtTable3.class); - - protected String globalAttribute; - protected ValueHolder<ClientMtTable1> table1; - protected ValueHolder<ClientMtTable3> table3; - - public String getGlobalAttribute() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "globalAttribute", false); - } - - return globalAttribute; - } - - public void setGlobalAttribute(String globalAttribute) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "globalAttribute", false); - objectContext.propertyChanged(this, "globalAttribute", this.globalAttribute, globalAttribute); - } - - this.globalAttribute = globalAttribute; - } - - public ClientMtTable1 getTable1() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "table1", true); - } else if (this.table1 == null) { - this.table1 = new PersistentObjectHolder<>(this, "table1"); - } - - return table1.getValue(); - } - - public void setTable1(ClientMtTable1 table1) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "table1", true); - } else if (this.table1 == null) { - this.table1 = new PersistentObjectHolder<>(this, "table1"); - } - - this.table1.setValue(table1); - } - - public ClientMtTable3 getTable3() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "table3", true); - } else if (this.table3 == null) { - this.table3 = new PersistentObjectHolder<>(this, "table3"); - } - - return table3.getValue(); - } - - public void setTable3(ClientMtTable3 table3) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "table3", true); - } else if (this.table3 == null) { - this.table3 = new PersistentObjectHolder<>(this, "table3"); - } - - this.table3.setValue(table3); - } - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTable3.java b/cayenne/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTable3.java deleted file mode 100644 index e8e52c125..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTable3.java +++ /dev/null @@ -1,112 +0,0 @@ -package org.apache.cayenne.testdo.mt.auto; - -import java.util.List; - -import org.apache.cayenne.PersistentObject; -import org.apache.cayenne.exp.property.BaseProperty; -import org.apache.cayenne.exp.property.ListProperty; -import org.apache.cayenne.exp.property.NumericProperty; -import org.apache.cayenne.exp.property.PropertyFactory; -import org.apache.cayenne.exp.property.StringProperty; -import org.apache.cayenne.testdo.mt.ClientMtTable2; -import org.apache.cayenne.util.PersistentObjectList; - -/** - * A generated persistent class mapped as "MtTable3" Cayenne entity. It is a good idea to - * avoid changing this class manually, since it will be overwritten next time code is - * regenerated. If you need to make any customizations, put them in a subclass. - */ -public abstract class _ClientMtTable3 extends PersistentObject { - - public static final BaseProperty<byte[]> BINARY_COLUMN = PropertyFactory.createBase("binaryColumn", byte[].class); - public static final StringProperty<String> CHAR_COLUMN = PropertyFactory.createString("charColumn", String.class); - public static final NumericProperty<Integer> INT_COLUMN = PropertyFactory.createNumeric("intColumn", Integer.class); - public static final ListProperty<ClientMtTable2> TABLE2ARRAY = PropertyFactory.createList("table2Array", ClientMtTable2.class); - - protected byte[] binaryColumn; - protected String charColumn; - protected Integer intColumn; - protected List<ClientMtTable2> table2Array; - - public byte[] getBinaryColumn() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "binaryColumn", false); - } - - return binaryColumn; - } - - public void setBinaryColumn(byte[] binaryColumn) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "binaryColumn", false); - objectContext.propertyChanged(this, "binaryColumn", this.binaryColumn, binaryColumn); - } - - this.binaryColumn = binaryColumn; - } - - public String getCharColumn() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "charColumn", false); - } - - return charColumn; - } - - public void setCharColumn(String charColumn) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "charColumn", false); - objectContext.propertyChanged(this, "charColumn", this.charColumn, charColumn); - } - - this.charColumn = charColumn; - } - - public Integer getIntColumn() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "intColumn", false); - } - - return intColumn; - } - - public void setIntColumn(Integer intColumn) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "intColumn", false); - objectContext.propertyChanged(this, "intColumn", this.intColumn, intColumn); - } - - this.intColumn = intColumn; - } - - public List<ClientMtTable2> getTable2Array() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "table2Array", true); - } else if (this.table2Array == null) { - this.table2Array = new PersistentObjectList<>(this, "table2Array"); - } - - return table2Array; - } - - public void addToTable2Array(ClientMtTable2 object) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "table2Array", true); - } else if (this.table2Array == null) { - this.table2Array = new PersistentObjectList<>(this, "table2Array"); - } - - this.table2Array.add(object); - } - - public void removeFromTable2Array(ClientMtTable2 object) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "table2Array", true); - } else if (this.table2Array == null) { - this.table2Array = new PersistentObjectList<>(this, "table2Array"); - } - - this.table2Array.remove(object); - } - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTable4.java b/cayenne/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTable4.java deleted file mode 100644 index adeb8e494..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTable4.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.apache.cayenne.testdo.mt.auto; - -import java.util.List; - -import org.apache.cayenne.PersistentObject; -import org.apache.cayenne.exp.property.ListProperty; -import org.apache.cayenne.exp.property.PropertyFactory; -import org.apache.cayenne.testdo.mt.ClientMtTable5; -import org.apache.cayenne.util.PersistentObjectList; - -/** - * A generated persistent class mapped as "MtTable4" Cayenne entity. It is a good idea to - * avoid changing this class manually, since it will be overwritten next time code is - * regenerated. If you need to make any customizations, put them in a subclass. - */ -public abstract class _ClientMtTable4 extends PersistentObject { - - public static final ListProperty<ClientMtTable5> TABLE5S = PropertyFactory.createList("table5s", ClientMtTable5.class); - - protected List<ClientMtTable5> table5s; - - public List<ClientMtTable5> getTable5s() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "table5s", true); - } else if (this.table5s == null) { - this.table5s = new PersistentObjectList<>(this, "table5s"); - } - - return table5s; - } - - public void addToTable5s(ClientMtTable5 object) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "table5s", true); - } else if (this.table5s == null) { - this.table5s = new PersistentObjectList<>(this, "table5s"); - } - - this.table5s.add(object); - } - - public void removeFromTable5s(ClientMtTable5 object) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "table5s", true); - } else if (this.table5s == null) { - this.table5s = new PersistentObjectList<>(this, "table5s"); - } - - this.table5s.remove(object); - } - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTable5.java b/cayenne/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTable5.java deleted file mode 100644 index 17672a342..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/mt/auto/_ClientMtTable5.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.apache.cayenne.testdo.mt.auto; - -import java.util.List; - -import org.apache.cayenne.PersistentObject; -import org.apache.cayenne.exp.property.ListProperty; -import org.apache.cayenne.exp.property.PropertyFactory; -import org.apache.cayenne.testdo.mt.ClientMtTable4; -import org.apache.cayenne.util.PersistentObjectList; - -/** - * A generated persistent class mapped as "MtTable5" Cayenne entity. It is a good idea to - * avoid changing this class manually, since it will be overwritten next time code is - * regenerated. If you need to make any customizations, put them in a subclass. - */ -public abstract class _ClientMtTable5 extends PersistentObject { - - public static final ListProperty<ClientMtTable4> TABLE4S = PropertyFactory.createList("table4s", ClientMtTable4.class); - - protected List<ClientMtTable4> table4s; - - public List<ClientMtTable4> getTable4s() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "table4s", true); - } else if (this.table4s == null) { - this.table4s = new PersistentObjectList<>(this, "table4s"); - } - - return table4s; - } - - public void addToTable4s(ClientMtTable4 object) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "table4s", true); - } else if (this.table4s == null) { - this.table4s = new PersistentObjectList<>(this, "table4s"); - } - - this.table4s.add(object); - } - - public void removeFromTable4s(ClientMtTable4 object) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "table4s", true); - } else if (this.table4s == null) { - this.table4s = new PersistentObjectList<>(this, "table4s"); - } - - this.table4s.remove(object); - } - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/reflexive/ClientReflexive.java b/cayenne/src/test/java/org/apache/cayenne/testdo/reflexive/ClientReflexive.java deleted file mode 100644 index 6e94681e6..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/reflexive/ClientReflexive.java +++ /dev/null @@ -1,28 +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.testdo.reflexive; - -import org.apache.cayenne.testdo.reflexive.auto._ClientReflexive; - -/** - * A persistent class mapped as "Reflexive" Cayenne entity. - */ -public class ClientReflexive extends _ClientReflexive { - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/reflexive/auto/_ClientReflexive.java b/cayenne/src/test/java/org/apache/cayenne/testdo/reflexive/auto/_ClientReflexive.java deleted file mode 100644 index b2601aa0c..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/reflexive/auto/_ClientReflexive.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.apache.cayenne.testdo.reflexive.auto; - -import org.apache.cayenne.PersistentObject; -import org.apache.cayenne.ValueHolder; -import org.apache.cayenne.testdo.reflexive.ClientReflexive; - -import java.util.List; - -/** - * A generated persistent class mapped as "Reflexive" Cayenne entity. It is a good idea to - * avoid changing this class manually, since it will be overwritten next time code is - * regenerated. If you need to make any customizations, put them in a subclass. - */ -public abstract class _ClientReflexive extends PersistentObject { - - public static final String NAME_PROPERTY = "name"; - public static final String CHILDREN_PROPERTY = "children"; - public static final String TO_PARENT_PROPERTY = "toParent"; - - protected String name; - protected List<ClientReflexive> children; - protected ValueHolder toParent; - - public String getName() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "name", false); - } - - return name; - } - public void setName(String name) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "name", false); - } - - Object oldValue = this.name; - this.name = name; - - // notify objectContext about simple property change - if(objectContext != null) { - objectContext.propertyChanged(this, "name", oldValue, name); - } - } - - public List<ClientReflexive> getChildren() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "children", true); - } - - return children; - } - public void addToChildren(ClientReflexive object) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "children", true); - } - - this.children.add(object); - } - public void removeFromChildren(ClientReflexive object) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "children", true); - } - - this.children.remove(object); - } - - public ClientReflexive getToParent() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "toParent", true); - } - - return (ClientReflexive) toParent.getValue(); - } - public void setToParent(ClientReflexive toParent) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "toParent", true); - } - - this.toParent.setValue(toParent); - } - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/table_primitives/ClientTablePrimitives.java b/cayenne/src/test/java/org/apache/cayenne/testdo/table_primitives/ClientTablePrimitives.java deleted file mode 100644 index 97f6cfe29..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/table_primitives/ClientTablePrimitives.java +++ /dev/null @@ -1,28 +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.testdo.table_primitives; - -import org.apache.cayenne.testdo.table_primitives.auto._ClientTablePrimitives; - -/** - * A persistent class mapped as "TablePrimitives" Cayenne entity. - */ -public class ClientTablePrimitives extends _ClientTablePrimitives { - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/table_primitives/auto/_ClientTablePrimitives.java b/cayenne/src/test/java/org/apache/cayenne/testdo/table_primitives/auto/_ClientTablePrimitives.java deleted file mode 100644 index 73c0a4bee..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/table_primitives/auto/_ClientTablePrimitives.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.apache.cayenne.testdo.table_primitives.auto; - -import org.apache.cayenne.PersistentObject; - -/** - * A generated persistent class mapped as "TablePrimitives" Cayenne entity. It is a good idea to - * avoid changing this class manually, since it will be overwritten next time code is - * regenerated. If you need to make any customizations, put them in a subclass. - */ -public abstract class _ClientTablePrimitives extends PersistentObject { - - public static final String BOOLEAN_COLUMN_PROPERTY = "booleanColumn"; - public static final String INT_COLUMN_PROPERTY = "intColumn"; - - protected boolean booleanColumn; - protected int intColumn; - - public boolean isBooleanColumn() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "booleanColumn", false); - } - - return booleanColumn; - } - public void setBooleanColumn(boolean booleanColumn) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "booleanColumn", false); - } - - Object oldValue = this.booleanColumn; - this.booleanColumn = booleanColumn; - - // notify objectContext about simple property change - if(objectContext != null) { - objectContext.propertyChanged(this, "booleanColumn", oldValue, booleanColumn); - } - } - - public int getIntColumn() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "intColumn", false); - } - - return intColumn; - } - public void setIntColumn(int intColumn) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "intColumn", false); - } - - Object oldValue = this.intColumn; - this.intColumn = intColumn; - - // notify objectContext about simple property change - if(objectContext != null) { - objectContext.propertyChanged(this, "intColumn", oldValue, intColumn); - } - } - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/toone/ClientTooneDep.java b/cayenne/src/test/java/org/apache/cayenne/testdo/toone/ClientTooneDep.java deleted file mode 100644 index 08310dcae..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/toone/ClientTooneDep.java +++ /dev/null @@ -1,28 +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.testdo.toone; - -import org.apache.cayenne.testdo.toone.auto._ClientTooneDep; - -/** - * A persistent class mapped as "TooneDep" Cayenne entity. - */ -public class ClientTooneDep extends _ClientTooneDep { - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/toone/ClientTooneMaster.java b/cayenne/src/test/java/org/apache/cayenne/testdo/toone/ClientTooneMaster.java deleted file mode 100644 index 860ac763a..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/toone/ClientTooneMaster.java +++ /dev/null @@ -1,28 +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.testdo.toone; - -import org.apache.cayenne.testdo.toone.auto._ClientTooneMaster; - -/** - * A persistent class mapped as "TooneMaster" Cayenne entity. - */ -public class ClientTooneMaster extends _ClientTooneMaster { - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/toone/auto/_ClientTooneDep.java b/cayenne/src/test/java/org/apache/cayenne/testdo/toone/auto/_ClientTooneDep.java deleted file mode 100644 index f70c43e4a..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/toone/auto/_ClientTooneDep.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.apache.cayenne.testdo.toone.auto; - -import org.apache.cayenne.PersistentObject; -import org.apache.cayenne.ValueHolder; -import org.apache.cayenne.testdo.toone.ClientTooneMaster; - -/** - * A generated persistent class mapped as "TooneDep" Cayenne entity. It is a good idea to - * avoid changing this class manually, since it will be overwritten next time code is - * regenerated. If you need to make any customizations, put them in a subclass. - */ -public abstract class _ClientTooneDep extends PersistentObject { - - public static final String TO_MASTER_PROPERTY = "toMaster"; - - protected ValueHolder toMaster; - - public ClientTooneMaster getToMaster() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "toMaster", true); - } - - return (ClientTooneMaster) toMaster.getValue(); - } - public void setToMaster(ClientTooneMaster toMaster) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "toMaster", true); - } - - this.toMaster.setValue(toMaster); - } - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/testdo/toone/auto/_ClientTooneMaster.java b/cayenne/src/test/java/org/apache/cayenne/testdo/toone/auto/_ClientTooneMaster.java deleted file mode 100644 index 95cf1617e..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/testdo/toone/auto/_ClientTooneMaster.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.apache.cayenne.testdo.toone.auto; - -import org.apache.cayenne.PersistentObject; -import org.apache.cayenne.ValueHolder; -import org.apache.cayenne.testdo.toone.ClientTooneDep; - -/** - * A generated persistent class mapped as "TooneMaster" Cayenne entity. It is a good idea to - * avoid changing this class manually, since it will be overwritten next time code is - * regenerated. If you need to make any customizations, put them in a subclass. - */ -public abstract class _ClientTooneMaster extends PersistentObject { - - public static final String TO_DEPENDENT_PROPERTY = "toDependent"; - - protected ValueHolder toDependent; - - public ClientTooneDep getToDependent() { - if(objectContext != null) { - objectContext.prepareForAccess(this, "toDependent", true); - } - - return (ClientTooneDep) toDependent.getValue(); - } - public void setToDependent(ClientTooneDep toDependent) { - if(objectContext != null) { - objectContext.prepareForAccess(this, "toDependent", true); - } - - this.toDependent.setValue(toDependent); - } - -} diff --git a/cayenne/src/test/java/org/apache/cayenne/util/PersistentObjectHolderTest.java b/cayenne/src/test/java/org/apache/cayenne/util/PersistentObjectHolderTest.java deleted file mode 100644 index bb2195926..000000000 --- a/cayenne/src/test/java/org/apache/cayenne/util/PersistentObjectHolderTest.java +++ /dev/null @@ -1,73 +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.util; - -import org.apache.cayenne.ObjectContext; -import org.apache.cayenne.PersistenceState; -import org.apache.cayenne.testdo.mt.ClientMtTable1; -import org.apache.cayenne.testdo.mt.ClientMtTable2; -import org.junit.Test; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; - -public class PersistentObjectHolderTest { - - @Test - public void testSetInitialValue() { - - ObjectContext context = mock(ObjectContext.class); - - ClientMtTable2 o = new ClientMtTable2(); - o.setPersistenceState(PersistenceState.COMMITTED); - o.setObjectContext(context); - PersistentObjectHolder holder = new PersistentObjectHolder(o, ClientMtTable2.TABLE1.getName()); - - assertTrue(holder.isFault()); - ClientMtTable1 o1 = new ClientMtTable1(); - o1.setObjectContext(context); - holder.setValueDirectly(o1); - - assertFalse(holder.isFault()); - assertSame(o1, holder.value); - } - - @Test - public void testInvalidate() { - ObjectContext context = mock(ObjectContext.class); - - ClientMtTable2 o = new ClientMtTable2(); - o.setPersistenceState(PersistenceState.COMMITTED); - o.setObjectContext(context); - PersistentObjectHolder holder = new PersistentObjectHolder(o, ClientMtTable2.TABLE1.getName()); - - assertTrue(holder.isFault()); - ClientMtTable1 o1 = new ClientMtTable1(); - o1.setObjectContext(context); - holder.setValueDirectly(o1); - - holder.invalidate(); - assertTrue(holder.isFault()); - assertNull(holder.value); - } -}