Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Vosburgh2017-10-02 16:13:51 +0000
committerBrian Vosburgh2017-10-02 16:13:51 +0000
commitb2d517846dc3a104ce53ba83633b775fa8b44bc3 (patch)
treed8b9d2ea10bd656739195d30262766e7ba717ca3
parent44a8baa7727400232063b97c7db910fcb389b43d (diff)
downloadwebtools.dali-b2d517846dc3a104ce53ba83633b775fa8b44bc3.tar.gz
webtools.dali-b2d517846dc3a104ce53ba83633b775fa8b44bc3.tar.xz
webtools.dali-b2d517846dc3a104ce53ba83633b775fa8b44bc3.zip
temp (unstaged)bjv
-rw-r--r--common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/gen/AbstractJptGenerator.java4
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ModelPropertyAspectAdapter.java15
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PluggablePropertyAspectAdapter.java2
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CompoundPropertyValueModelTests.java12
-rw-r--r--common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/PropertyAspectAdapterTests.java84
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java15
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationship.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTableRelationship.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedByRelationship.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationship.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Relationship.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappingRelationship.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToManyRelationship.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToOneRelationship.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToManyRelationship.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToOneRelationship.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappingRelationship.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToManyRelationship.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToOneRelationship.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToManyRelationship.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToOneRelationship.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOverrideRelationship.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideRelationship.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOverrideRelationship.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualOverrideRelationship.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaDerivedIdentity2_0.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmDerivedIdentity2_0.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/DerivedIdentity2_0.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/builder/EclipseLinkStaticWeavingBuilder.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/GeneratorComposite.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/IdMappingGenerationComposite.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinColumnJoiningStrategyPane.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinTableJoiningStrategyPane.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/ManyToManyJoiningStrategyPane.java19
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/MappedByJoiningStrategyPane.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PrimaryKeyJoinColumnJoiningStrategyPane.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/editors/JpaXmlEditor.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/DerivedIdentityPane2_0.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/JpaProjectPropertiesPage.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaPageSelectionManager.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaTextEditorManager.java15
42 files changed, 602 insertions, 303 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/gen/AbstractJptGenerator.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/gen/AbstractJptGenerator.java
index 00c554427d..bb6003bf85 100644
--- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/gen/AbstractJptGenerator.java
+++ b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/gen/AbstractJptGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2016 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -365,7 +365,7 @@ public abstract class AbstractJptGenerator implements JptGenerator
try {
File jarInstallDir = this.getBundleParentDir(JptCommonCorePlugin.instance().getBundle());
- List<File> result = new ArrayList<File>();
+ List<File> result = new ArrayList<>();
this.findFileStartingWith(genJarName, jarInstallDir, result);
if (result.isEmpty()) {
throw new RuntimeException("Could not find: " + genJarName + "#.#.#v###.jar in: " + jarInstallDir); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ModelPropertyAspectAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ModelPropertyAspectAdapter.java
index e40ae9a001..2227f81996 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ModelPropertyAspectAdapter.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ModelPropertyAspectAdapter.java
@@ -20,6 +20,14 @@ import org.eclipse.jpt.common.utility.transformer.Transformer;
* pluggable property aspect adapter} to convert one of a {@link Model model's}
* <em>bound</em> properties to a
* {@link org.eclipse.jpt.common.utility.model.value.PropertyValueModel property value model}.
+ * <p>
+ * <strong>NB:</strong>
+ * The {@link #propertyTransformer} <em>must</em> transform
+ * a non-<code>null</code> subject into the same value as the value
+ * passed by the correponding change event; i.e. it should invoke a
+ * "standard" getter. The only thing, in addition to calling the property's
+ * getter, the transformer can do is return something other than <code>null</code>
+ * if the subject is <code>null</code>.
*
* @param <V> the type of the adapter's value
* @param <S> the type of the subject whose <em>bound</em> property is transformed into
@@ -67,6 +75,13 @@ public final class ModelPropertyAspectAdapter<V, S extends Model>
return this.propertyTransformer.transform(null);
}
+ /**
+ * <strong>NB:</strong>
+ * The event's new value is passed through <em>untouched</em>;
+ * i.e. the {@link #propertyTransformer} <em>must</em> transform
+ * a non-<code>null</code> subject into the same value as the value
+ * passed to the correponding change event.
+ */
public void propertyChanged(PropertyChangeEvent event) {
@SuppressWarnings("unchecked")
V newValue = (V) event.getNewValue();
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PluggablePropertyAspectAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PluggablePropertyAspectAdapter.java
index 2709c039d7..11af56500a 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PluggablePropertyAspectAdapter.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PluggablePropertyAspectAdapter.java
@@ -15,7 +15,7 @@ import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
/**
- * This adapter adapts an subject property value model whose value is another model
+ * This adapter adapts a subject property value model whose value is another model
* and treats the <em>inner</em> model's value as this adapter's models's value.
* As a result, this adapter listens for changes to either model
* (<em>inner</em> or <em>subject</em>).
diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CompoundPropertyValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CompoundPropertyValueModelTests.java
index 1f126b396e..dd70260c50 100644
--- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CompoundPropertyValueModelTests.java
+++ b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CompoundPropertyValueModelTests.java
@@ -13,7 +13,6 @@ import java.util.HashMap;
import org.eclipse.jpt.common.utility.internal.model.AbstractModel;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools;
import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter;
import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent;
import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter;
import org.eclipse.jpt.common.utility.model.listener.ChangeListener;
@@ -49,16 +48,7 @@ public class CompoundPropertyValueModelTests
}
protected PropertyValueModel<SimplePropertyValueModel<String>> buildValueModelModel() {
- return PropertyValueModelTools.transform(this.keyModel, new KeyTransformer());
- }
-
- public class KeyTransformer
- extends TransformerAdapter<String, SimplePropertyValueModel<String>>
- {
- @Override
- public SimplePropertyValueModel<String> transform(String key) {
- return CompoundPropertyValueModelTests.this.getValueModel(key);
- }
+ return PropertyValueModelTools.transform(this.keyModel, key -> this.getValueModel(key));
}
protected SimplePropertyValueModel<String> getValueModel(String key) {
diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/PropertyAspectAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/PropertyAspectAdapterTests.java
index cb4d7c4f9d..f0df86a1f1 100644
--- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/PropertyAspectAdapterTests.java
+++ b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/PropertyAspectAdapterTests.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.common.utility.tests.internal.model.value;
import org.eclipse.jpt.common.utility.closure.BiClosure;
+import org.eclipse.jpt.common.utility.internal.ObjectTools;
import org.eclipse.jpt.common.utility.internal.closure.BiClosureAdapter;
import org.eclipse.jpt.common.utility.internal.model.AbstractModel;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools;
@@ -30,7 +31,7 @@ public class PropertyAspectAdapterTests
extends TestCase
{
private TestSubject subject1;
- private ModifiablePropertyValueModel<TestSubject> subjectHolder1;
+ private ModifiablePropertyValueModel<TestSubject> subjectModel1;
private ModifiablePropertyValueModel<String> aa1;
private PropertyChangeEvent event1;
private PropertyChangeListener listener1;
@@ -48,8 +49,8 @@ public class PropertyAspectAdapterTests
protected void setUp() throws Exception {
super.setUp();
this.subject1 = new TestSubject("foo", "test subject 1");
- this.subjectHolder1 = new SimplePropertyValueModel<>(this.subject1);
- this.aa1 = this.buildAspectAdapter(this.subjectHolder1);
+ this.subjectModel1 = new SimplePropertyValueModel<>(this.subject1);
+ this.aa1 = this.buildAspectAdapter(this.subjectModel1);
this.listener1 = this.buildValueChangeListener1();
this.aa1.addPropertyChangeListener(PropertyValueModel.VALUE, this.listener1);
this.event1 = null;
@@ -57,9 +58,9 @@ public class PropertyAspectAdapterTests
this.subject2 = new TestSubject("bar", "test subject 2");
}
- private ModifiablePropertyValueModel<String> buildAspectAdapter(PropertyValueModel<TestSubject> subjectHolder) {
+ private ModifiablePropertyValueModel<String> buildAspectAdapter(PropertyValueModel<TestSubject> subjectModel) {
return PropertyValueModelTools.modifiableSubjectModelAspectAdapter(
- subjectHolder,
+ subjectModel,
TestSubject.NAME_PROPERTY,
TestSubject.NAME_TRANSFORMER,
TestSubject.SET_NAME_CLOSURE
@@ -85,11 +86,11 @@ public class PropertyAspectAdapterTests
super.tearDown();
}
- public void testSubjectHolder() {
+ public void testSubjectModel() {
assertEquals("foo", this.aa1.getValue());
assertNull(this.event1);
- this.subjectHolder1.setValue(this.subject2);
+ this.subjectModel1.setValue(this.subject2);
assertNotNull(this.event1);
assertEquals(this.aa1, this.event1.getSource());
assertEquals(PropertyValueModel.VALUE, this.event1.getPropertyName());
@@ -98,7 +99,7 @@ public class PropertyAspectAdapterTests
assertEquals("bar", this.aa1.getValue());
this.event1 = null;
- this.subjectHolder1.setValue(null);
+ this.subjectModel1.setValue(null);
assertNotNull(this.event1);
assertEquals(this.aa1, this.event1.getSource());
assertEquals(PropertyValueModel.VALUE, this.event1.getPropertyName());
@@ -107,7 +108,7 @@ public class PropertyAspectAdapterTests
assertNull(this.aa1.getValue());
this.event1 = null;
- this.subjectHolder1.setValue(this.subject1);
+ this.subjectModel1.setValue(this.subject1);
assertNotNull(this.event1);
assertEquals(this.aa1, this.event1.getSource());
assertEquals(PropertyValueModel.VALUE, this.event1.getPropertyName());
@@ -163,7 +164,7 @@ public class PropertyAspectAdapterTests
assertEquals("foo", this.aa1.getValue());
this.aa1.removePropertyChangeListener(PropertyValueModel.VALUE, this.listener1);
- this.subjectHolder1.setValue(this.subject2);
+ this.subjectModel1.setValue(this.subject2);
assertEquals(null, this.aa1.getValue());
this.aa1.addPropertyChangeListener(PropertyValueModel.VALUE, this.listener1);
@@ -193,15 +194,16 @@ public class PropertyAspectAdapterTests
}
/**
- * test a bug where we would call #buildValue() in
- * #engageNonNullSubject(), when we needed to call
- * it in #engageSubject(), so the cached value would
- * be rebuilt when the this.subject was set to null
+ * Test a bug:
+ * we would call <code>buildValue()</code> in
+ * <code>engageNonNullSubject()</code>, when we needed to call
+ * it in <code>engageSubject()</code>, so the cached value would
+ * be rebuilt when the the <code>subject</code> was set to <code>null</code>
*/
public void testCustomBuildValueWithNullSubject() {
TestSubject customSubject = new TestSubject("fred", "laborer");
- ModifiablePropertyValueModel<TestSubject> customSubjectHolder = new SimplePropertyValueModel<>(customSubject);
- ModifiablePropertyValueModel<String> customAA = this.buildCustomAspectAdapter(customSubjectHolder);
+ ModifiablePropertyValueModel<TestSubject> customSubjectModel = new SimplePropertyValueModel<>(customSubject);
+ ModifiablePropertyValueModel<String> customAA = this.buildCustomAspectAdapter(customSubjectModel);
PropertyChangeListener customListener = this.buildCustomValueChangeListener();
customAA.addPropertyChangeListener(PropertyValueModel.VALUE, customListener);
assertEquals("fred", customAA.getValue());
@@ -213,7 +215,7 @@ public class PropertyAspectAdapterTests
assertEquals("wilma", this.customValueEvent.getNewValue());
this.customValueEvent = null;
- customSubjectHolder.setValue(null);
+ customSubjectModel.setValue(null);
// this would fail - the value would be null...
assertEquals("<unnamed>", customAA.getValue());
assertEquals("wilma", this.customValueEvent.getOldValue());
@@ -224,8 +226,8 @@ public class PropertyAspectAdapterTests
* Test a bug:
* If two listeners were added to an aspect adapter, one with an
* aspect name and one without, the aspect adapter would add its
- * 'subjectChangeListener' to its 'subjectHolder' twice. As a result,
- * the following code will trigger an IllegalArgumentException
+ * <code>subjectChangeListener</code> to its <code>subjectModel</code> twice. As a result,
+ * the following code will trigger an {@link IllegalArgumentException}
* if the bug is present; otherwise, it completes silently.
*/
public void testDuplicateListener() {
@@ -233,11 +235,40 @@ public class PropertyAspectAdapterTests
this.aa1.addChangeListener(listener2);
}
- private ModifiablePropertyValueModel<String> buildCustomAspectAdapter(PropertyValueModel<TestSubject> subjectHolder) {
+ public void testBogusTransformer() {
+ PropertyValueModel<Boolean> nameIsFooModel = this.buildNameIsFooModel(this.subjectModel1);
+ assertNull(nameIsFooModel.getValue());
+
+ nameIsFooModel.addPropertyChangeListener(PropertyValueModel.VALUE, this.listener1);
+ assertTrue(nameIsFooModel.getValue().booleanValue());
+ this.subjectModel1.getValue().setName("bar");
+ boolean exCaught = false;
+ try {
+ assertFalse(nameIsFooModel.getValue().booleanValue());
+ } catch (ClassCastException ex) {
+ exCaught = true;
+ }
+ assertTrue(exCaught);
+ }
+
+ // **********
+ // ********** NB: this type of aspect adapter is NOT ALLOWED! :-)
+ // ********** an aspect adapter's value MUST match the aspect's value;
+ // ********** it CANNOT transform it
+ // **********
+ private PropertyValueModel<Boolean> buildNameIsFooModel(PropertyValueModel<TestSubject> subjectModel) {
+ return PropertyValueModelTools.subjectModelAspectAdapter(
+ subjectModel,
+ TestSubject.NAME_PROPERTY,
+ s -> Boolean.valueOf((s != null) && ObjectTools.equals(s.getName(), "foo"))
+ );
+ }
+
+ private ModifiablePropertyValueModel<String> buildCustomAspectAdapter(PropertyValueModel<TestSubject> subjectModel) {
return PropertyValueModelTools.modifiableSubjectModelAspectAdapter_(
- subjectHolder,
+ subjectModel,
TestSubject.NAME_PROPERTY,
- TestSubject.CUSTOM_NAME_TRANSFORMER,
+ s -> (s == null) ? "<unnamed>" : s.getName(),
TestSubject.SET_NAME_CLOSURE
);
}
@@ -271,15 +302,6 @@ public class PropertyAspectAdapterTests
return model.getName();
}
}
- public static final Transformer<TestSubject, String> CUSTOM_NAME_TRANSFORMER = new CustomNameTransformer();
- public static final class CustomNameTransformer
- extends TransformerAdapter<TestSubject, String>
- {
- @Override
- public String transform(TestSubject model) {
- return (model == null) ? "<unnamed>" : model.getName();
- }
- }
public static final BiClosure<TestSubject, String> SET_NAME_CLOSURE = new SetNameClosure();
public static final class SetNameClosure
extends BiClosureAdapter<TestSubject, String>
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java
index f1b6b2667a..5159fa07ce 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java
@@ -14,7 +14,6 @@ import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jpt.common.core.internal.utility.ICUStringCollator;
import org.eclipse.jpt.common.ui.internal.WorkbenchTools;
@@ -38,7 +37,6 @@ import org.eclipse.jpt.common.utility.model.value.CollectionValueModel;
import org.eclipse.jpt.common.utility.model.value.ListValueModel;
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.common.utility.transformer.Transformer;
import org.eclipse.jpt.jaxb.core.JaxbPreferences;
import org.eclipse.jpt.jaxb.core.JaxbProject;
import org.eclipse.jpt.jaxb.core.JaxbProjectManager;
@@ -102,18 +100,7 @@ public class JaxbProjectPropertiesPage
}
private PropertyValueModel<PropertyValueModel<JaxbProject>> buildJaxbProjectModelModel() {
- return PropertyValueModelTools.transform(this.projectModel, JAXB_PROJECT_MODEL_TRANSFORMER);
- }
-
- private static final Transformer<IProject, PropertyValueModel<JaxbProject>> JAXB_PROJECT_MODEL_TRANSFORMER = new JaxbProjectModelTransformer();
-
- /* CU private */ static class JaxbProjectModelTransformer
- extends TransformerAdapter<IProject, PropertyValueModel<JaxbProject>>
- {
- @Override
- public PropertyValueModel<JaxbProject> transform(IProject project) {
- return project.getAdapter(JaxbProjectModel.class);
- }
+ return PropertyValueModelTools.transform(this.projectModel, p -> p.getAdapter(JaxbProjectModel.class));
}
// ***** platform ID model
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java
index 2767edac05..e9cebd1a80 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java
@@ -58,7 +58,6 @@ import org.eclipse.jpt.common.utility.internal.model.AbstractModel;
import org.eclipse.jpt.common.utility.internal.model.value.AspectAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.BufferedPropertyValueModelAdapter;
import org.eclipse.jpt.common.utility.internal.model.value.CollectionValueModelTools;
-import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapterXXXX;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools;
import org.eclipse.jpt.common.utility.internal.model.value.SimpleCollectionValueModel;
import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel;
@@ -144,19 +143,9 @@ public class JaxbSchemasPropertiesPage
}
private PropertyValueModel<PropertyValueModel<JaxbProject>> buildJaxbProjectModelModel() {
- return PropertyValueModelTools.transform(this.projectModel, JAXB_PROJECT_MODEL_TRANSFORMER);
+ return PropertyValueModelTools.transform(this.projectModel, p -> p.getAdapter(JaxbProjectModel.class));
}
- private static final Transformer<IProject, PropertyValueModel<JaxbProject>> JAXB_PROJECT_MODEL_TRANSFORMER = new JaxbProjectModelTransformer();
-
- /* CU private */ static class JaxbProjectModelTransformer
- extends TransformerAdapter<IProject, PropertyValueModel<JaxbProject>>
- {
- @Override
- public PropertyValueModel<JaxbProject> transform(IProject project) {
- return project.getAdapter(JaxbProjectModel.class);
- }
- }
protected IProject getProject() {
return this.projectModel.getValue();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationship.java
index aa9a1bdd5b..d31b4f2534 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationship.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationship.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2016 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -41,6 +41,7 @@ public interface JoinColumnRelationship
* relationship's current strategy.
*/
boolean strategyIsJoinColumn();
+ String STRATEGY_IS_JOIN_COLUMN_PROPERTY = "strategyIsJoinColumn"; //$NON-NLS-1$
/**
* Return whether this relationship may potentially have a default join
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTableRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTableRelationship.java
index 671b0ae763..6a14f38fa8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTableRelationship.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTableRelationship.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2016 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -38,6 +38,7 @@ public interface JoinTableRelationship
* relationship's current strategy.
*/
boolean strategyIsJoinTable();
+ String STRATEGY_IS_JOIN_TABLE_PROPERTY = "strategyIsJoinTable"; //$NON-NLS-1$
/**
* Return whether this relationship may potentially have a default join
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedByRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedByRelationship.java
index b5bfde1acc..7c61121d46 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedByRelationship.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedByRelationship.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2016 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -39,6 +39,7 @@ public interface MappedByRelationship
* relationship's current strategy.
*/
boolean strategyIsMappedBy();
+ String STRATEGY_IS_MAPPED_BY_PROPERTY = "strategyIsMappedBy"; //$NON-NLS-1$
/**
* Set the relationship's strategy to the "mapped by" strategy.
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationship.java
index 90d8408b01..bd981f8d41 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationship.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationship.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2016 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -37,6 +37,7 @@ public interface PrimaryKeyJoinColumnRelationship
* relationship's current strategy.
*/
boolean strategyIsPrimaryKeyJoinColumn();
+ String STRATEGY_IS_PRIMARY_KEY_JOIN_COLUMN_PROPERTY = "strategyIsPrimaryKeyJoinColumn"; //$NON-NLS-1$
/**
* Set the relationship's strategy to the primary key join column strategy.
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Relationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Relationship.java
index 6929d187bb..e97ed86e59 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Relationship.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Relationship.java
@@ -56,12 +56,8 @@ public interface Relationship
Entity getEntity();
/**
- * String associated with changes to the predominant strategy property
- */
- final static String STRATEGY_PROPERTY = "strategy"; //$NON-NLS-1$
-
- /**
* Return the current strategy, this is never <code>null</code>.
*/
RelationshipStrategy getStrategy();
+ String STRATEGY_PROPERTY = "strategy"; //$NON-NLS-1$
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappingRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappingRelationship.java
index 7953a370df..07395c43b6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappingRelationship.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappingRelationship.java
@@ -51,8 +51,7 @@ public abstract class AbstractJavaMappingRelationship<P extends JavaRelationship
protected void setStrategy(SpecifiedRelationshipStrategy strategy) {
SpecifiedRelationshipStrategy old = this.strategy;
- this.strategy = strategy;
- this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy);
+ this.firePropertyChanged(STRATEGY_PROPERTY, old, this.strategy = strategy);
}
protected abstract SpecifiedRelationshipStrategy buildStrategy();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToManyRelationship.java
index 88cc5bfbc1..9f59e3880c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToManyRelationship.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToManyRelationship.java
@@ -28,6 +28,9 @@ public class GenericJavaManyToManyRelationship
extends AbstractJavaMappingRelationship<JavaManyToManyMapping>
implements JavaManyToManyRelationship
{
+ protected boolean strategyIsMappedBy;
+ protected boolean strategyIsJoinTable;
+
protected final SpecifiedMappedByRelationshipStrategy mappedByStrategy;
protected final JavaSpecifiedJoinTableRelationshipStrategy joinTableStrategy;
@@ -54,6 +57,8 @@ public class GenericJavaManyToManyRelationship
@Override
public void update(IProgressMonitor monitor) {
super.update(monitor);
+ this.setStrategyIsMappedBy(this.buildStrategyIsMappedBy());
+ this.setStrategyIsJoinTable(this.buildStrategyIsJoinTable());
this.mappedByStrategy.update(monitor);
this.joinTableStrategy.update(monitor);
}
@@ -77,6 +82,15 @@ public class GenericJavaManyToManyRelationship
}
public boolean strategyIsMappedBy() {
+ return this.strategyIsMappedBy;
+ }
+
+ protected void setStrategyIsMappedBy(boolean strategyIsMappedBy) {
+ boolean old = this.strategyIsMappedBy;
+ this.firePropertyChanged(STRATEGY_IS_MAPPED_BY_PROPERTY, old, this.strategyIsMappedBy = strategyIsMappedBy);
+ }
+
+ protected boolean buildStrategyIsMappedBy() {
return this.strategy == this.mappedByStrategy;
}
@@ -102,6 +116,15 @@ public class GenericJavaManyToManyRelationship
}
public boolean strategyIsJoinTable() {
+ return this.strategyIsJoinTable;
+ }
+
+ protected void setStrategyIsJoinTable(boolean strategyIsJoinTable) {
+ boolean old = this.strategyIsJoinTable;
+ this.firePropertyChanged(STRATEGY_IS_JOIN_TABLE_PROPERTY, old, this.strategyIsJoinTable = strategyIsJoinTable);
+ }
+
+ protected boolean buildStrategyIsJoinTable() {
return this.strategy == this.joinTableStrategy;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToOneRelationship.java
index d58beb9ea7..455dda9032 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToOneRelationship.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToOneRelationship.java
@@ -26,6 +26,9 @@ public class GenericJavaManyToOneRelationship
extends AbstractJavaMappingRelationship<JavaManyToOneMapping>
implements JavaManyToOneRelationship2_0
{
+ protected boolean strategyIsJoinColumn;
+ protected boolean strategyIsJoinTable;
+
protected final JavaSpecifiedJoinColumnRelationshipStrategy joinColumnStrategy;
// JPA 2.0
@@ -53,6 +56,8 @@ public class GenericJavaManyToOneRelationship
@Override
public void update(IProgressMonitor monitor) {
super.update(monitor);
+ this.setStrategyIsJoinColumn(this.buildStrategyIsJoinColumn());
+ this.setStrategyIsJoinTable(this.buildStrategyIsJoinTable());
this.joinColumnStrategy.update(monitor);
this.joinTableStrategy.update(monitor);
}
@@ -71,6 +76,41 @@ public class GenericJavaManyToOneRelationship
}
+ // ********** join column strategy **********
+
+ public JavaSpecifiedJoinColumnRelationshipStrategy getJoinColumnStrategy() {
+ return this.joinColumnStrategy;
+ }
+
+ public boolean strategyIsJoinColumn() {
+ return this.strategyIsJoinColumn;
+ }
+
+ protected void setStrategyIsJoinColumn(boolean strategyIsJoinColumn) {
+ boolean old = this.strategyIsJoinColumn;
+ this.firePropertyChanged(STRATEGY_IS_JOIN_COLUMN_PROPERTY, old, this.strategyIsJoinColumn = strategyIsJoinColumn);
+ }
+
+ protected boolean buildStrategyIsJoinColumn() {
+ return this.strategy == this.joinColumnStrategy;
+ }
+
+ public void setStrategyToJoinColumn() {
+ // join column strategy is the default; so no need to add stuff,
+ // just remove all the others
+ this.joinTableStrategy.removeStrategy();
+ this.updateStrategy();
+ }
+
+ public boolean mayHaveDefaultJoinColumn() {
+ return this.joinTableStrategy.getJoinTable() == null;
+ }
+
+ protected JavaSpecifiedJoinColumnRelationshipStrategy buildJoinColumnStrategy() {
+ return new GenericJavaMappingJoinColumnRelationshipStrategy(this);
+ }
+
+
// ********** join table strategy **********
public JavaSpecifiedJoinTableRelationshipStrategy getJoinTableStrategy() {
@@ -78,6 +118,15 @@ public class GenericJavaManyToOneRelationship
}
public boolean strategyIsJoinTable() {
+ return this.strategyIsJoinTable;
+ }
+
+ protected void setStrategyIsJoinTable(boolean strategyIsJoinTable) {
+ boolean old = this.strategyIsJoinTable;
+ this.firePropertyChanged(STRATEGY_IS_JOIN_TABLE_PROPERTY, old, this.strategyIsJoinTable = strategyIsJoinTable);
+ }
+
+ protected boolean buildStrategyIsJoinTable() {
return this.strategy == this.joinTableStrategy;
}
@@ -98,32 +147,6 @@ public class GenericJavaManyToOneRelationship
}
- // ********** join column strategy **********
-
- public JavaSpecifiedJoinColumnRelationshipStrategy getJoinColumnStrategy() {
- return this.joinColumnStrategy;
- }
-
- public boolean strategyIsJoinColumn() {
- return this.strategy == this.joinColumnStrategy;
- }
-
- public void setStrategyToJoinColumn() {
- // join column strategy is the default; so no need to add stuff,
- // just remove all the others
- this.joinTableStrategy.removeStrategy();
- this.updateStrategy();
- }
-
- public boolean mayHaveDefaultJoinColumn() {
- return this.joinTableStrategy.getJoinTable() == null;
- }
-
- protected JavaSpecifiedJoinColumnRelationshipStrategy buildJoinColumnStrategy() {
- return new GenericJavaMappingJoinColumnRelationshipStrategy(this);
- }
-
-
// ********** misc **********
public boolean isOwner() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToManyRelationship.java
index 1de3fabafc..040d12b2f8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToManyRelationship.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToManyRelationship.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2016 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -30,6 +30,10 @@ public class GenericJavaOneToManyRelationship
extends AbstractJavaMappingRelationship<JavaOneToManyMapping>
implements JavaOneToManyRelationship2_0
{
+ protected boolean strategyIsMappedBy;
+ protected boolean strategyIsJoinTable;
+ protected boolean strategyIsJoinColumn;
+
protected final SpecifiedMappedByRelationshipStrategy mappedByStrategy;
protected final JavaSpecifiedJoinTableRelationshipStrategy joinTableStrategy;
@@ -65,6 +69,9 @@ public class GenericJavaOneToManyRelationship
@Override
public void update(IProgressMonitor monitor) {
super.update(monitor);
+ this.setStrategyIsMappedBy(this.buildStrategyIsMappedBy());
+ this.setStrategyIsJoinTable(this.buildStrategyIsJoinTable());
+ this.setStrategyIsJoinColumn(this.buildStrategyIsJoinColumn());
this.mappedByStrategy.update(monitor);
this.joinColumnStrategy.update(monitor);
this.joinTableStrategy.update(monitor);
@@ -94,6 +101,15 @@ public class GenericJavaOneToManyRelationship
}
public boolean strategyIsMappedBy() {
+ return this.strategyIsMappedBy;
+ }
+
+ protected void setStrategyIsMappedBy(boolean strategyIsMappedBy) {
+ boolean old = this.strategyIsMappedBy;
+ this.firePropertyChanged(STRATEGY_IS_MAPPED_BY_PROPERTY, old, this.strategyIsMappedBy = strategyIsMappedBy);
+ }
+
+ protected boolean buildStrategyIsMappedBy() {
return this.strategy == this.mappedByStrategy;
}
@@ -127,6 +143,15 @@ public class GenericJavaOneToManyRelationship
}
public boolean strategyIsJoinTable() {
+ return this.strategyIsJoinTable;
+ }
+
+ protected void setStrategyIsJoinTable(boolean strategyIsJoinTable) {
+ boolean old = this.strategyIsJoinTable;
+ this.firePropertyChanged(STRATEGY_IS_JOIN_TABLE_PROPERTY, old, this.strategyIsJoinTable = strategyIsJoinTable);
+ }
+
+ protected boolean buildStrategyIsJoinTable() {
return this.strategy == this.joinTableStrategy;
}
@@ -154,6 +179,15 @@ public class GenericJavaOneToManyRelationship
}
public boolean strategyIsJoinColumn() {
+ return this.strategyIsJoinColumn;
+ }
+
+ protected void setStrategyIsJoinColumn(boolean strategyIsJoinColumn) {
+ boolean old = this.strategyIsJoinColumn;
+ this.firePropertyChanged(STRATEGY_IS_JOIN_COLUMN_PROPERTY, old, this.strategyIsJoinColumn = strategyIsJoinColumn);
+ }
+
+ protected boolean buildStrategyIsJoinColumn() {
return this.strategy == this.joinColumnStrategy;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToOneRelationship.java
index 8aaf3f8956..ed9d65503c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToOneRelationship.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToOneRelationship.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2016 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -31,6 +31,11 @@ public class GenericJavaOneToOneRelationship
extends AbstractJavaMappingRelationship<JavaOneToOneMapping>
implements JavaOneToOneRelationship2_0
{
+ protected boolean strategyIsMappedBy;
+ protected boolean strategyIsPrimaryKeyJoinColumn;
+ protected boolean strategyIsJoinTable;
+ protected boolean strategyIsJoinColumn;
+
protected final SpecifiedMappedByRelationshipStrategy mappedByStrategy;
protected final JavaSpecifiedPrimaryKeyJoinColumnRelationshipStrategy primaryKeyJoinColumnStrategy;
@@ -66,6 +71,10 @@ public class GenericJavaOneToOneRelationship
@Override
public void update(IProgressMonitor monitor) {
super.update(monitor);
+ this.setStrategyIsMappedBy(this.buildStrategyIsMappedBy());
+ this.setStrategyIsPrimaryKeyJoinColumn(this.buildStrategyIsPrimaryKeyJoinColumn());
+ this.setStrategyIsJoinTable(this.buildStrategyIsJoinTable());
+ this.setStrategyIsJoinColumn(this.buildStrategyIsJoinColumn());
this.mappedByStrategy.update(monitor);
this.primaryKeyJoinColumnStrategy.update(monitor);
this.joinTableStrategy.update(monitor);
@@ -99,6 +108,15 @@ public class GenericJavaOneToOneRelationship
}
public boolean strategyIsMappedBy() {
+ return this.strategyIsMappedBy;
+ }
+
+ protected void setStrategyIsMappedBy(boolean strategyIsMappedBy) {
+ boolean old = this.strategyIsMappedBy;
+ this.firePropertyChanged(STRATEGY_IS_MAPPED_BY_PROPERTY, old, this.strategyIsMappedBy = strategyIsMappedBy);
+ }
+
+ protected boolean buildStrategyIsMappedBy() {
return this.strategy == this.mappedByStrategy;
}
@@ -126,6 +144,15 @@ public class GenericJavaOneToOneRelationship
}
public boolean strategyIsPrimaryKeyJoinColumn() {
+ return this.strategyIsPrimaryKeyJoinColumn;
+ }
+
+ protected void setStrategyIsPrimaryKeyJoinColumn(boolean strategyIsPrimaryKeyJoinColumn) {
+ boolean old = this.strategyIsPrimaryKeyJoinColumn;
+ this.firePropertyChanged(STRATEGY_IS_PRIMARY_KEY_JOIN_COLUMN_PROPERTY, old, this.strategyIsPrimaryKeyJoinColumn = strategyIsPrimaryKeyJoinColumn);
+ }
+
+ protected boolean buildStrategyIsPrimaryKeyJoinColumn() {
return this.strategy == this.primaryKeyJoinColumnStrategy;
}
@@ -149,6 +176,15 @@ public class GenericJavaOneToOneRelationship
}
public boolean strategyIsJoinTable() {
+ return this.strategyIsJoinTable;
+ }
+
+ protected void setStrategyIsJoinTable(boolean strategyIsJoinTable) {
+ boolean old = this.strategyIsJoinTable;
+ this.firePropertyChanged(STRATEGY_IS_JOIN_TABLE_PROPERTY, old, this.strategyIsJoinTable = strategyIsJoinTable);
+ }
+
+ protected boolean buildStrategyIsJoinTable() {
return this.strategy == this.joinTableStrategy;
}
@@ -178,6 +214,15 @@ public class GenericJavaOneToOneRelationship
}
public boolean strategyIsJoinColumn() {
+ return this.strategyIsJoinColumn;
+ }
+
+ protected void setStrategyIsJoinColumn(boolean strategyIsJoinColumn) {
+ boolean old = this.strategyIsJoinColumn;
+ this.firePropertyChanged(STRATEGY_IS_JOIN_COLUMN_PROPERTY, old, this.strategyIsJoinColumn = strategyIsJoinColumn);
+ }
+
+ protected boolean buildStrategyIsJoinColumn() {
return this.strategy == this.joinColumnStrategy;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappingRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappingRelationship.java
index 7c5f31de1f..8d8e9e8678 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappingRelationship.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappingRelationship.java
@@ -56,8 +56,7 @@ public abstract class AbstractOrmMappingRelationship<P extends OrmRelationshipMa
protected void setStrategy(SpecifiedRelationshipStrategy strategy) {
SpecifiedRelationshipStrategy old = this.strategy;
- this.strategy = strategy;
- this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy);
+ this.firePropertyChanged(STRATEGY_PROPERTY, old, this.strategy = strategy);
}
protected abstract SpecifiedRelationshipStrategy buildStrategy();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToManyRelationship.java
index b211300b42..63e20a4c83 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToManyRelationship.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToManyRelationship.java
@@ -30,6 +30,9 @@ public class GenericOrmManyToManyRelationship
extends AbstractOrmMappingRelationship<OrmManyToManyMapping>
implements OrmManyToManyRelationship
{
+ protected boolean strategyIsMappedBy;
+ protected boolean strategyIsJoinTable;
+
protected final OrmSpecifiedMappedByRelationshipStrategy mappedByStrategy;
protected final OrmSpecifiedJoinTableRelationshipStrategy joinTableStrategy;
@@ -56,6 +59,8 @@ public class GenericOrmManyToManyRelationship
@Override
public void update(IProgressMonitor monitor) {
super.update(monitor);
+ this.setStrategyIsMappedBy(this.buildStrategyIsMappedBy());
+ this.setStrategyIsJoinTable(this.buildStrategyIsJoinTable());
this.mappedByStrategy.update(monitor);
this.joinTableStrategy.update(monitor);
}
@@ -79,6 +84,15 @@ public class GenericOrmManyToManyRelationship
}
public boolean strategyIsMappedBy() {
+ return this.strategyIsMappedBy;
+ }
+
+ protected void setStrategyIsMappedBy(boolean strategyIsMappedBy) {
+ boolean old = this.strategyIsMappedBy;
+ this.firePropertyChanged(STRATEGY_IS_MAPPED_BY_PROPERTY, old, this.strategyIsMappedBy = strategyIsMappedBy);
+ }
+
+ protected boolean buildStrategyIsMappedBy() {
return this.strategy == this.mappedByStrategy;
}
@@ -104,6 +118,15 @@ public class GenericOrmManyToManyRelationship
}
public boolean strategyIsJoinTable() {
+ return this.strategyIsJoinTable;
+ }
+
+ protected void setStrategyIsJoinTable(boolean strategyIsJoinTable) {
+ boolean old = this.strategyIsJoinTable;
+ this.firePropertyChanged(STRATEGY_IS_JOIN_TABLE_PROPERTY, old, this.strategyIsJoinTable = strategyIsJoinTable);
+ }
+
+ protected boolean buildStrategyIsJoinTable() {
return this.strategy == this.joinTableStrategy;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToOneRelationship.java
index 32d20dcd28..a041456099 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToOneRelationship.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToOneRelationship.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2016 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -28,6 +28,9 @@ public class GenericOrmManyToOneRelationship
extends AbstractOrmMappingRelationship<OrmManyToOneMapping>
implements OrmManyToOneRelationship2_0
{
+ protected boolean strategyIsJoinColumn;
+ protected boolean strategyIsJoinTable;
+
protected final OrmSpecifiedJoinColumnRelationshipStrategy joinColumnStrategy;
// JPA 2.0
@@ -55,6 +58,8 @@ public class GenericOrmManyToOneRelationship
@Override
public void update(IProgressMonitor monitor) {
super.update(monitor);
+ this.setStrategyIsJoinColumn(this.buildStrategyIsJoinColumn());
+ this.setStrategyIsJoinTable(this.buildStrategyIsJoinTable());
this.joinColumnStrategy.update(monitor);
this.joinTableStrategy.update(monitor);
}
@@ -73,57 +78,74 @@ public class GenericOrmManyToOneRelationship
}
- // ********** join table strategy **********
+ // ********** join column strategy **********
- public OrmSpecifiedJoinTableRelationshipStrategy getJoinTableStrategy() {
- return this.joinTableStrategy;
+ public OrmSpecifiedJoinColumnRelationshipStrategy getJoinColumnStrategy() {
+ return this.joinColumnStrategy;
}
- public boolean strategyIsJoinTable() {
- return this.strategy == this.joinTableStrategy;
+ public boolean strategyIsJoinColumn() {
+ return this.strategyIsJoinColumn;
}
- public void setStrategyToJoinTable() {
- this.joinTableStrategy.addStrategy();
- this.joinColumnStrategy.removeStrategy();
+ protected void setStrategyIsJoinColumn(boolean strategyIsJoinColumn) {
+ boolean old = this.strategyIsJoinColumn;
+ this.firePropertyChanged(STRATEGY_IS_JOIN_COLUMN_PROPERTY, old, this.strategyIsJoinColumn = strategyIsJoinColumn);
+ }
+
+ protected boolean buildStrategyIsJoinColumn() {
+ return this.strategy == this.joinColumnStrategy;
+ }
+
+ public void setStrategyToJoinColumn() {
+ // join column strategy is the default; so no need to add stuff,
+ // just remove all the others
+ this.joinTableStrategy.removeStrategy();
this.updateStrategy();
}
- public boolean mayHaveDefaultJoinTable() {
- return false;
+ public boolean mayHaveDefaultJoinColumn() {
+ return this.joinTableStrategy.getJoinTable() == null;
}
- protected OrmSpecifiedJoinTableRelationshipStrategy buildJoinTableStrategy() {
- return this.isJpa2_0Compatible() ?
- new GenericOrmMappingJoinTableRelationshipStrategy(this) :
- new NullOrmJoinTableRelationshipStrategy(this);
+ protected OrmSpecifiedJoinColumnRelationshipStrategy buildJoinColumnStrategy() {
+ return new GenericOrmMappingJoinColumnRelationshipStrategy(this);
}
+ // ********** join table strategy **********
- // ********** join column strategy **********
+ public OrmSpecifiedJoinTableRelationshipStrategy getJoinTableStrategy() {
+ return this.joinTableStrategy;
+ }
- public OrmSpecifiedJoinColumnRelationshipStrategy getJoinColumnStrategy() {
- return this.joinColumnStrategy;
+ public boolean strategyIsJoinTable() {
+ return this.strategyIsJoinTable;
}
- public boolean strategyIsJoinColumn() {
- return this.strategy == this.joinColumnStrategy;
+ protected void setStrategyIsJoinTable(boolean strategyIsJoinTable) {
+ boolean old = this.strategyIsJoinTable;
+ this.firePropertyChanged(STRATEGY_IS_JOIN_TABLE_PROPERTY, old, this.strategyIsJoinTable = strategyIsJoinTable);
}
- public void setStrategyToJoinColumn() {
- // join column strategy is the default; so no need to add stuff,
- // just remove all the others
- this.joinTableStrategy.removeStrategy();
+ protected boolean buildStrategyIsJoinTable() {
+ return this.strategy == this.joinTableStrategy;
+ }
+
+ public void setStrategyToJoinTable() {
+ this.joinTableStrategy.addStrategy();
+ this.joinColumnStrategy.removeStrategy();
this.updateStrategy();
}
- public boolean mayHaveDefaultJoinColumn() {
- return this.joinTableStrategy.getJoinTable() == null;
+ public boolean mayHaveDefaultJoinTable() {
+ return false;
}
- protected OrmSpecifiedJoinColumnRelationshipStrategy buildJoinColumnStrategy() {
- return new GenericOrmMappingJoinColumnRelationshipStrategy(this);
+ protected OrmSpecifiedJoinTableRelationshipStrategy buildJoinTableStrategy() {
+ return this.isJpa2_0Compatible() ?
+ new GenericOrmMappingJoinTableRelationshipStrategy(this) :
+ new NullOrmJoinTableRelationshipStrategy(this);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToManyRelationship.java
index db31260644..d35870a2f0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToManyRelationship.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToManyRelationship.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2016 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -33,6 +33,10 @@ public class GenericOrmOneToManyRelationship
extends AbstractOrmMappingRelationship<OrmOneToManyMapping>
implements OrmOneToManyRelationship2_0
{
+ protected boolean strategyIsMappedBy;
+ protected boolean strategyIsJoinTable;
+ protected boolean strategyIsJoinColumn;
+
protected final OrmSpecifiedMappedByRelationshipStrategy mappedByStrategy;
protected final OrmSpecifiedJoinTableRelationshipStrategy joinTableStrategy;
@@ -68,6 +72,9 @@ public class GenericOrmOneToManyRelationship
@Override
public void update(IProgressMonitor monitor) {
super.update(monitor);
+ this.setStrategyIsMappedBy(this.buildStrategyIsMappedBy());
+ this.setStrategyIsJoinTable(this.buildStrategyIsJoinTable());
+ this.setStrategyIsJoinColumn(this.buildStrategyIsJoinColumn());
this.mappedByStrategy.update(monitor);
this.joinColumnStrategy.update(monitor);
this.joinTableStrategy.update(monitor);
@@ -97,6 +104,15 @@ public class GenericOrmOneToManyRelationship
}
public boolean strategyIsMappedBy() {
+ return this.strategyIsMappedBy;
+ }
+
+ protected void setStrategyIsMappedBy(boolean strategyIsMappedBy) {
+ boolean old = this.strategyIsMappedBy;
+ this.firePropertyChanged(STRATEGY_IS_MAPPED_BY_PROPERTY, old, this.strategyIsMappedBy = strategyIsMappedBy);
+ }
+
+ protected boolean buildStrategyIsMappedBy() {
return this.strategy == this.mappedByStrategy;
}
@@ -130,6 +146,15 @@ public class GenericOrmOneToManyRelationship
}
public boolean strategyIsJoinTable() {
+ return this.strategyIsJoinTable;
+ }
+
+ protected void setStrategyIsJoinTable(boolean strategyIsJoinTable) {
+ boolean old = this.strategyIsJoinTable;
+ this.firePropertyChanged(STRATEGY_IS_JOIN_TABLE_PROPERTY, old, this.strategyIsJoinTable = strategyIsJoinTable);
+ }
+
+ protected boolean buildStrategyIsJoinTable() {
return this.strategy == this.joinTableStrategy;
}
@@ -157,6 +182,15 @@ public class GenericOrmOneToManyRelationship
}
public boolean strategyIsJoinColumn() {
+ return this.strategyIsJoinColumn;
+ }
+
+ protected void setStrategyIsJoinColumn(boolean strategyIsJoinColumn) {
+ boolean old = this.strategyIsJoinColumn;
+ this.firePropertyChanged(STRATEGY_IS_JOIN_COLUMN_PROPERTY, old, this.strategyIsJoinColumn = strategyIsJoinColumn);
+ }
+
+ protected boolean buildStrategyIsJoinColumn() {
return this.strategy == this.joinColumnStrategy;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToOneRelationship.java
index fb0e6bfd29..12f3d43f80 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToOneRelationship.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToOneRelationship.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2016 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -34,6 +34,11 @@ public class GenericOrmOneToOneRelationship
extends AbstractOrmMappingRelationship<OrmOneToOneMapping>
implements OrmOneToOneRelationship2_0
{
+ protected boolean strategyIsMappedBy;
+ protected boolean strategyIsPrimaryKeyJoinColumn;
+ protected boolean strategyIsJoinTable;
+ protected boolean strategyIsJoinColumn;
+
protected final OrmSpecifiedMappedByRelationshipStrategy mappedByStrategy;
protected final OrmSpecifiedPrimaryKeyJoinColumnRelationshipStrategy primaryKeyJoinColumnStrategy;
@@ -69,6 +74,10 @@ public class GenericOrmOneToOneRelationship
@Override
public void update(IProgressMonitor monitor) {
super.update(monitor);
+ this.setStrategyIsMappedBy(this.buildStrategyIsMappedBy());
+ this.setStrategyIsPrimaryKeyJoinColumn(this.buildStrategyIsPrimaryKeyJoinColumn());
+ this.setStrategyIsJoinTable(this.buildStrategyIsJoinTable());
+ this.setStrategyIsJoinColumn(this.buildStrategyIsJoinColumn());
this.mappedByStrategy.update(monitor);
this.primaryKeyJoinColumnStrategy.update(monitor);
this.joinTableStrategy.update(monitor);
@@ -102,6 +111,15 @@ public class GenericOrmOneToOneRelationship
}
public boolean strategyIsMappedBy() {
+ return this.strategyIsMappedBy;
+ }
+
+ protected void setStrategyIsMappedBy(boolean strategyIsMappedBy) {
+ boolean old = this.strategyIsMappedBy;
+ this.firePropertyChanged(STRATEGY_IS_MAPPED_BY_PROPERTY, old, this.strategyIsMappedBy = strategyIsMappedBy);
+ }
+
+ protected boolean buildStrategyIsMappedBy() {
return this.strategy == this.mappedByStrategy;
}
@@ -129,6 +147,15 @@ public class GenericOrmOneToOneRelationship
}
public boolean strategyIsPrimaryKeyJoinColumn() {
+ return this.strategyIsPrimaryKeyJoinColumn;
+ }
+
+ protected void setStrategyIsPrimaryKeyJoinColumn(boolean strategyIsPrimaryKeyJoinColumn) {
+ boolean old = this.strategyIsPrimaryKeyJoinColumn;
+ this.firePropertyChanged(STRATEGY_IS_PRIMARY_KEY_JOIN_COLUMN_PROPERTY, old, this.strategyIsPrimaryKeyJoinColumn = strategyIsPrimaryKeyJoinColumn);
+ }
+
+ protected boolean buildStrategyIsPrimaryKeyJoinColumn() {
return this.strategy == this.primaryKeyJoinColumnStrategy;
}
@@ -152,6 +179,15 @@ public class GenericOrmOneToOneRelationship
}
public boolean strategyIsJoinTable() {
+ return this.strategyIsJoinTable;
+ }
+
+ protected void setStrategyIsJoinTable(boolean strategyIsJoinTable) {
+ boolean old = this.strategyIsJoinTable;
+ this.firePropertyChanged(STRATEGY_IS_JOIN_TABLE_PROPERTY, old, this.strategyIsJoinTable = strategyIsJoinTable);
+ }
+
+ protected boolean buildStrategyIsJoinTable() {
return this.strategy == this.joinTableStrategy;
}
@@ -181,6 +217,15 @@ public class GenericOrmOneToOneRelationship
}
public boolean strategyIsJoinColumn() {
+ return this.strategyIsJoinColumn;
+ }
+
+ protected void setStrategyIsJoinColumn(boolean strategyIsJoinColumn) {
+ boolean old = this.strategyIsJoinColumn;
+ this.firePropertyChanged(STRATEGY_IS_JOIN_COLUMN_PROPERTY, old, this.strategyIsJoinColumn = strategyIsJoinColumn);
+ }
+
+ protected boolean buildStrategyIsJoinColumn() {
return this.strategy == this.joinColumnStrategy;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOverrideRelationship.java
index 671eabccb2..2370b45451 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOverrideRelationship.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOverrideRelationship.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2016 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -42,6 +42,8 @@ public class GenericJavaOverrideRelationship
implements JavaSpecifiedOverrideRelationship2_0
{
protected SpecifiedRelationshipStrategy strategy;
+ protected boolean strategyIsJoinColumn;
+ protected boolean strategyIsJoinTable;
protected final JavaSpecifiedJoinColumnRelationshipStrategy joinColumnStrategy;
@@ -69,6 +71,8 @@ public class GenericJavaOverrideRelationship
public void update(IProgressMonitor monitor) {
super.update(monitor);
this.setStrategy(this.buildStrategy());
+ this.setStrategyIsJoinColumn(this.buildStrategyIsJoinColumn());
+ this.setStrategyIsJoinTable(this.buildStrategyIsJoinTable());
this.joinColumnStrategy.update(monitor);
this.joinTableStrategy.update(monitor);
}
@@ -82,8 +86,7 @@ public class GenericJavaOverrideRelationship
protected void setStrategy(SpecifiedRelationshipStrategy strategy) {
SpecifiedRelationshipStrategy old = this.strategy;
- this.strategy = strategy;
- this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy);
+ this.firePropertyChanged(STRATEGY_PROPERTY, old, this.strategy = strategy);
}
protected SpecifiedRelationshipStrategy buildStrategy() {
@@ -128,6 +131,15 @@ public class GenericJavaOverrideRelationship
}
public boolean strategyIsJoinColumn() {
+ return this.strategyIsJoinColumn;
+ }
+
+ protected void setStrategyIsJoinColumn(boolean strategyIsJoinColumn) {
+ boolean old = this.strategyIsJoinColumn;
+ this.firePropertyChanged(STRATEGY_IS_JOIN_COLUMN_PROPERTY, old, this.strategyIsJoinColumn = strategyIsJoinColumn);
+ }
+
+ protected boolean buildStrategyIsJoinColumn() {
return this.strategy == this.joinColumnStrategy;
}
@@ -152,6 +164,15 @@ public class GenericJavaOverrideRelationship
}
public boolean strategyIsJoinTable() {
+ return this.strategyIsJoinTable;
+ }
+
+ protected void setStrategyIsJoinTable(boolean strategyIsJoinTable) {
+ boolean old = this.strategyIsJoinTable;
+ this.firePropertyChanged(STRATEGY_IS_JOIN_TABLE_PROPERTY, old, this.strategyIsJoinTable = strategyIsJoinTable);
+ }
+
+ protected boolean buildStrategyIsJoinTable() {
return this.strategy == this.joinTableStrategy;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideRelationship.java
index 64f2584613..c3ec4f7786 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideRelationship.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideRelationship.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2015 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2016 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -39,6 +39,8 @@ public class GenericJavaVirtualOverrideRelationship
implements VirtualOverrideRelationship2_0
{
protected VirtualRelationshipStrategy strategy;
+ protected boolean strategyIsJoinColumn;
+ protected boolean strategyIsJoinTable;
protected final VirtualJoinColumnRelationshipStrategy joinColumnStrategy;
@@ -59,6 +61,8 @@ public class GenericJavaVirtualOverrideRelationship
public void update(IProgressMonitor monitor) {
super.update(monitor);
this.setStrategy(this.buildStrategy());
+ this.setStrategyIsJoinColumn(this.buildStrategyIsJoinColumn());
+ this.setStrategyIsJoinTable(this.buildStrategyIsJoinTable());
this.joinColumnStrategy.update(monitor);
this.joinTableStrategy.update(monitor);
}
@@ -72,8 +76,7 @@ public class GenericJavaVirtualOverrideRelationship
protected void setStrategy(VirtualRelationshipStrategy strategy) {
VirtualRelationshipStrategy old = this.strategy;
- this.strategy = strategy;
- this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy);
+ this.firePropertyChanged(STRATEGY_PROPERTY, old, this.strategy = strategy);
}
protected VirtualRelationshipStrategy buildStrategy() {
@@ -118,6 +121,15 @@ public class GenericJavaVirtualOverrideRelationship
}
public boolean strategyIsJoinColumn() {
+ return this.strategyIsJoinColumn;
+ }
+
+ protected void setStrategyIsJoinColumn(boolean strategyIsJoinColumn) {
+ boolean old = this.strategyIsJoinColumn;
+ this.firePropertyChanged(STRATEGY_IS_JOIN_COLUMN_PROPERTY, old, this.strategyIsJoinColumn = strategyIsJoinColumn);
+ }
+
+ protected boolean buildStrategyIsJoinColumn() {
return this.strategy == this.joinColumnStrategy;
}
@@ -138,6 +150,15 @@ public class GenericJavaVirtualOverrideRelationship
}
public boolean strategyIsJoinTable() {
+ return this.strategyIsJoinTable;
+ }
+
+ protected void setStrategyIsJoinTable(boolean strategyIsJoinTable) {
+ boolean old = this.strategyIsJoinTable;
+ this.firePropertyChanged(STRATEGY_IS_JOIN_TABLE_PROPERTY, old, this.strategyIsJoinTable = strategyIsJoinTable);
+ }
+
+ protected boolean buildStrategyIsJoinTable() {
return this.strategy == this.joinTableStrategy;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOverrideRelationship.java
index 1baf0a4d83..09fcb44eb3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOverrideRelationship.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOverrideRelationship.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2016 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -43,6 +43,8 @@ public class GenericOrmOverrideRelationship
implements OrmSpecifiedOverrideRelationship2_0
{
protected SpecifiedRelationshipStrategy strategy;
+ protected boolean strategyIsJoinColumn;
+ protected boolean strategyIsJoinTable;
protected final OrmSpecifiedJoinColumnRelationshipStrategy joinColumnStrategy;
@@ -70,6 +72,8 @@ public class GenericOrmOverrideRelationship
public void update(IProgressMonitor monitor) {
super.update(monitor);
this.setStrategy(this.buildStrategy());
+ this.setStrategyIsJoinColumn(this.buildStrategyIsJoinColumn());
+ this.setStrategyIsJoinTable(this.buildStrategyIsJoinTable());
this.joinColumnStrategy.update(monitor);
this.joinTableStrategy.update(monitor);
}
@@ -83,8 +87,7 @@ public class GenericOrmOverrideRelationship
protected void setStrategy(SpecifiedRelationshipStrategy strategy) {
SpecifiedRelationshipStrategy old = this.strategy;
- this.strategy = strategy;
- this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy);
+ this.firePropertyChanged(STRATEGY_PROPERTY, old, this.strategy = strategy);
}
protected SpecifiedRelationshipStrategy buildStrategy() {
@@ -129,6 +132,15 @@ public class GenericOrmOverrideRelationship
}
public boolean strategyIsJoinColumn() {
+ return this.strategyIsJoinColumn;
+ }
+
+ protected void setStrategyIsJoinColumn(boolean strategyIsJoinColumn) {
+ boolean old = this.strategyIsJoinColumn;
+ this.firePropertyChanged(STRATEGY_IS_JOIN_COLUMN_PROPERTY, old, this.strategyIsJoinColumn = strategyIsJoinColumn);
+ }
+
+ protected boolean buildStrategyIsJoinColumn() {
return this.strategy == this.joinColumnStrategy;
}
@@ -154,6 +166,15 @@ public class GenericOrmOverrideRelationship
}
public boolean strategyIsJoinTable() {
+ return this.strategyIsJoinTable;
+ }
+
+ protected void setStrategyIsJoinTable(boolean strategyIsJoinTable) {
+ boolean old = this.strategyIsJoinTable;
+ this.firePropertyChanged(STRATEGY_IS_JOIN_TABLE_PROPERTY, old, this.strategyIsJoinTable = strategyIsJoinTable);
+ }
+
+ protected boolean buildStrategyIsJoinTable() {
return this.strategy == this.joinTableStrategy;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualOverrideRelationship.java
index 0524e45eee..9a2144b65e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualOverrideRelationship.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualOverrideRelationship.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2015 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2016 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -40,6 +40,8 @@ public class GenericOrmVirtualOverrideRelationship
implements VirtualOverrideRelationship2_0
{
protected VirtualRelationshipStrategy strategy;
+ protected boolean strategyIsJoinColumn;
+ protected boolean strategyIsJoinTable;
protected final VirtualJoinColumnRelationshipStrategy joinColumnStrategy;
@@ -60,6 +62,8 @@ public class GenericOrmVirtualOverrideRelationship
public void update(IProgressMonitor monitor) {
super.update(monitor);
this.setStrategy(this.buildStrategy());
+ this.setStrategyIsJoinColumn(this.buildStrategyIsJoinColumn());
+ this.setStrategyIsJoinTable(this.buildStrategyIsJoinTable());
this.joinColumnStrategy.update(monitor);
this.joinTableStrategy.update(monitor);
}
@@ -73,8 +77,7 @@ public class GenericOrmVirtualOverrideRelationship
protected void setStrategy(VirtualRelationshipStrategy strategy) {
VirtualRelationshipStrategy old = this.strategy;
- this.strategy = strategy;
- this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy);
+ this.firePropertyChanged(STRATEGY_PROPERTY, old, this.strategy = strategy);
}
protected VirtualRelationshipStrategy buildStrategy() {
@@ -119,6 +122,15 @@ public class GenericOrmVirtualOverrideRelationship
}
public boolean strategyIsJoinColumn() {
+ return this.strategyIsJoinColumn;
+ }
+
+ protected void setStrategyIsJoinColumn(boolean strategyIsJoinColumn) {
+ boolean old = this.strategyIsJoinColumn;
+ this.firePropertyChanged(STRATEGY_IS_JOIN_COLUMN_PROPERTY, old, this.strategyIsJoinColumn = strategyIsJoinColumn);
+ }
+
+ protected boolean buildStrategyIsJoinColumn() {
return this.strategy == this.joinColumnStrategy;
}
@@ -139,6 +151,15 @@ public class GenericOrmVirtualOverrideRelationship
}
public boolean strategyIsJoinTable() {
+ return this.strategyIsJoinTable;
+ }
+
+ protected void setStrategyIsJoinTable(boolean strategyIsJoinTable) {
+ boolean old = this.strategyIsJoinTable;
+ this.firePropertyChanged(STRATEGY_IS_JOIN_TABLE_PROPERTY, old, this.strategyIsJoinTable = strategyIsJoinTable);
+ }
+
+ protected boolean buildStrategyIsJoinTable() {
return this.strategy == this.joinTableStrategy;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaDerivedIdentity2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaDerivedIdentity2_0.java
index 01da8553ab..d21f871daa 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaDerivedIdentity2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaDerivedIdentity2_0.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2016 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -27,6 +27,8 @@ public class GenericJavaDerivedIdentity2_0
{
/** this can be <code>null</code> */
protected DerivedIdentityStrategy2_0 strategy;
+ protected boolean usesIdDerivedIdentityStrategy;
+ protected boolean usesMapsIdDerivedIdentityStrategy;
protected final IdDerivedIdentityStrategy2_0 idStrategy;
@@ -55,6 +57,8 @@ public class GenericJavaDerivedIdentity2_0
this.idStrategy.update(monitor);
this.mapsIdStrategy.update(monitor);
this.updateStrategy();
+ this.setUsesIdDerivedIdentityStrategy(this.buildUsesIdDerivedIdentityStrategy());
+ this.setUsesMapsIdDerivedIdentityStrategy(this.buildUsesMapsIdDerivedIdentityStrategy());
}
@@ -66,8 +70,7 @@ public class GenericJavaDerivedIdentity2_0
protected void setStrategy(DerivedIdentityStrategy2_0 strategy) {
DerivedIdentityStrategy2_0 old = this.strategy;
- this.strategy = strategy;
- this.firePropertyChanged(PREDOMINANT_DERIVED_IDENTITY_STRATEGY_PROPERTY, old, strategy);
+ this.firePropertyChanged(PREDOMINANT_DERIVED_IDENTITY_STRATEGY_PROPERTY, old, this.strategy = strategy);
}
protected void updateStrategy() {
@@ -111,6 +114,15 @@ public class GenericJavaDerivedIdentity2_0
}
public boolean usesIdDerivedIdentityStrategy() {
+ return this.usesIdDerivedIdentityStrategy;
+ }
+
+ protected void setUsesIdDerivedIdentityStrategy(boolean usesIdDerivedIdentityStrategy) {
+ boolean old = this.usesIdDerivedIdentityStrategy;
+ this.firePropertyChanged(USES_ID_DERIVED_IDENTITY_STRATEGY_PROPERTY, old, this.usesIdDerivedIdentityStrategy = usesIdDerivedIdentityStrategy);
+ }
+
+ protected boolean buildUsesIdDerivedIdentityStrategy() {
return this.strategy == this.idStrategy;
}
@@ -132,6 +144,15 @@ public class GenericJavaDerivedIdentity2_0
}
public boolean usesMapsIdDerivedIdentityStrategy() {
+ return this.usesMapsIdDerivedIdentityStrategy;
+ }
+
+ protected void setUsesMapsIdDerivedIdentityStrategy(boolean usesMapsIdDerivedIdentityStrategy) {
+ boolean old = this.usesMapsIdDerivedIdentityStrategy;
+ this.firePropertyChanged(USES_MAPS_ID_DERIVED_IDENTITY_STRATEGY_PROPERTY, old, this.usesMapsIdDerivedIdentityStrategy = usesMapsIdDerivedIdentityStrategy);
+ }
+
+ protected boolean buildUsesMapsIdDerivedIdentityStrategy() {
return this.strategy == this.mapsIdStrategy;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmDerivedIdentity2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmDerivedIdentity2_0.java
index 2c8439954f..14eb927099 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmDerivedIdentity2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmDerivedIdentity2_0.java
@@ -26,6 +26,8 @@ public class GenericOrmDerivedIdentity2_0
implements OrmDerivedIdentity2_0
{
protected DerivedIdentityStrategy2_0 strategy;
+ protected boolean usesIdDerivedIdentityStrategy;
+ protected boolean usesMapsIdDerivedIdentityStrategy;
protected final OrmIdDerivedIdentityStrategy2_0 idStrategy;
@@ -54,6 +56,8 @@ public class GenericOrmDerivedIdentity2_0
this.idStrategy.update(monitor);
this.mapsIdStrategy.update(monitor);
this.updateStrategy();
+ this.setUsesIdDerivedIdentityStrategy(this.buildUsesIdDerivedIdentityStrategy());
+ this.setUsesMapsIdDerivedIdentityStrategy(this.buildUsesMapsIdDerivedIdentityStrategy());
}
@@ -65,8 +69,7 @@ public class GenericOrmDerivedIdentity2_0
protected void setStrategy(DerivedIdentityStrategy2_0 strategy) {
DerivedIdentityStrategy2_0 old = this.strategy;
- this.strategy = strategy;
- this.firePropertyChanged(PREDOMINANT_DERIVED_IDENTITY_STRATEGY_PROPERTY, old, strategy);
+ this.firePropertyChanged(PREDOMINANT_DERIVED_IDENTITY_STRATEGY_PROPERTY, old, this.strategy = strategy);
}
protected void updateStrategy() {
@@ -110,6 +113,15 @@ public class GenericOrmDerivedIdentity2_0
}
public boolean usesIdDerivedIdentityStrategy() {
+ return this.usesIdDerivedIdentityStrategy;
+ }
+
+ protected void setUsesIdDerivedIdentityStrategy(boolean usesIdDerivedIdentityStrategy) {
+ boolean old = this.usesIdDerivedIdentityStrategy;
+ this.firePropertyChanged(USES_ID_DERIVED_IDENTITY_STRATEGY_PROPERTY, old, this.usesIdDerivedIdentityStrategy = usesIdDerivedIdentityStrategy);
+ }
+
+ protected boolean buildUsesIdDerivedIdentityStrategy() {
return this.strategy == this.idStrategy;
}
@@ -131,6 +143,15 @@ public class GenericOrmDerivedIdentity2_0
}
public boolean usesMapsIdDerivedIdentityStrategy() {
+ return this.usesMapsIdDerivedIdentityStrategy;
+ }
+
+ protected void setUsesMapsIdDerivedIdentityStrategy(boolean usesMapsIdDerivedIdentityStrategy) {
+ boolean old = this.usesMapsIdDerivedIdentityStrategy;
+ this.firePropertyChanged(USES_MAPS_ID_DERIVED_IDENTITY_STRATEGY_PROPERTY, old, this.usesMapsIdDerivedIdentityStrategy = usesMapsIdDerivedIdentityStrategy);
+ }
+
+ protected boolean buildUsesMapsIdDerivedIdentityStrategy() {
return this.strategy == this.mapsIdStrategy;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/DerivedIdentity2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/DerivedIdentity2_0.java
index d225be069c..391f820ba5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/DerivedIdentity2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/DerivedIdentity2_0.java
@@ -75,6 +75,7 @@ public interface DerivedIdentity2_0
* Return whether the mapping uses an ID strategy.
*/
boolean usesIdDerivedIdentityStrategy();
+ String USES_ID_DERIVED_IDENTITY_STRATEGY_PROPERTY = "usesIdDerivedIdentityStrategy"; //$NON-NLS-1$
Predicate<DerivedIdentity2_0> USES_ID_DERIVED_IDENTITY_STRATEGY = new UsesIdDerivedIdentityStrategy();
class UsesIdDerivedIdentityStrategy
extends PredicateAdapter<DerivedIdentity2_0>
@@ -112,6 +113,7 @@ public interface DerivedIdentity2_0
* Return whether the mapping uses a "maps ID" strategy.
*/
boolean usesMapsIdDerivedIdentityStrategy();
+ String USES_MAPS_ID_DERIVED_IDENTITY_STRATEGY_PROPERTY = "usesMapsIdDerivedIdentityStrategy"; //$NON-NLS-1$
Predicate<DerivedIdentity2_0> USES_MAPS_ID_DERIVED_IDENTITY_STRATEGY = new UsesMapsIdDerivedIdentityStrategy();
class UsesMapsIdDerivedIdentityStrategy
extends PredicateAdapter<DerivedIdentity2_0>
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/builder/EclipseLinkStaticWeavingBuilder.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/builder/EclipseLinkStaticWeavingBuilder.java
index dfe8f6b9b3..e11377e9e5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/builder/EclipseLinkStaticWeavingBuilder.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/builder/EclipseLinkStaticWeavingBuilder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Oracle. All rights reserved.
+ * Copyright (c) 2012, 2016 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -26,35 +26,31 @@ import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCoreMessages;
import org.eclipse.jpt.jpa.eclipselink.core.internal.plugin.JptJpaEclipseLinkCorePlugin;
import org.eclipse.jpt.jpa.eclipselink.core.internal.weave.EclipseLinkStaticWeave;
-public class EclipseLinkStaticWeavingBuilder extends IncrementalProjectBuilder
+public class EclipseLinkStaticWeavingBuilder
+ extends IncrementalProjectBuilder
{
public static final String BUILDER_ID = JptJpaEclipseLinkCorePlugin.instance().getPluginID() + ".builder"; //$NON-NLS-1$
private EclipseLinkStaticWeavingBuilderConfigurator configurator;
- private final SynchronizedBoolean generationCompleted;
- private boolean generationSuccessful;
+ final SynchronizedBoolean generationCompleted = new SynchronizedBoolean(false);
+ boolean generationSuccessful = false;
- // ********** constructor **********
public EclipseLinkStaticWeavingBuilder() {
- this.generationCompleted = new SynchronizedBoolean(false);
+ super();
}
- // ********** IncrementalProjectBuilder implementation **********
/**
* Performs static weaving on project's model classes
*/
@Override
- protected IProject[] build(int kind, Map<String, String> parameters, IProgressMonitor monitor) throws CoreException
- {
+ protected IProject[] build(int kind, Map<String, String> parameters, IProgressMonitor monitor) throws CoreException {
this.staticWeaveGeneratorGenerate(monitor);
return new IProject[0];
}
- // ********** internal methods **********
-
private void staticWeaveGeneratorGenerate(IProgressMonitor monitor) throws CoreException {
this.generationCompleted.setFalse();
this.generationSuccessful = false;
@@ -71,25 +67,21 @@ public class EclipseLinkStaticWeavingBuilder extends IncrementalProjectBuilder
staticWeaveGenerator.generate(monitor);
try {
this.generationCompleted.waitUntilTrue();
- }
- catch (InterruptedException e) {
+ } catch (InterruptedException e) {
throw new RuntimeException(e);
- }
- finally {
+ } finally {
staticWeaveGenerator.removeLaunchConfigListener(launchListener);
this.generationCompleted.setFalse();
}
- this.postGenerate(this.generationSuccessful);
+ this.postGenerate();
}
- protected void postGenerate(boolean generationSuccessful) throws CoreException {
- if( ! generationSuccessful) {
+ protected void postGenerate() throws CoreException {
+ if ( ! this.generationSuccessful) {
throw new RuntimeException(JptJpaEclipseLinkCoreMessages.ECLIPSELINK_STATIC_WEAVING_BUILDER__STATIC_WEAVING_FAILED);
}
- else {
- this.refreshProject();
- }
+ this.refreshProject();
}
private void refreshProject() throws CoreException {
@@ -99,8 +91,8 @@ public class EclipseLinkStaticWeavingBuilder extends IncrementalProjectBuilder
private LaunchConfigListener buildLaunchListener() {
return new LaunchConfigListener() {
- public void launchCompleted(boolean generationSuccessful) {
- EclipseLinkStaticWeavingBuilder.this.generationSuccessful = generationSuccessful;
+ public void launchCompleted(boolean genSuccessful) {
+ EclipseLinkStaticWeavingBuilder.this.generationSuccessful = genSuccessful;
EclipseLinkStaticWeavingBuilder.this.generationCompleted.setTrue();
}
};
@@ -110,8 +102,6 @@ public class EclipseLinkStaticWeavingBuilder extends IncrementalProjectBuilder
return JavaCore.create(this.getProject());
}
- // ********** overrides **********
-
@Override
protected void startupOnInitialize() {
super.startupOnInitialize();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/GeneratorComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/GeneratorComposite.java
index 71610771c7..9e43af681c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/GeneratorComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/GeneratorComposite.java
@@ -76,7 +76,7 @@ public abstract class GeneratorComposite<T extends DatabaseGenerator>
return PropertyValueModelTools.modifiableSubjectModelAspectAdapter_(
this.getSubjectHolder(),
JpaNamedContextModel.NAME_PROPERTY,
- TransformerTools.nullCheck(m -> m.getName()),
+ m -> (m == null) ? null : m.getName(),
(m, value) -> {
if (m != null) {
m.setName(StringTools.isBlank(value) ? null : value);
@@ -121,7 +121,7 @@ public abstract class GeneratorComposite<T extends DatabaseGenerator>
return PropertyValueModelTools.modifiableSubjectModelAspectAdapter_(
this.getSubjectHolder(),
DatabaseGenerator.SPECIFIED_ALLOCATION_SIZE_PROPERTY,
- TransformerTools.nullCheck(m -> m.getSpecifiedAllocationSize()),
+ m -> (m == null) ? null : m.getSpecifiedAllocationSize(),
(m, value) -> retrieveGenerator().setSpecifiedAllocationSize(value)
);
}
@@ -158,7 +158,7 @@ public abstract class GeneratorComposite<T extends DatabaseGenerator>
return PropertyValueModelTools.modifiableSubjectModelAspectAdapter_(
this.getSubjectHolder(),
DatabaseGenerator.SPECIFIED_INITIAL_VALUE_PROPERTY,
- TransformerTools.nullCheck(m -> m.getSpecifiedInitialValue()),
+ m -> (m == null) ? null : m.getSpecifiedInitialValue(),
(m, value) -> retrieveGenerator().setSpecifiedInitialValue(value)
);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/IdMappingGenerationComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/IdMappingGenerationComposite.java
index 5c0fdf9d12..bebc544dfc 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/IdMappingGenerationComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/IdMappingGenerationComposite.java
@@ -460,7 +460,7 @@ public class IdMappingGenerationComposite
return PropertyValueModelTools.modifiableSubjectModelAspectAdapter_(
this.buildGeneratedValueModel(),
GeneratedValue.SPECIFIED_GENERATOR_PROPERTY,
- TransformerTools.nullCheck(m -> m.getSpecifiedGenerator()),
+ m -> (m == null) ? null : m.getSpecifiedGenerator(),
(m, value) -> {
if (m != null) {
m.setSpecifiedGenerator(StringTools.isBlank(value) ? null : value);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinColumnJoiningStrategyPane.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinColumnJoiningStrategyPane.java
index d0a06437c4..0a533336c7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinColumnJoiningStrategyPane.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinColumnJoiningStrategyPane.java
@@ -122,12 +122,12 @@ public class JoinColumnJoiningStrategyPane
}
public static ModifiablePropertyValueModel<Boolean> buildUsesJoinColumnJoiningStrategyModel(PropertyValueModel<? extends JoinColumnRelationship> subjectHolder) {
- return PropertyValueModelTools.modifiableSubjectModelAspectAdapter_(
+ return PropertyValueModelTools.modifiableSubjectModelAspectAdapter(
subjectHolder,
- Relationship.STRATEGY_PROPERTY,
- m -> Boolean.valueOf((m != null) && m.strategyIsJoinColumn()),
+ JoinColumnRelationship.STRATEGY_IS_JOIN_COLUMN_PROPERTY,
+ m -> Boolean.valueOf(m.strategyIsJoinColumn()),
(m, value) -> {
- if ((m != null) && (value != null) && value.booleanValue()) {
+ if ((value != null) && value.booleanValue()) {
((SpecifiedJoinColumnRelationship) m).setStrategyToJoinColumn();
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinTableJoiningStrategyPane.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinTableJoiningStrategyPane.java
index 07335088c3..5637415cf5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinTableJoiningStrategyPane.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinTableJoiningStrategyPane.java
@@ -84,12 +84,12 @@ public class JoinTableJoiningStrategyPane
}
public static ModifiablePropertyValueModel<Boolean> buildUsesJoinTableJoiningStrategyModel(PropertyValueModel<? extends JoinTableRelationship> subjectHolder) {
- return PropertyValueModelTools.modifiableSubjectModelAspectAdapter_(
+ return PropertyValueModelTools.modifiableSubjectModelAspectAdapter(
subjectHolder,
- Relationship.STRATEGY_PROPERTY,
- m -> Boolean.valueOf((m != null) && m.strategyIsJoinTable()),
+ JoinTableRelationship.STRATEGY_IS_JOIN_TABLE_PROPERTY,
+ m -> Boolean.valueOf(m.strategyIsJoinTable()),
(m, value) -> {
- if ((m != null) && (value != null) && value.booleanValue()) {
+ if ((value != null) && value.booleanValue()) {
((SpecifiedJoinTableRelationship) m).setStrategyToJoinTable();
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/ManyToManyJoiningStrategyPane.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/ManyToManyJoiningStrategyPane.java
index df36b15759..b237a2c8d1 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/ManyToManyJoiningStrategyPane.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/ManyToManyJoiningStrategyPane.java
@@ -13,8 +13,9 @@ import org.eclipse.jpt.common.ui.internal.widgets.Pane;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools;
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
+import org.eclipse.jpt.jpa.core.context.JoinTableRelationship;
import org.eclipse.jpt.jpa.core.context.ManyToManyRelationship;
-import org.eclipse.jpt.jpa.core.context.Relationship;
+import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
import org.eclipse.jpt.jpa.ui.details.JptJpaUiDetailsMessages;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -91,12 +92,12 @@ public class ManyToManyJoiningStrategyPane
}
protected ModifiablePropertyValueModel<Boolean> buildUsesMappedByStrategyModel() {
- return PropertyValueModelTools.modifiableSubjectModelAspectAdapter_(
+ return PropertyValueModelTools.modifiableSubjectModelAspectAdapter(
this.getSubjectHolder(),
- Relationship.STRATEGY_PROPERTY,
- m -> Boolean.valueOf((m != null) && m.strategyIsMappedBy()),
+ MappedByRelationship.STRATEGY_IS_MAPPED_BY_PROPERTY,
+ m -> Boolean.valueOf(m.strategyIsMappedBy()),
(m, value) -> {
- if ((m != null) && (value != null) && value.booleanValue()) {
+ if ((value != null) && value.booleanValue()) {
m.setStrategyToMappedBy();
}
}
@@ -104,12 +105,12 @@ public class ManyToManyJoiningStrategyPane
}
protected ModifiablePropertyValueModel<Boolean> buildUsesJoinTableStrategyModel() {
- return PropertyValueModelTools.modifiableSubjectModelAspectAdapter_(
+ return PropertyValueModelTools.modifiableSubjectModelAspectAdapter(
this.getSubjectHolder(),
- Relationship.STRATEGY_PROPERTY,
- m -> Boolean.valueOf((m != null) && m.strategyIsJoinTable()),
+ JoinTableRelationship.STRATEGY_IS_JOIN_TABLE_PROPERTY,
+ m -> Boolean.valueOf(m.strategyIsJoinTable()),
(m, value) -> {
- if ((m != null) && (value != null) && value.booleanValue()) {
+ if ((value != null) && value.booleanValue()) {
m.setStrategyToJoinTable();
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/MappedByJoiningStrategyPane.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/MappedByJoiningStrategyPane.java
index c2d969d36b..18f6219d3b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/MappedByJoiningStrategyPane.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/MappedByJoiningStrategyPane.java
@@ -14,7 +14,6 @@ import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelToo
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
-import org.eclipse.jpt.jpa.core.context.Relationship;
import org.eclipse.jpt.jpa.core.context.SpecifiedMappedByRelationshipStrategy;
import org.eclipse.jpt.jpa.core.context.SpecifiedOrVirtual;
import org.eclipse.swt.widgets.Composite;
@@ -71,12 +70,12 @@ public class MappedByJoiningStrategyPane
}
public static ModifiablePropertyValueModel<Boolean> buildUsesMappedByJoiningStrategyModel(PropertyValueModel<? extends MappedByRelationship> subjectHolder) {
- return PropertyValueModelTools.modifiableSubjectModelAspectAdapter_(
+ return PropertyValueModelTools.modifiableSubjectModelAspectAdapter(
subjectHolder,
- Relationship.STRATEGY_PROPERTY,
- m -> Boolean.valueOf((m != null) && m.strategyIsMappedBy()),
+ MappedByRelationship.STRATEGY_IS_MAPPED_BY_PROPERTY,
+ m -> Boolean.valueOf(m.strategyIsMappedBy()),
(m, value) -> {
- if ((m != null) && (value != null) && value.booleanValue()) {
+ if ((value != null) && value.booleanValue()) {
m.setStrategyToMappedBy();
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PrimaryKeyJoinColumnJoiningStrategyPane.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PrimaryKeyJoinColumnJoiningStrategyPane.java
index d4978af07d..c54f62fed0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PrimaryKeyJoinColumnJoiningStrategyPane.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PrimaryKeyJoinColumnJoiningStrategyPane.java
@@ -14,7 +14,6 @@ import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelToo
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumnRelationship;
-import org.eclipse.jpt.jpa.core.context.Relationship;
import org.eclipse.jpt.jpa.core.context.SpecifiedPrimaryKeyJoinColumnRelationshipStrategy;
import org.eclipse.swt.widgets.Composite;
@@ -54,12 +53,12 @@ public class PrimaryKeyJoinColumnJoiningStrategyPane
}
public static ModifiablePropertyValueModel<Boolean> buildUsesPrimaryKeyJoinColumnJoiningStrategyModel(PropertyValueModel<? extends PrimaryKeyJoinColumnRelationship> subjectHolder) {
- return PropertyValueModelTools.modifiableSubjectModelAspectAdapter_(
+ return PropertyValueModelTools.modifiableSubjectModelAspectAdapter(
subjectHolder,
- Relationship.STRATEGY_PROPERTY,
- m -> Boolean.valueOf((m != null) && m.strategyIsPrimaryKeyJoinColumn()),
+ PrimaryKeyJoinColumnRelationship.STRATEGY_IS_PRIMARY_KEY_JOIN_COLUMN_PROPERTY,
+ m -> Boolean.valueOf(m.strategyIsPrimaryKeyJoinColumn()),
(m, value) -> {
- if ((m != null) && (value != null) && value.booleanValue()) {
+ if ((value != null) && value.booleanValue()) {
m.setStrategyToPrimaryKeyJoinColumn();
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/editors/JpaXmlEditor.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/editors/JpaXmlEditor.java
index 4f4f5a5579..863fec56e0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/editors/JpaXmlEditor.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/editors/JpaXmlEditor.java
@@ -28,7 +28,6 @@ import org.eclipse.jpt.common.utility.internal.model.value.CollectionAspectAdapt
import org.eclipse.jpt.common.utility.internal.model.value.CollectionValueModelTools;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools;
import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter;
import org.eclipse.jpt.common.utility.iterable.ListIterable;
import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent;
import org.eclipse.jpt.common.utility.model.listener.PropertyChangeAdapter;
@@ -36,7 +35,6 @@ import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener;
import org.eclipse.jpt.common.utility.model.value.CollectionValueModel;
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.common.utility.transformer.Transformer;
import org.eclipse.jpt.jpa.core.JpaFile;
import org.eclipse.jpt.jpa.core.JpaPlatform;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
@@ -299,18 +297,7 @@ public class JpaXmlEditor
}
private PropertyValueModel<PropertyValueModel<JpaFile>> buildJpaFileModelModel() {
- return PropertyValueModelTools.transform(this.editorInputModel, JPA_FILE_MODEL_TRANSFORMER);
- }
-
- private static final Transformer<IFileEditorInput, PropertyValueModel<JpaFile>> JPA_FILE_MODEL_TRANSFORMER = new JpaFileModelTransformer();
-
- /* CU private */ static class JpaFileModelTransformer
- extends TransformerAdapter<IFileEditorInput, PropertyValueModel<JpaFile>>
- {
- @Override
- public PropertyValueModel<JpaFile> transform(IFileEditorInput fileEditorInput) {
- return fileEditorInput.getFile().getAdapter(JpaFileModel.class);
- }
+ return PropertyValueModelTools.transform(this.editorInputModel, input -> input.getFile().getAdapter(JpaFileModel.class));
}
/* CU private */ class RootStructureNodeListener
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/DerivedIdentityPane2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/DerivedIdentityPane2_0.java
index ca616d9081..c728bf48af 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/DerivedIdentityPane2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/DerivedIdentityPane2_0.java
@@ -101,31 +101,25 @@ public class DerivedIdentityPane2_0
}
protected ModifiablePropertyValueModel<Boolean> buildUsesIdDerivedIdentityStrategyHolder() {
- return new PropertyAspectAdapterXXXX<DerivedIdentity2_0, Boolean>(
- getSubjectHolder(), DerivedIdentity2_0.PREDOMINANT_DERIVED_IDENTITY_STRATEGY_PROPERTY) {
-
- @Override
- protected Boolean buildValue_() {
- return this.subject.usesIdDerivedIdentityStrategy();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- // radio button - should only have true values here
- if (value) {
- this.subject.setIdDerivedIdentityStrategy();
+ return PropertyValueModelTools.modifiableSubjectModelAspectAdapter(
+ this.getSubjectHolder(),
+ DerivedIdentity2_0.USES_ID_DERIVED_IDENTITY_STRATEGY_PROPERTY,
+ m -> Boolean.valueOf(m.usesIdDerivedIdentityStrategy()),
+ (m, value) -> {
+ if ((value != null) && value.booleanValue()) {
+ m.setIdDerivedIdentityStrategy();
+ }
}
- }
- };
+ );
}
protected ModifiablePropertyValueModel<Boolean> buildUsesMapsIdDerivedIdentityStrategyHolder() {
- return PropertyValueModelTools.modifiableSubjectModelAspectAdapter_(
+ return PropertyValueModelTools.modifiableSubjectModelAspectAdapter(
this.getSubjectHolder(),
- DerivedIdentity2_0.PREDOMINANT_DERIVED_IDENTITY_STRATEGY_PROPERTY,
- m -> Boolean.valueOf((m != null) && m.usesMapsIdDerivedIdentityStrategy()),
+ DerivedIdentity2_0.USES_MAPS_ID_DERIVED_IDENTITY_STRATEGY_PROPERTY,
+ m -> Boolean.valueOf(m.usesMapsIdDerivedIdentityStrategy()),
(m, value) -> {
- if ((m != null) && (value != null) && value.booleanValue()) {
+ if ((value != null) && value.booleanValue()) {
m.setMapsIdDerivedIdentityStrategy();
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/JpaProjectPropertiesPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/JpaProjectPropertiesPage.java
index c63b5e6120..27ccb3755d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/JpaProjectPropertiesPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/JpaProjectPropertiesPage.java
@@ -15,7 +15,6 @@ import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jdt.core.ElementChangedEvent;
@@ -221,18 +220,7 @@ public class JpaProjectPropertiesPage
}
private PropertyValueModel<PropertyValueModel<JpaProject>> buildJpaProjectModelModel() {
- return PropertyValueModelTools.transform(this.projectModel, JPA_PROJECT_MODEL_TRANSFORMER);
- }
-
- private static final Transformer<IProject, PropertyValueModel<JpaProject>> JPA_PROJECT_MODEL_TRANSFORMER = new JpaProjectModelTransformer();
-
- /* CU private */ static class JpaProjectModelTransformer
- extends TransformerAdapter<IProject, PropertyValueModel<JpaProject>>
- {
- @Override
- public PropertyValueModel<JpaProject> transform(IProject project) {
- return project.getAdapter(JpaProjectModel.class);
- }
+ return PropertyValueModelTools.transform(this.projectModel, project -> project.getAdapter(JpaProjectModel.class));
}
// ***** JPA 2.0 project model
@@ -543,8 +531,8 @@ public class JpaProjectPropertiesPage
return PropertyValueModelTools.modifiableSubjectModelAspectAdapter(
this.jpaProject2_0Model,
JpaProject2_0.METAMODEL_SOURCE_FOLDER_NAME_PROPERTY,
- JpaProject2_0.METAMODEL_SOURCE_FOLDER_NAME_TRANSFORMER,
- JpaProject2_0.SET_METAMODEL_SOURCE_FOLDER_NAME_CLOSURE
+ m -> m.getMetamodelSourceFolderName(),
+ (m, value) -> m.setMetamodelSourceFolderName(value)
);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaPageSelectionManager.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaPageSelectionManager.java
index d058b2b53a..109648e4db 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaPageSelectionManager.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaPageSelectionManager.java
@@ -15,12 +15,10 @@ import org.eclipse.jpt.common.ui.internal.PartAdapter2;
import org.eclipse.jpt.common.utility.internal.ObjectTools;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools;
import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter;
import org.eclipse.jpt.common.utility.model.listener.PropertyChangeAdapter;
import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener;
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.common.utility.transformer.Transformer;
import org.eclipse.jpt.jpa.core.JpaFile;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
@@ -139,18 +137,7 @@ class JpaPageSelectionManager
}
private PropertyValueModel<PropertyValueModel<JpaFile>> buildEditorManagerJpaFileModel() {
- return PropertyValueModelTools.transform(this.editorManagerModel, JPA_FILE_MODEL_TRANSFORMER);
- }
-
- private static final Transformer<JpaEditorManager, PropertyValueModel<JpaFile>> JPA_FILE_MODEL_TRANSFORMER = new JpaFileModelTransformer();
-
- /* CU private */ static class JpaFileModelTransformer
- extends TransformerAdapter<JpaEditorManager, PropertyValueModel<JpaFile>>
- {
- @Override
- public PropertyValueModel<JpaFile> transform(JpaEditorManager editorManager) {
- return editorManager.getJpaFileModel();
- }
+ return PropertyValueModelTools.transform(this.editorManagerModel, mgr -> mgr.getJpaFileModel());
}
@@ -165,18 +152,7 @@ class JpaPageSelectionManager
}
private PropertyValueModel<ModifiablePropertyValueModel<JpaStructureNode>> buildEditorManagerJpaSelectionModel() {
- return PropertyValueModelTools.transform(this.editorManagerModel, JPA_SELECTION_MODEL_TRANSFORMER);
- }
-
- private static final Transformer<JpaEditorManager, ModifiablePropertyValueModel<JpaStructureNode>> JPA_SELECTION_MODEL_TRANSFORMER = new JpaSelectionModelTransformer();
-
- /* CU private */ static class JpaSelectionModelTransformer
- extends TransformerAdapter<JpaEditorManager, ModifiablePropertyValueModel<JpaStructureNode>>
- {
- @Override
- public ModifiablePropertyValueModel<JpaStructureNode> transform(JpaEditorManager editorManager) {
- return editorManager.getJpaSelectionModel();
- }
+ return PropertyValueModelTools.transform(this.editorManagerModel, mgr -> mgr.getJpaSelectionModel());
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaTextEditorManager.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaTextEditorManager.java
index c21b8a6dba..c3a0372bf9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaTextEditorManager.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaTextEditorManager.java
@@ -23,13 +23,11 @@ import org.eclipse.jpt.common.ui.internal.swt.widgets.DisplayTools;
import org.eclipse.jpt.common.utility.internal.ObjectTools;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools;
import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel;
-import org.eclipse.jpt.common.utility.internal.transformer.TransformerAdapter;
import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent;
import org.eclipse.jpt.common.utility.model.listener.PropertyChangeAdapter;
import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener;
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
-import org.eclipse.jpt.common.utility.transformer.Transformer;
import org.eclipse.jpt.jpa.core.JpaFile;
import org.eclipse.jpt.jpa.core.JpaStructureNode;
import org.eclipse.jpt.jpa.ui.JpaFileModel;
@@ -140,18 +138,7 @@ class JpaTextEditorManager
}
private PropertyValueModel<PropertyValueModel<JpaFile>> buildJpaFileModelModel() {
- return PropertyValueModelTools.transform(this.fileModel, JPA_FILE_MODEL_TRANSFORMER);
- }
-
- private static final Transformer<IFile, PropertyValueModel<JpaFile>> JPA_FILE_MODEL_TRANSFORMER = new JpaFileModelTransformer();
-
- /* CU private */ static class JpaFileModelTransformer
- extends TransformerAdapter<IFile, PropertyValueModel<JpaFile>>
- {
- @Override
- public PropertyValueModel<JpaFile> transform(IFile file) {
- return file.getAdapter(JpaFileModel.class);
- }
+ return PropertyValueModelTools.transform(this.fileModel, file -> file.getAdapter(JpaFileModel.class));
}
/* CU private */ class JpaFileListener

Back to the top