Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Vosburgh2016-09-02 16:09:31 +0000
committerBrian Vosburgh2017-05-18 22:39:13 +0000
commite94276681a1f2456d54a1be79863ce8506c43996 (patch)
treea492261cbf249aab52d6751b6ab8e2b03e4ceeb3
parent6fb9675bb422ae08f19da32e64912930a1ef37bd (diff)
downloadwebtools.dali-e94276681a1f2456d54a1be79863ce8506c43996.tar.gz
webtools.dali-e94276681a1f2456d54a1be79863ce8506c43996.tar.xz
webtools.dali-e94276681a1f2456d54a1be79863ce8506c43996.zip
rework aspect adapters that adapt multiple aspects
-rw-r--r--common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyAspectAdapterXXXX.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Entity.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/FetchableMapping.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdTypeMapping.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipMapping.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TypeMapping.java1
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeMapping.java1
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmAttributeMapping.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java83
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CollectionMapping2_0.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ElementCollectionMapping2_0.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/PersistenceUnit2_0.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkCaching.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaCachingImpl.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmCachingImpl.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkCachingComposite.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkExpiryComposite.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMultitenancyComposite.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMutableTriStateCheckBox.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkTenantDiscriminatorColumnComposite.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmAttributeTypeClassChooser.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/EclipseLinkPersistenceUnitCachingEditorPage2_0.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/EclipseLinkConnectionPropertiesComposite.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractInheritanceComposite.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/ColumnComposite.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/EntityNameCombo.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/IdClassChooser.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/TargetEntityClassChooser.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/CacheableTriStateCheckBox2_0.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OrderColumnComposite2_0.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OrphanRemovalTriStateCheckBox2_0.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/TargetClassChooser2_0.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/PersistenceUnitConnectionEditorPage2_0.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitClassesComposite.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitConnectionEditorPage.java15
42 files changed, 557 insertions, 497 deletions
diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyAspectAdapterXXXX.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyAspectAdapterXXXX.java
index 2db4878230..e50a387f3a 100644
--- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyAspectAdapterXXXX.java
+++ b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyAspectAdapterXXXX.java
@@ -48,12 +48,12 @@ public abstract class PropertyAspectAdapterXXXX<S extends Model, V>
* Construct a property aspect adapter for the specified subject model
* and property aspects.
*/
- protected PropertyAspectAdapterXXXX(PropertyValueModel<? extends S> subjectModel, String... aspectNames) {
+ protected PropertyAspectAdapterXXXX(PropertyValueModel<? extends S> subjectModel, String aspectName) {
super(subjectModel);
- if (aspectNames == null) {
+ if (aspectName == null) {
throw new NullPointerException();
}
- this.aspectNames = aspectNames;
+ this.aspectNames = new String[] {aspectName};
this.aspectChangeListener = this.buildAspectChangeListener();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Entity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Entity.java
index f3173d63f0..de459d0ce5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Entity.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Entity.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2006, 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.
@@ -15,7 +15,7 @@ import org.eclipse.jpt.common.utility.internal.predicate.PredicateAdapter;
import org.eclipse.jpt.common.utility.iterable.ListIterable;
/**
- * entity
+ * Entity
* <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -27,8 +27,8 @@ import org.eclipse.jpt.common.utility.iterable.ListIterable;
* @since 2.0
*/
public interface Entity
- extends IdTypeMapping {
-
+ extends IdTypeMapping
+{
// ********** name **********
String getSpecifiedName();
@@ -132,6 +132,7 @@ public interface Entity
* inheritance strategy.
*/
InheritanceType getInheritanceStrategy();
+ String INHERITANCE_STRATEGY_PROPERTY = "inheritanceStrategy"; //$NON-NLS-1$
InheritanceType getSpecifiedInheritanceStrategy();
void setSpecifiedInheritanceStrategy(InheritanceType inheritanceType);
String SPECIFIED_INHERITANCE_STRATEGY_PROPERTY = "specifiedInheritanceStrategy"; //$NON-NLS-1$
@@ -149,6 +150,7 @@ public interface Entity
SpecifiedDiscriminatorColumn getDiscriminatorColumn();
String getDiscriminatorValue();
+ String DISCRIMINATOR_VALUE_PROPERTY = "discriminatorValue"; //$NON-NLS-1$
String getSpecifiedDiscriminatorValue();
void setSpecifiedDiscriminatorValue(String value);
String SPECIFIED_DISCRIMINATOR_VALUE_PROPERTY = "specifiedDiscriminatorValue"; //$NON-NLS-1$
@@ -325,5 +327,4 @@ public interface Entity
* Else return null.
*/
SpecifiedPersistentAttribute getIdAttribute();
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/FetchableMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/FetchableMapping.java
index 31dec5ef31..5f623e95e8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/FetchableMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/FetchableMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 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.
@@ -25,7 +25,8 @@ public interface FetchableMapping
extends AttributeMapping
{
FetchType getFetch();
-
+ String FETCH_PROPERTY = "fetch"; //$NON-NLS-1$
+
FetchType getSpecifiedFetch();
void setSpecifiedFetch(FetchType newSpecifiedFetch);
String SPECIFIED_FETCH_PROPERTY = "specifiedFetch"; //$NON-NLS-1$
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdTypeMapping.java
index 01467577ee..38f59434f3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdTypeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdTypeMapping.java
@@ -26,8 +26,8 @@ import org.eclipse.jpt.common.utility.transformer.Transformer;
* @since 3.5
*/
public interface IdTypeMapping
- extends TypeMapping {
-
+ extends TypeMapping
+{
// ***** primary key *****
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipMapping.java
index aa457c1b67..ce8f778ce6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipMapping.java
@@ -52,7 +52,8 @@ public interface RelationshipMapping
// **************** target entity **************************************
String getTargetEntity();
-
+ String TARGET_ENTITY_PROPERTY = "targetEntity"; //$NON-NLS-1$
+
String getSpecifiedTargetEntity();
void setSpecifiedTargetEntity(String value);
String SPECIFIED_TARGET_ENTITY_PROPERTY = "specifiedTargetEntity"; //$NON-NLS-1$
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TypeMapping.java
index 3c91fa502f..a5cc095b37 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TypeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TypeMapping.java
@@ -63,6 +63,7 @@ public interface TypeMapping
* Return the name, specified or default if not specified.
*/
String getName();
+ String NAME_PROPERTY = "name"; //$NON-NLS-1$
boolean isMapped();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeMapping.java
index 5131f04934..fc25d17ecf 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeMapping.java
@@ -46,6 +46,7 @@ public interface OrmAttributeMapping
* (qualified) default type.
*/
String getAttributeType();
+ String ATTRIBUTE_TYPE_PROPERTY = "attributeType"; //$NON-NLS-1$
String getFullyQualifiedAttributeType();
String FULLY_QUALIFIED_ATTRIBUTE_TYPE_PROPERTY = "fullyQualifiedAttributeType"; //$NON-NLS-1$
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java
index 6503719b17..0187865c36 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java
@@ -104,17 +104,13 @@ public interface PersistenceUnit
* whether specified or defaulted.
*/
PersistenceUnitTransactionType getTransactionType();
-
- /**
- * String constant associated with changes to the persistence unit's
- * specified transaction type
- */
- String SPECIFIED_TRANSACTION_TYPE_PROPERTY = "specifiedTransactionType"; //$NON-NLS-1$
+ String TRANSACTION_TYPE_PROPERTY = "transactionType"; //$NON-NLS-1$
/**
* Return the persistence unit's specified transaction type.
*/
PersistenceUnitTransactionType getSpecifiedTransactionType();
+ String SPECIFIED_TRANSACTION_TYPE_PROPERTY = "specifiedTransactionType"; //$NON-NLS-1$
/**
* Set the persistence unit's specified transaction type.
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java
index 6d4c6d0254..c267cd02b0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2015 Oracle. All rights reserved.
+ * Copyright (c) 2006, 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.
@@ -108,14 +108,15 @@ import org.eclipse.wst.validation.internal.provisional.core.IReporter;
* Java entity
*/
public abstract class AbstractJavaEntity
- extends AbstractJavaIdTypeMapping<EntityAnnotation>
- implements JavaEntity2_0, JavaGeneratorContainer.Parent, JavaQueryContainer.Parent {
-
+ extends AbstractJavaIdTypeMapping<EntityAnnotation>
+ implements JavaEntity2_0, JavaGeneratorContainer.Parent, JavaQueryContainer.Parent
+{
protected String specifiedName;
protected String defaultName;
+ protected String name;
protected Entity rootEntity;
- protected final Vector<Entity> descendants = new Vector<Entity>();
+ protected final Vector<Entity> descendants = new Vector<>();
protected final JavaSpecifiedTable table;
protected boolean specifiedTableIsAllowed;
@@ -130,9 +131,11 @@ public abstract class AbstractJavaEntity
protected InheritanceType specifiedInheritanceStrategy;
protected InheritanceType defaultInheritanceStrategy;
+ protected InheritanceType inheritanceStrategy;
protected String specifiedDiscriminatorValue;
protected String defaultDiscriminatorValue;
+ protected String discriminatorValue;
protected boolean specifiedDiscriminatorValueIsAllowed;
protected boolean discriminatorValueIsUndefined;
@@ -190,14 +193,16 @@ public abstract class AbstractJavaEntity
@Override
public void update(IProgressMonitor monitor) {
super.update(monitor);
-
+
this.setDefaultName(this.buildDefaultName());
+ this.setName(this.buildName());
// calculate root entity early - other things depend on it
this.setRootEntity(this.buildRootEntity());
this.updateDescendants();
this.setDefaultInheritanceStrategy(this.buildDefaultInheritanceStrategy());
+ this.setInheritanceStrategy(this.buildInheritanceStrategy());
this.table.update(monitor);
this.setSpecifiedTableIsAllowed(this.buildSpecifiedTableIsAllowed());
@@ -213,6 +218,7 @@ public abstract class AbstractJavaEntity
this.setDiscriminatorColumnIsUndefined(this.buildDiscriminatorColumnIsUndefined());
this.setDefaultDiscriminatorValue(this.buildDefaultDiscriminatorValue());
+ this.setDiscriminatorValue(this.buildDiscriminatorValue());
this.setSpecifiedDiscriminatorValueIsAllowed(this.buildSpecifiedDiscriminatorValueIsAllowed());
this.setDiscriminatorValueIsUndefined(this.buildDiscriminatorValueIsUndefined());
@@ -228,6 +234,15 @@ public abstract class AbstractJavaEntity
@Override
public String getName() {
+ return this.name;
+ }
+
+ protected void setName(String name) {
+ String old = this.name;
+ this.firePropertyChanged(NAME_PROPERTY, old, this.name = name);
+ }
+
+ protected String buildName() {
return (this.specifiedName != null) ? this.specifiedName : this.defaultName;
}
@@ -242,8 +257,7 @@ public abstract class AbstractJavaEntity
protected void setSpecifiedName_(String name) {
String old = this.specifiedName;
- this.specifiedName = name;
- this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name);
+ this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, this.specifiedName = name);
}
public String getDefaultName() {
@@ -252,8 +266,7 @@ public abstract class AbstractJavaEntity
protected void setDefaultName(String name) {
String old = this.defaultName;
- this.defaultName = name;
- this.firePropertyChanged(DEFAULT_NAME_PROPERTY, old, name);
+ this.firePropertyChanged(DEFAULT_NAME_PROPERTY, old, this.defaultName = name);
}
protected String buildDefaultName() {
@@ -438,7 +451,7 @@ public abstract class AbstractJavaEntity
}
protected ListIterable<SecondaryTableAnnotation> getSecondaryTableAnnotations_() {
- return new SubListIterableWrapper<NestableAnnotation, SecondaryTableAnnotation>(this.getNestableSecondaryTableAnnotations_());
+ return new SubListIterableWrapper<>(this.getNestableSecondaryTableAnnotations_());
}
protected ListIterable<NestableAnnotation> getNestableSecondaryTableAnnotations_() {
@@ -555,7 +568,7 @@ public abstract class AbstractJavaEntity
}
protected ListIterable<PrimaryKeyJoinColumnAnnotation> getPrimaryKeyJoinColumnAnnotations_() {
- return new SubListIterableWrapper<NestableAnnotation, PrimaryKeyJoinColumnAnnotation>(this.getNestablePrimaryKeyJoinColumnAnnotations_());
+ return new SubListIterableWrapper<>(this.getNestablePrimaryKeyJoinColumnAnnotations_());
}
protected ListIterable<NestableAnnotation> getNestablePrimaryKeyJoinColumnAnnotations_() {
@@ -605,7 +618,7 @@ public abstract class AbstractJavaEntity
protected ListIterable<JavaSpecifiedPrimaryKeyJoinColumn> getDefaultPrimaryKeyJoinColumns() {
return (this.defaultPrimaryKeyJoinColumn != null) ?
- new SingleElementListIterable<JavaSpecifiedPrimaryKeyJoinColumn>(this.defaultPrimaryKeyJoinColumn) :
+ new SingleElementListIterable<>(this.defaultPrimaryKeyJoinColumn) :
EmptyListIterable.<JavaSpecifiedPrimaryKeyJoinColumn>instance();
}
@@ -637,6 +650,15 @@ public abstract class AbstractJavaEntity
// ********** inheritance strategy **********
public InheritanceType getInheritanceStrategy() {
+ return this.inheritanceStrategy;
+ }
+
+ protected void setInheritanceStrategy(InheritanceType inheritanceType) {
+ InheritanceType old = this.inheritanceStrategy;
+ this.firePropertyChanged(DEFAULT_INHERITANCE_STRATEGY_PROPERTY, old, this.inheritanceStrategy = inheritanceType);
+ }
+
+ protected InheritanceType buildInheritanceStrategy() {
return (this.specifiedInheritanceStrategy != null) ? this.specifiedInheritanceStrategy : this.defaultInheritanceStrategy;
}
@@ -654,8 +676,7 @@ public abstract class AbstractJavaEntity
protected void setSpecifiedInheritanceStrategy_(InheritanceType inheritanceType) {
InheritanceType old = this.specifiedInheritanceStrategy;
- this.specifiedInheritanceStrategy = inheritanceType;
- this.firePropertyChanged(SPECIFIED_INHERITANCE_STRATEGY_PROPERTY, old, inheritanceType);
+ this.firePropertyChanged(SPECIFIED_INHERITANCE_STRATEGY_PROPERTY, old, this.specifiedInheritanceStrategy = inheritanceType);
}
protected InheritanceType buildSpecifiedInheritanceStrategy() {
@@ -668,8 +689,7 @@ public abstract class AbstractJavaEntity
protected void setDefaultInheritanceStrategy(InheritanceType inheritanceType) {
InheritanceType old = this.defaultInheritanceStrategy;
- this.defaultInheritanceStrategy = inheritanceType;
- this.firePropertyChanged(DEFAULT_INHERITANCE_STRATEGY_PROPERTY, old, inheritanceType);
+ this.firePropertyChanged(DEFAULT_INHERITANCE_STRATEGY_PROPERTY, old, this.defaultInheritanceStrategy = inheritanceType);
}
protected InheritanceType buildDefaultInheritanceStrategy() {
@@ -697,6 +717,15 @@ public abstract class AbstractJavaEntity
// ********** discriminator value **********
public String getDiscriminatorValue() {
+ return this.discriminatorValue;
+ }
+
+ protected void setDiscriminatorValue(String discriminatorValue) {
+ String old = this.discriminatorValue;
+ this.firePropertyChanged(DISCRIMINATOR_VALUE_PROPERTY, old, this.discriminatorValue = discriminatorValue);
+ }
+
+ protected String buildDiscriminatorValue() {
return (this.specifiedDiscriminatorValue != null) ? this.specifiedDiscriminatorValue : this.defaultDiscriminatorValue;
}
@@ -714,8 +743,7 @@ public abstract class AbstractJavaEntity
protected void setSpecifiedDiscriminatorValue_(String discriminatorValue) {
String old = this.specifiedDiscriminatorValue;
- this.specifiedDiscriminatorValue = discriminatorValue;
- this.firePropertyChanged(SPECIFIED_DISCRIMINATOR_VALUE_PROPERTY, old, discriminatorValue);
+ this.firePropertyChanged(SPECIFIED_DISCRIMINATOR_VALUE_PROPERTY, old, this.specifiedDiscriminatorValue = discriminatorValue);
}
public String getDefaultDiscriminatorValue() {
@@ -724,8 +752,7 @@ public abstract class AbstractJavaEntity
protected void setDefaultDiscriminatorValue(String discriminatorValue) {
String old = this.defaultDiscriminatorValue;
- this.defaultDiscriminatorValue = discriminatorValue;
- this.firePropertyChanged(DEFAULT_DISCRIMINATOR_VALUE_PROPERTY, old, discriminatorValue);
+ this.firePropertyChanged(DEFAULT_DISCRIMINATOR_VALUE_PROPERTY, old, this.defaultDiscriminatorValue = discriminatorValue);
}
/**
@@ -1061,9 +1088,9 @@ public abstract class AbstractJavaEntity
EmptyIterable.<String>instance();
}
- public AttributeMapping resolveAttributeMapping(String name) {
+ public AttributeMapping resolveAttributeMapping(String mappingName) {
for (AttributeMapping attributeMapping : this.getAllAttributeMappings()) {
- AttributeMapping resolvedMapping = attributeMapping.resolveAttributeMapping(name);
+ AttributeMapping resolvedMapping = attributeMapping.resolveAttributeMapping(mappingName);
if (resolvedMapping != null) {
return resolvedMapping;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java
index 2e51900dd9..81dc00e6b5 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java
@@ -45,6 +45,7 @@ public abstract class AbstractJavaRelationshipMapping<A extends RelationshipMapp
{
protected String specifiedTargetEntity;
protected String defaultTargetEntity;
+ protected String targetEntity;
protected String fullyQualifiedTargetEntity;
protected final JavaMappingRelationship relationship;
@@ -53,6 +54,7 @@ public abstract class AbstractJavaRelationshipMapping<A extends RelationshipMapp
protected FetchType specifiedFetch;
protected FetchType defaultFetch;
+ protected FetchType fetch;
protected AbstractJavaRelationshipMapping(JavaSpecifiedPersistentAttribute parent) {
@@ -79,16 +81,27 @@ public abstract class AbstractJavaRelationshipMapping<A extends RelationshipMapp
public void update(IProgressMonitor monitor) {
super.update(monitor);
this.setDefaultTargetEntity(this.buildDefaultTargetEntity());
+ this.setTargetEntity(this.buildTargetEntity());
this.setFullyQualifiedTargetEntity(this.buildFullyQualifiedTargetEntity());
this.relationship.update(monitor);
this.cascade.update(monitor);
this.setDefaultFetch(this.buildDefaultFetch());
+ this.setFetch(this.buildFetch());
}
// ********** target entity **********
public String getTargetEntity() {
+ return this.targetEntity;
+ }
+
+ protected void setTargetEntity(String entity) {
+ String old = this.targetEntity;
+ this.firePropertyChanged(TARGET_ENTITY_PROPERTY, old, this.targetEntity = entity);
+ }
+
+ protected String buildTargetEntity() {
return (this.specifiedTargetEntity != null) ? this.specifiedTargetEntity : this.defaultTargetEntity;
}
@@ -105,8 +118,7 @@ public abstract class AbstractJavaRelationshipMapping<A extends RelationshipMapp
protected void setSpecifiedTargetEntity_(String entity) {
String old = this.specifiedTargetEntity;
- this.specifiedTargetEntity = entity;
- this.firePropertyChanged(SPECIFIED_TARGET_ENTITY_PROPERTY, old, entity);
+ this.firePropertyChanged(SPECIFIED_TARGET_ENTITY_PROPERTY, old, this.specifiedTargetEntity = entity);
}
protected String buildSpecifiedTargetEntity() {
@@ -120,8 +132,7 @@ public abstract class AbstractJavaRelationshipMapping<A extends RelationshipMapp
protected void setDefaultTargetEntity(String entity) {
String old = this.defaultTargetEntity;
- this.defaultTargetEntity = entity;
- this.firePropertyChanged(DEFAULT_TARGET_ENTITY_PROPERTY, old, entity);
+ this.firePropertyChanged(DEFAULT_TARGET_ENTITY_PROPERTY, old, this.defaultTargetEntity = entity);
}
protected abstract String buildDefaultTargetEntity();
@@ -180,6 +191,15 @@ public abstract class AbstractJavaRelationshipMapping<A extends RelationshipMapp
// ********** fetch **********
public FetchType getFetch() {
+ return this.fetch;
+ }
+
+ protected void setFetch(FetchType fetch) {
+ FetchType old = this.fetch;
+ this.firePropertyChanged(FETCH_PROPERTY, old, this.fetch = fetch);
+ }
+
+ protected FetchType buildFetch() {
return (this.specifiedFetch != null) ? this.specifiedFetch : this.defaultFetch;
}
@@ -196,8 +216,7 @@ public abstract class AbstractJavaRelationshipMapping<A extends RelationshipMapp
protected void setSpecifiedFetch_(FetchType fetch) {
FetchType old = this.specifiedFetch;
- this.specifiedFetch = fetch;
- this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, fetch);
+ this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, this.specifiedFetch = fetch);
}
protected FetchType buildSpecifiedFetch() {
@@ -211,8 +230,7 @@ public abstract class AbstractJavaRelationshipMapping<A extends RelationshipMapp
protected void setDefaultFetch(FetchType fetch) {
FetchType old = this.defaultFetch;
- this.defaultFetch = fetch;
- this.firePropertyChanged(DEFAULT_FETCH_PROPERTY, old, fetch);
+ this.firePropertyChanged(DEFAULT_FETCH_PROPERTY, old, this.defaultFetch = fetch);
}
protected abstract FetchType buildDefaultFetch();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmAttributeMapping.java
index 39ae713d79..3a34256672 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmAttributeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmAttributeMapping.java
@@ -71,6 +71,7 @@ public abstract class AbstractOrmAttributeMapping<X extends XmlAttributeMapping>
protected String specifiedAttributeType;
protected String defaultAttributeType;
+ protected String attributeType;
protected String fullyQualifiedAttributeType;
@@ -95,6 +96,7 @@ public abstract class AbstractOrmAttributeMapping<X extends XmlAttributeMapping>
public void update(IProgressMonitor monitor) {
super.update(monitor);
this.setDefaultAttributeType(this.buildDefaultAttributeType());
+ this.setAttributeType(this.buildAttributeType());
this.setFullyQualifiedAttributeType(this.buildFullyQualifiedAttributeType());
}
@@ -141,6 +143,15 @@ public abstract class AbstractOrmAttributeMapping<X extends XmlAttributeMapping>
// ********** attribute type **********
public String getAttributeType() {
+ return this.attributeType;
+ }
+
+ protected void setAttributeType(String attributeType) {
+ String old = this.attributeType;
+ this.firePropertyChanged(ATTRIBUTE_TYPE_PROPERTY, old, this.attributeType = attributeType);
+ }
+
+ protected String buildAttributeType() {
return (this.specifiedAttributeType != null) ? this.specifiedAttributeType : this.defaultAttributeType;
}
@@ -155,8 +166,7 @@ public abstract class AbstractOrmAttributeMapping<X extends XmlAttributeMapping>
protected void setSpecifiedAttributeType_(String attributeType) {
String old = this.specifiedAttributeType;
- this.specifiedAttributeType = attributeType;
- this.firePropertyChanged(SPECIFIED_ATTRIBUTE_TYPE_PROPERTY, old, attributeType);
+ this.firePropertyChanged(SPECIFIED_ATTRIBUTE_TYPE_PROPERTY, old, this.specifiedAttributeType = attributeType);
}
/**
@@ -179,8 +189,7 @@ public abstract class AbstractOrmAttributeMapping<X extends XmlAttributeMapping>
protected void setDefaultAttributeType(String attributeType) {
String old = this.defaultAttributeType;
- this.defaultAttributeType = attributeType;
- this.firePropertyChanged(DEFAULT_ATTRIBUTE_TYPE_PROPERTY, old, attributeType);
+ this.firePropertyChanged(DEFAULT_ATTRIBUTE_TYPE_PROPERTY, old, this.defaultAttributeType = attributeType);
}
protected String buildDefaultAttributeType() {
@@ -346,19 +355,19 @@ public abstract class AbstractOrmAttributeMapping<X extends XmlAttributeMapping>
public Iterable<String> getAllMappingNames() {
return (this.name != null) ?
- new SingleElementIterable<String>(this.name) :
+ new SingleElementIterable<>(this.name) :
EmptyIterable.<String>instance();
}
public Iterable<String> getAllOverridableAttributeMappingNames() {
return ((this.name != null) && this.isOverridableAttributeMapping()) ?
- new SingleElementIterable<String>(this.name) :
+ new SingleElementIterable<>(this.name) :
EmptyIterable.<String>instance();
}
public Iterable<String> getAllOverridableAssociationMappingNames() {
return ((this.name != null) && this.isOverridableAssociationMapping()) ?
- new SingleElementIterable<String>(this.name) :
+ new SingleElementIterable<>(this.name) :
EmptyIterable.<String>instance();
}
@@ -423,7 +432,7 @@ public abstract class AbstractOrmAttributeMapping<X extends XmlAttributeMapping>
}
protected final Iterable<String> getMetamodelFieldTypeArgumentNames() {
- ArrayList<String> typeArgumentNames = new ArrayList<String>(3);
+ ArrayList<String> typeArgumentNames = new ArrayList<>(3);
typeArgumentNames.add(this.getTypeMapping().getPersistentType().getName());
this.addMetamodelFieldTypeArgumentNamesTo(typeArgumentNames);
return typeArgumentNames;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java
index caf9a6c4e7..d0759c45cd 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java
@@ -128,9 +128,10 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
protected String specifiedName;
protected String defaultName;
+ protected String name;
protected Entity rootEntity;
- protected final Vector<Entity> descendants = new Vector<Entity>();
+ protected final Vector<Entity> descendants = new Vector<>();
protected final OrmSpecifiedTable table;
protected boolean specifiedTableIsAllowed;
@@ -144,7 +145,7 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
protected final ContextListContainer<OrmSpecifiedPrimaryKeyJoinColumn, XmlPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumnContainer;
// this is the default if there are Java columns
- protected final Vector<OrmVirtualPrimaryKeyJoinColumn> virtualPrimaryKeyJoinColumns = new Vector<OrmVirtualPrimaryKeyJoinColumn>();
+ protected final Vector<OrmVirtualPrimaryKeyJoinColumn> virtualPrimaryKeyJoinColumns = new Vector<>();
protected final VirtualPrimaryKeyJoinColumnContainerAdapter virtualPrimaryKeyJoinColumnContainerAdapter = new VirtualPrimaryKeyJoinColumnContainerAdapter();
// this is the default if there are *no* Java columns
@@ -152,9 +153,11 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
protected InheritanceType specifiedInheritanceStrategy;
protected InheritanceType defaultInheritanceStrategy;
+ protected InheritanceType inheritanceStrategy;
protected String specifiedDiscriminatorValue;
protected String defaultDiscriminatorValue;
+ protected String discriminatorValue;
protected boolean specifiedDiscriminatorValueIsAllowed;
protected boolean discriminatorValueIsUndefined;
@@ -220,15 +223,17 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
@Override
public void update(IProgressMonitor monitor) {
super.update(monitor);
-
+
this.setDefaultName(this.buildDefaultName());
-
+ this.setName(this.buildName());
+
// calculate root entity early - other things depend on it
this.setRootEntity(this.buildRootEntity());
this.updateDescendants();
this.setDefaultInheritanceStrategy(this.buildDefaultInheritanceStrategy());
-
+ this.setInheritanceStrategy(this.buildInheritanceStrategy());
+
this.table.update(monitor);
this.setSpecifiedTableIsAllowed(this.buildSpecifiedTableIsAllowed());
this.setTableIsUndefined(this.buildTableIsUndefined());
@@ -244,6 +249,7 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
this.setDiscriminatorColumnIsUndefined(this.buildDiscriminatorColumnIsUndefined());
this.setDefaultDiscriminatorValue(this.buildDefaultDiscriminatorValue());
+ this.setDiscriminatorValue(this.buildDiscriminatorValue());
this.setSpecifiedDiscriminatorValueIsAllowed(this.buildSpecifiedDiscriminatorValueIsAllowed());
this.setDiscriminatorValueIsUndefined(this.buildDiscriminatorValueIsUndefined());
@@ -259,6 +265,15 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
@Override
public String getName() {
+ return this.name;
+ }
+
+ protected void setName(String name) {
+ String old = this.name;
+ this.firePropertyChanged(NAME_PROPERTY, old, this.name = name);
+ }
+
+ protected String buildName() {
return (this.specifiedName != null) ? this.specifiedName : this.defaultName;
}
@@ -273,8 +288,7 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
protected void setSpecifiedName_(String name) {
String old = this.specifiedName;
- this.specifiedName = name;
- this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name);
+ this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, this.specifiedName = name);
}
public String getDefaultName() {
@@ -283,8 +297,7 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
protected void setDefaultName(String name) {
String old = this.defaultName;
- this.defaultName = name;
- this.firePropertyChanged(DEFAULT_NAME_PROPERTY, old, name);
+ this.firePropertyChanged(DEFAULT_NAME_PROPERTY, old, this.defaultName = name);
}
protected String buildDefaultName() {
@@ -470,7 +483,7 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
}
protected ListIterable<SecondaryTable> getReadOnlySpecifiedSecondaryTables() {
- return new SuperListIterableWrapper<SecondaryTable>(this.getSpecifiedSecondaryTables());
+ return new SuperListIterableWrapper<>(this.getSpecifiedSecondaryTables());
}
public int getSpecifiedSecondaryTablesSize() {
@@ -573,7 +586,7 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
}
protected ListIterable<SecondaryTable> getReadOnlyVirtualSecondaryTables() {
- return new SuperListIterableWrapper<SecondaryTable>(this.getVirtualSecondaryTables());
+ return new SuperListIterableWrapper<>(this.getVirtualSecondaryTables());
}
public int getVirtualSecondaryTablesSize() {
@@ -731,7 +744,7 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
}
protected ListIterable<PrimaryKeyJoinColumn> getReadOnlySpecifiedPrimaryKeyJoinColumns() {
- return new SuperListIterableWrapper<PrimaryKeyJoinColumn>(this.getSpecifiedPrimaryKeyJoinColumns());
+ return new SuperListIterableWrapper<>(this.getSpecifiedPrimaryKeyJoinColumns());
}
public int getSpecifiedPrimaryKeyJoinColumnsSize() {
@@ -1002,7 +1015,7 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
protected ListIterable<PrimaryKeyJoinColumn> getReadOnlyDefaultPrimaryKeyJoinColumns() {
return (this.defaultPrimaryKeyJoinColumn != null) ?
- new SingleElementListIterable<PrimaryKeyJoinColumn>(this.defaultPrimaryKeyJoinColumn) :
+ new SingleElementListIterable<>(this.defaultPrimaryKeyJoinColumn) :
EmptyListIterable.<PrimaryKeyJoinColumn>instance();
}
@@ -1026,6 +1039,15 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
@Override
public InheritanceType getInheritanceStrategy() {
+ return this.inheritanceStrategy;
+ }
+
+ protected void setInheritanceStrategy(InheritanceType inheritanceType) {
+ InheritanceType old = this.inheritanceStrategy;
+ this.firePropertyChanged(DEFAULT_INHERITANCE_STRATEGY_PROPERTY, old, this.inheritanceStrategy = inheritanceType);
+ }
+
+ protected InheritanceType buildInheritanceStrategy() {
return (this.specifiedInheritanceStrategy != null) ? this.specifiedInheritanceStrategy : this.defaultInheritanceStrategy;
}
@@ -1044,8 +1066,7 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
protected void setSpecifiedInheritanceStrategy_(InheritanceType inheritanceType) {
InheritanceType old = this.specifiedInheritanceStrategy;
- this.specifiedInheritanceStrategy = inheritanceType;
- this.firePropertyChanged(SPECIFIED_INHERITANCE_STRATEGY_PROPERTY, old, inheritanceType);
+ this.firePropertyChanged(SPECIFIED_INHERITANCE_STRATEGY_PROPERTY, old, this.specifiedInheritanceStrategy = inheritanceType);
}
protected InheritanceType buildSpecifiedInheritanceStrategy() {
@@ -1076,8 +1097,7 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
protected void setDefaultInheritanceStrategy(InheritanceType inheritanceType) {
InheritanceType old = this.defaultInheritanceStrategy;
- this.defaultInheritanceStrategy = inheritanceType;
- this.firePropertyChanged(DEFAULT_INHERITANCE_STRATEGY_PROPERTY, old, inheritanceType);
+ this.firePropertyChanged(DEFAULT_INHERITANCE_STRATEGY_PROPERTY, old, this.defaultInheritanceStrategy = inheritanceType);
}
protected InheritanceType buildDefaultInheritanceStrategy() {
@@ -1094,6 +1114,15 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
// ********** discriminator value **********
public String getDiscriminatorValue() {
+ return this.discriminatorValue;
+ }
+
+ protected void setDiscriminatorValue(String discriminatorValue) {
+ String old = this.discriminatorValue;
+ this.firePropertyChanged(DISCRIMINATOR_VALUE_PROPERTY, old, this.discriminatorValue = discriminatorValue);
+ }
+
+ protected String buildDiscriminatorValue() {
return (this.specifiedDiscriminatorValue != null) ? this.specifiedDiscriminatorValue : this.defaultDiscriminatorValue;
}
@@ -1108,8 +1137,7 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
protected void setSpecifiedDiscriminatorValue_(String discriminatorValue) {
String old = this.specifiedDiscriminatorValue;
- this.specifiedDiscriminatorValue = discriminatorValue;
- this.firePropertyChanged(SPECIFIED_DISCRIMINATOR_VALUE_PROPERTY, old, discriminatorValue);
+ this.firePropertyChanged(SPECIFIED_DISCRIMINATOR_VALUE_PROPERTY, old, this.specifiedDiscriminatorValue = discriminatorValue);
}
public String getDefaultDiscriminatorValue() {
@@ -1118,8 +1146,7 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
protected void setDefaultDiscriminatorValue(String discriminatorValue) {
String old = this.defaultDiscriminatorValue;
- this.defaultDiscriminatorValue = discriminatorValue;
- this.firePropertyChanged(DEFAULT_DISCRIMINATOR_VALUE_PROPERTY, old, discriminatorValue);
+ this.firePropertyChanged(DEFAULT_DISCRIMINATOR_VALUE_PROPERTY, old, this.defaultDiscriminatorValue = discriminatorValue);
}
/**
@@ -1366,7 +1393,7 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
}
protected Iterable<String> convertToNames_(Iterable<Table> tables) {
- return new TransformationIterable<Table, String>(tables, Table.NAME_TRANSFORMER);
+ return new TransformationIterable<>(tables, Table.NAME_TRANSFORMER);
}
public boolean tableNameIsInvalid(String tableName) {
@@ -1436,7 +1463,7 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
}
protected Iterable<org.eclipse.jpt.jpa.db.Table> getAllAssociatedDbTables_() {
- return new TransformationIterable<Table, org.eclipse.jpt.jpa.db.Table>(this.getAllAssociatedTables(), Table.DB_TABLE_TRANSFORMER);
+ return new TransformationIterable<>(this.getAllAssociatedTables(), Table.DB_TABLE_TRANSFORMER);
}
@Override
@@ -1514,9 +1541,9 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
EmptyIterable.<String>instance();
}
- public AttributeMapping resolveAttributeMapping(String name) {
+ public AttributeMapping resolveAttributeMapping(String mappingName) {
for (AttributeMapping attributeMapping : this.getAllAttributeMappings()) {
- AttributeMapping resolvedMapping = attributeMapping.resolveAttributeMapping(name);
+ AttributeMapping resolvedMapping = attributeMapping.resolveAttributeMapping(mappingName);
if (resolvedMapping != null) {
return resolvedMapping;
}
@@ -2136,9 +2163,9 @@ public abstract class AbstractOrmEntity<X extends XmlEntity>
if (this.getXmlColumn() == null) {
JavaEntity javaEntity = this.getJavaEntityForDefaults();
if (javaEntity != null) {
- String name = javaEntity.getDiscriminatorColumn().getSpecifiedName();
- if (name != null) {
- return name;
+ String columnName = javaEntity.getDiscriminatorColumn().getSpecifiedName();
+ if (columnName != null) {
+ return columnName;
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java
index ca3f7365ee..091f77fdd2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2015 Oracle. All rights reserved.
+ * Copyright (c) 2006, 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.
@@ -50,6 +50,7 @@ public abstract class AbstractOrmRelationshipMapping<X extends AbstractXmlRelati
{
protected String specifiedTargetEntity;
protected String defaultTargetEntity;
+ protected String targetEntity;
protected String fullyQualifiedTargetEntity;
protected final OrmMappingRelationship relationship;
@@ -58,6 +59,7 @@ public abstract class AbstractOrmRelationshipMapping<X extends AbstractXmlRelati
protected FetchType specifiedFetch;
protected FetchType defaultFetch;
+ protected FetchType fetch;
protected AbstractOrmRelationshipMapping(OrmSpecifiedPersistentAttribute parent, X xmlMapping) {
@@ -84,10 +86,12 @@ public abstract class AbstractOrmRelationshipMapping<X extends AbstractXmlRelati
public void update(IProgressMonitor monitor) {
super.update(monitor);
this.setDefaultTargetEntity(this.buildDefaultTargetEntity());
+ this.setTargetEntity(this.buildTargetEntity());
this.setFullyQualifiedTargetEntity(this.buildFullyQualifiedTargetEntity());
this.relationship.update(monitor);
this.cascade.update(monitor);
this.setDefaultFetch(this.buildDefaultFetch());
+ this.setFetch(this.buildFetch());
}
@@ -112,6 +116,15 @@ public abstract class AbstractOrmRelationshipMapping<X extends AbstractXmlRelati
// ********** target entity **********
public String getTargetEntity() {
+ return this.targetEntity;
+ }
+
+ protected void setTargetEntity(String entity) {
+ String old = this.targetEntity;
+ this.firePropertyChanged(TARGET_ENTITY_PROPERTY, old, this.targetEntity = entity);
+ }
+
+ protected String buildTargetEntity() {
return (this.specifiedTargetEntity != null) ? this.specifiedTargetEntity : this.defaultTargetEntity;
}
@@ -126,8 +139,7 @@ public abstract class AbstractOrmRelationshipMapping<X extends AbstractXmlRelati
protected void setSpecifiedTargetEntity_(String entity) {
String old = this.specifiedTargetEntity;
- this.specifiedTargetEntity = entity;
- this.firePropertyChanged(SPECIFIED_TARGET_ENTITY_PROPERTY, old, entity);
+ this.firePropertyChanged(SPECIFIED_TARGET_ENTITY_PROPERTY, old, this.specifiedTargetEntity = entity);
}
public String getDefaultTargetEntity() {
@@ -136,8 +148,7 @@ public abstract class AbstractOrmRelationshipMapping<X extends AbstractXmlRelati
protected void setDefaultTargetEntity(String entity) {
String old = this.defaultTargetEntity;
- this.defaultTargetEntity = entity;
- this.firePropertyChanged(DEFAULT_TARGET_ENTITY_PROPERTY, old, entity);
+ this.firePropertyChanged(DEFAULT_TARGET_ENTITY_PROPERTY, old, this.defaultTargetEntity = entity);
}
protected String buildDefaultTargetEntity() {
@@ -202,6 +213,15 @@ public abstract class AbstractOrmRelationshipMapping<X extends AbstractXmlRelati
// ********** fetch **********
public FetchType getFetch() {
+ return this.fetch;
+ }
+
+ protected void setFetch(FetchType fetch) {
+ FetchType old = this.fetch;
+ this.firePropertyChanged(FETCH_PROPERTY, old, this.fetch = fetch);
+ }
+
+ protected FetchType buildFetch() {
return (this.specifiedFetch != null) ? this.specifiedFetch : this.defaultFetch;
}
@@ -216,8 +236,7 @@ public abstract class AbstractOrmRelationshipMapping<X extends AbstractXmlRelati
protected void setSpecifiedFetch_(FetchType fetch) {
FetchType old = this.specifiedFetch;
- this.specifiedFetch = fetch;
- this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, fetch);
+ this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, this.specifiedFetch = fetch);
}
protected FetchType buildSpecifiedFetch() {
@@ -230,8 +249,7 @@ public abstract class AbstractOrmRelationshipMapping<X extends AbstractXmlRelati
protected void setDefaultFetch(FetchType fetch) {
FetchType old = this.defaultFetch;
- this.defaultFetch = fetch;
- this.firePropertyChanged(DEFAULT_FETCH_PROPERTY, old, fetch);
+ this.firePropertyChanged(DEFAULT_FETCH_PROPERTY, old, this.defaultFetch = fetch);
}
protected abstract FetchType buildDefaultFetch();
@@ -323,7 +341,7 @@ public abstract class AbstractOrmRelationshipMapping<X extends AbstractXmlRelati
if (this.specifiedTargetEntity != null) {
PersistentType targetType = this.getResolvedTargetType();
if ((targetType != null) && targetType.isFor(originalType.getFullyQualifiedName('.'))) {
- return new SingleElementIterable<ReplaceEdit>(this.createTargetEntityRenameTypeEdit(originalType, newName));
+ return new SingleElementIterable<>(this.createTargetEntityRenameTypeEdit(originalType, newName));
}
}
return EmptyIterable.instance();
@@ -346,7 +364,7 @@ public abstract class AbstractOrmRelationshipMapping<X extends AbstractXmlRelati
if (this.specifiedTargetEntity != null) {
PersistentType targetType = this.getResolvedTargetType();
if ((targetType != null) && targetType.isFor(originalType.getFullyQualifiedName('.'))) {
- return new SingleElementIterable<ReplaceEdit>(this.createTargetEntityRenamePackageEdit(newPackage.getElementName()));
+ return new SingleElementIterable<>(this.createTargetEntityRenamePackageEdit(newPackage.getElementName()));
}
}
return EmptyIterable.instance();
@@ -365,7 +383,7 @@ public abstract class AbstractOrmRelationshipMapping<X extends AbstractXmlRelati
if (this.specifiedTargetEntity != null) {
PersistentType targetType = this.getResolvedTargetType();
if ((targetType != null) && targetType.isIn(originalPackage)) {
- return new SingleElementIterable<ReplaceEdit>(this.createTargetEntityRenamePackageEdit(newName));
+ return new SingleElementIterable<>(this.createTargetEntityRenamePackageEdit(newName));
}
}
return EmptyIterable.instance();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java
index 69632998ea..aa309740c9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java
@@ -133,6 +133,7 @@ public abstract class AbstractPersistenceUnit
protected PersistenceUnitTransactionType specifiedTransactionType;
protected PersistenceUnitTransactionType defaultTransactionType = PersistenceUnitTransactionType.JTA;
+ protected PersistenceUnitTransactionType transactionType;
protected String description;
@@ -199,9 +200,11 @@ public abstract class AbstractPersistenceUnit
protected SharedCacheMode2_0 specifiedSharedCacheMode;
protected SharedCacheMode2_0 defaultSharedCacheMode;
+ protected SharedCacheMode2_0 sharedCacheMode;
protected ValidationMode2_0 specifiedValidationMode;
protected ValidationMode2_0 defaultValidationMode = DEFAULT_VALIDATION_MODE;
+ protected ValidationMode2_0 validationMode;
protected final Set<IFile> metamodelFiles = Collections.synchronizedSet(new HashSet<IFile>());
@@ -281,6 +284,7 @@ public abstract class AbstractPersistenceUnit
this.rebuildManagedTypeMap();
this.setDefaultTransactionType(this.buildDefaultTransactionType());
+ this.setTransactionType(this.buildTransactionType());
// update specified class refs before mapping file refs because of
// JpaFile root structure nodes - we want the mapping file to "win",
@@ -304,7 +308,10 @@ public abstract class AbstractPersistenceUnit
this.setQueries(this.buildQueries());
this.setDefaultSharedCacheMode(this.buildDefaultSharedCacheMode());
+ this.setSharedCacheMode(this.buildSharedCacheMode());
+
this.setDefaultValidationMode(this.buildDefaultValidationMode());
+ this.setValidationMode(this.buildValidationMode());
this.updateStructureChildren();
}
@@ -406,6 +413,15 @@ public abstract class AbstractPersistenceUnit
// ********** transaction type **********
public PersistenceUnitTransactionType getTransactionType() {
+ return this.transactionType;
+ }
+
+ protected void setTransactionType(PersistenceUnitTransactionType transactionType) {
+ PersistenceUnitTransactionType old = this.transactionType;
+ this.firePropertyChanged(TRANSACTION_TYPE_PROPERTY, old, this.transactionType = transactionType);
+ }
+
+ protected PersistenceUnitTransactionType buildTransactionType() {
return (this.specifiedTransactionType != null) ? this.specifiedTransactionType : this.defaultTransactionType;
}
@@ -420,8 +436,7 @@ public abstract class AbstractPersistenceUnit
protected void setSpecifiedTransactionType_(PersistenceUnitTransactionType transactionType) {
PersistenceUnitTransactionType old = this.specifiedTransactionType;
- this.specifiedTransactionType = transactionType;
- this.firePropertyChanged(SPECIFIED_TRANSACTION_TYPE_PROPERTY, old, transactionType);
+ this.firePropertyChanged(SPECIFIED_TRANSACTION_TYPE_PROPERTY, old, this.specifiedTransactionType = transactionType);
}
public PersistenceUnitTransactionType getDefaultTransactionType() {
@@ -430,8 +445,7 @@ public abstract class AbstractPersistenceUnit
protected void setDefaultTransactionType(PersistenceUnitTransactionType transactionType) {
PersistenceUnitTransactionType old = this.defaultTransactionType;
- this.defaultTransactionType = transactionType;
- this.firePropertyChanged(DEFAULT_TRANSACTION_TYPE_PROPERTY, old, transactionType);
+ this.firePropertyChanged(DEFAULT_TRANSACTION_TYPE_PROPERTY, old, this.defaultTransactionType = transactionType);
}
protected PersistenceUnitTransactionType buildSpecifiedTransactionType() {
@@ -1412,6 +1426,15 @@ public abstract class AbstractPersistenceUnit
// ********** shared cache mode **********
public SharedCacheMode2_0 getSharedCacheMode() {
+ return this.sharedCacheMode;
+ }
+
+ protected void setSharedCacheMode(SharedCacheMode2_0 sharedCacheMode) {
+ SharedCacheMode2_0 old = this.sharedCacheMode;
+ this.firePropertyChanged(SHARED_CACHE_MODE_PROPERTY, old, this.sharedCacheMode = sharedCacheMode);
+ }
+
+ protected SharedCacheMode2_0 buildSharedCacheMode() {
return (this.specifiedSharedCacheMode != null) ? this.specifiedSharedCacheMode : this.defaultSharedCacheMode;
}
@@ -1426,8 +1449,7 @@ public abstract class AbstractPersistenceUnit
protected void setSpecifiedSharedCacheMode_(SharedCacheMode2_0 sharedCacheMode) {
SharedCacheMode2_0 old = this.specifiedSharedCacheMode;
- this.specifiedSharedCacheMode = sharedCacheMode;
- this.firePropertyChanged(SPECIFIED_SHARED_CACHE_MODE_PROPERTY, old, sharedCacheMode);
+ this.firePropertyChanged(SPECIFIED_SHARED_CACHE_MODE_PROPERTY, old, this.specifiedSharedCacheMode = sharedCacheMode);
}
public SharedCacheMode2_0 getDefaultSharedCacheMode() {
@@ -1436,16 +1458,15 @@ public abstract class AbstractPersistenceUnit
protected void setDefaultSharedCacheMode(SharedCacheMode2_0 defaultSharedCacheMode) {
SharedCacheMode2_0 old = this.defaultSharedCacheMode;
- this.defaultSharedCacheMode = defaultSharedCacheMode;
- this.firePropertyChanged(DEFAULT_SHARED_CACHE_MODE_PROPERTY, old, defaultSharedCacheMode);
+ this.firePropertyChanged(DEFAULT_SHARED_CACHE_MODE_PROPERTY, old, this.defaultSharedCacheMode = defaultSharedCacheMode);
}
public boolean calculateDefaultCacheable() {
- SharedCacheMode2_0 sharedCacheMode = this.getSharedCacheMode();
- if (sharedCacheMode == null) {
+ SharedCacheMode2_0 mode = this.getSharedCacheMode();
+ if (mode == null) {
return false; // this can happen during initial update...
}
- switch (sharedCacheMode) {
+ switch (mode) {
case NONE:
case ENABLE_SELECTIVE:
case UNSPECIFIED:
@@ -1454,7 +1475,7 @@ public abstract class AbstractPersistenceUnit
case DISABLE_SELECTIVE:
return true;
default:
- throw new IllegalStateException("unknown mode: " + sharedCacheMode); //$NON-NLS-1$
+ throw new IllegalStateException("unknown mode: " + mode); //$NON-NLS-1$
}
}
@@ -1469,6 +1490,15 @@ public abstract class AbstractPersistenceUnit
// ********** validation mode **********
public ValidationMode2_0 getValidationMode() {
+ return this.validationMode;
+ }
+
+ protected void setValidationMode(ValidationMode2_0 validationMode) {
+ ValidationMode2_0 old = this.validationMode;
+ this.firePropertyChanged(VALIDATION_MODE_PROPERTY, old, this.validationMode = validationMode);
+ }
+
+ protected ValidationMode2_0 buildValidationMode() {
return (this.specifiedValidationMode != null) ? this.specifiedValidationMode : this.defaultValidationMode;
}
@@ -1483,18 +1513,16 @@ public abstract class AbstractPersistenceUnit
protected void setSpecifiedValidationMode_(ValidationMode2_0 validationMode) {
ValidationMode2_0 old = this.specifiedValidationMode;
- this.specifiedValidationMode = validationMode;
- this.firePropertyChanged(SPECIFIED_VALIDATION_MODE_PROPERTY, old, validationMode);
+ this.firePropertyChanged(SPECIFIED_VALIDATION_MODE_PROPERTY, old, this.specifiedValidationMode = validationMode);
}
public ValidationMode2_0 getDefaultValidationMode() {
return this.defaultValidationMode;
}
- protected void setDefaultValidationMode(ValidationMode2_0 defaultValidationMode) {
+ protected void setDefaultValidationMode(ValidationMode2_0 validationMode) {
ValidationMode2_0 old = this.defaultValidationMode;
- this.defaultValidationMode = defaultValidationMode;
- this.firePropertyChanged(DEFAULT_VALIDATION_MODE_PROPERTY, old, defaultValidationMode);
+ this.firePropertyChanged(DEFAULT_VALIDATION_MODE_PROPERTY, old, this.defaultValidationMode = validationMode);
}
protected ValidationMode2_0 buildSpecifiedValidationMode() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java
index e9aa3c2095..fcacfa8ff6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java
@@ -118,6 +118,7 @@ public abstract class AbstractJavaElementCollectionMapping2_0
{
protected String specifiedTargetClass;
protected String defaultTargetClass;
+ protected String targetClass;
protected String fullyQualifiedTargetClass;
protected FetchType specifiedFetch;
@@ -229,6 +230,7 @@ public abstract class AbstractJavaElementCollectionMapping2_0
super.update(monitor);
this.setDefaultTargetClass(this.buildDefaultTargetClass());
+ this.setTargetClass(this.buildTargetClass());
this.setFullyQualifiedTargetClass(this.buildFullyQualifiedTargetClass());
this.setDefaultFetch(this.buildDefaultFetch());
@@ -256,6 +258,15 @@ public abstract class AbstractJavaElementCollectionMapping2_0
// ********** target class **********
public String getTargetClass() {
+ return this.targetClass;
+ }
+
+ protected void setTargetClass(String targetClass) {
+ String old = this.targetClass;
+ this.firePropertyChanged(TARGET_CLASS_PROPERTY, old, this.targetClass = targetClass);
+ }
+
+ protected String buildTargetClass() {
return (this.specifiedTargetClass != null) ? this.specifiedTargetClass : this.defaultTargetClass;
}
@@ -272,8 +283,7 @@ public abstract class AbstractJavaElementCollectionMapping2_0
protected void setSpecifiedTargetClass_(String targetClass) {
String old = this.specifiedTargetClass;
- this.specifiedTargetClass = targetClass;
- this.firePropertyChanged(SPECIFIED_TARGET_CLASS_PROPERTY, old, targetClass);
+ this.firePropertyChanged(SPECIFIED_TARGET_CLASS_PROPERTY, old, this.specifiedTargetClass = targetClass);
}
protected String buildSpecifiedTargetClass() {
@@ -287,8 +297,7 @@ public abstract class AbstractJavaElementCollectionMapping2_0
protected void setDefaultTargetClass(String targetClass) {
String old = this.defaultTargetClass;
- this.defaultTargetClass = targetClass;
- this.firePropertyChanged(DEFAULT_TARGET_CLASS_PROPERTY, old, targetClass);
+ this.firePropertyChanged(DEFAULT_TARGET_CLASS_PROPERTY, old, this.defaultTargetClass = targetClass);
}
protected String buildDefaultTargetClass() {
@@ -559,7 +568,7 @@ public abstract class AbstractJavaElementCollectionMapping2_0
for (JavaConverter.Adapter adapter : this.getConverterAdapters()) {
Annotation annotation = adapter.getConverterAnnotation(resourceAttribute);
if (annotation != null) {
- return new SimpleAssociation<JavaConverter.Adapter, Annotation>(adapter, annotation);
+ return new SimpleAssociation<>(adapter, annotation);
}
}
return null;
@@ -1012,7 +1021,7 @@ public abstract class AbstractJavaElementCollectionMapping2_0
for (JavaConverter.Adapter adapter : this.getMapKeyConverterAdapters()) {
Annotation annotation = adapter.getConverterAnnotation(resourceAttribute);
if (annotation != null) {
- return new SimpleAssociation<JavaConverter.Adapter, Annotation>(adapter, annotation);
+ return new SimpleAssociation<>(adapter, annotation);
}
}
return null;
@@ -1151,7 +1160,7 @@ public abstract class AbstractJavaElementCollectionMapping2_0
protected ListIterable<JavaSpecifiedJoinColumn> getDefaultMapKeyJoinColumns() {
return (this.defaultMapKeyJoinColumn != null) ?
- new SingleElementListIterable<JavaSpecifiedJoinColumn>(this.defaultMapKeyJoinColumn) :
+ new SingleElementListIterable<>(this.defaultMapKeyJoinColumn) :
EmptyListIterable.<JavaSpecifiedJoinColumn>instance();
}
@@ -1179,7 +1188,7 @@ public abstract class AbstractJavaElementCollectionMapping2_0
// ********** map key join column annotations **********
protected ListIterable<MapKeyJoinColumnAnnotation2_0> getMapKeyJoinColumnAnnotations() {
- return new SubListIterableWrapper<NestableAnnotation, MapKeyJoinColumnAnnotation2_0>(this.getNestableMapKeyJoinColumnAnnotations());
+ return new SubListIterableWrapper<>(this.getNestableMapKeyJoinColumnAnnotations());
}
protected ListIterable<NestableAnnotation> getNestableMapKeyJoinColumnAnnotations() {
@@ -1244,7 +1253,7 @@ public abstract class AbstractJavaElementCollectionMapping2_0
}
protected Iterable<String> getQualifiedEmbeddableOverridableMappingNames(Transformer<AttributeMapping, Iterable<String>> transformer) {
- return new TransformationIterable<String, String>(this.getEmbeddableOverridableMappingNames(transformer), this.buildQualifierTransformer());
+ return new TransformationIterable<>(this.getEmbeddableOverridableMappingNames(transformer), this.buildQualifierTransformer());
}
/**
@@ -1395,7 +1404,7 @@ public abstract class AbstractJavaElementCollectionMapping2_0
}
protected Iterable<String> getJavaCandidateMapKeyNames() {
- return new TransformationIterable<String, String>(this.getCandidateMapKeyNames(),
+ return new TransformationIterable<>(this.getCandidateMapKeyNames(),
StringTools.JAVA_STRING_LITERAL_CONTENT_TRANSFORMER);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java
index 992459a5cf..e96fd1b842 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java
@@ -120,10 +120,12 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
{
protected String specifiedTargetClass;
protected String defaultTargetClass;
+ protected String targetClass;
protected String fullyQualifiedTargetClass;
protected FetchType specifiedFetch;
protected FetchType defaultFetch = DEFAULT_FETCH_TYPE;
+ protected FetchType fetch;
protected final OrmOrderable2_0 orderable;
@@ -144,6 +146,7 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
protected String specifiedMapKeyClass;
protected String defaultMapKeyClass;
+ protected String mapKeyClass;
protected String fullyQualifiedMapKeyClass;
protected final OrmSpecifiedColumn mapKeyColumn;
@@ -229,8 +232,10 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
public void update(IProgressMonitor monitor) {
super.update(monitor);
this.setDefaultTargetClass(this.buildDefaultTargetClass());
+ this.setTargetClass(this.buildTargetClass());
this.setFullyQualifiedTargetClass(this.buildFullyQualifiedTargetClass());
this.setDefaultFetch(this.buildDefaultFetch());
+ this.setFetch(this.buildFetch());
this.orderable.update(monitor);
this.collectionTable.update(monitor);
@@ -242,6 +247,7 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
this.setKeyType(this.buildKeyType());
this.setDefaultMapKeyClass(this.buildDefaultMapKeyClass());
+ this.setMapKeyClass(this.buildMapKeyClass());
this.setFullyQualifiedMapKeyClass(this.buildFullyQualifiedMapKeyClass());
this.mapKeyColumn.update(monitor);
@@ -273,6 +279,15 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
// ********** target class **********
public String getTargetClass() {
+ return this.targetClass;
+ }
+
+ protected void setTargetClass(String targetClass) {
+ String old = this.targetClass;
+ this.firePropertyChanged(TARGET_CLASS_PROPERTY, old, this.targetClass = targetClass);
+ }
+
+ protected String buildTargetClass() {
return (this.specifiedTargetClass != null) ? this.specifiedTargetClass : this.defaultTargetClass;
}
@@ -287,8 +302,7 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
protected void setSpecifiedTargetClass_(String targetClass) {
String old = this.specifiedTargetClass;
- this.specifiedTargetClass = targetClass;
- this.firePropertyChanged(SPECIFIED_TARGET_CLASS_PROPERTY, old, targetClass);
+ this.firePropertyChanged(SPECIFIED_TARGET_CLASS_PROPERTY, old, this.specifiedTargetClass = targetClass);
}
public String getDefaultTargetClass() {
@@ -297,8 +311,7 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
protected void setDefaultTargetClass(String targetClass) {
String old = this.defaultTargetClass;
- this.defaultTargetClass = targetClass;
- this.firePropertyChanged(DEFAULT_TARGET_CLASS_PROPERTY, old, targetClass);
+ this.firePropertyChanged(DEFAULT_TARGET_CLASS_PROPERTY, old, this.defaultTargetClass = targetClass);
}
protected String buildDefaultTargetClass() {
@@ -344,6 +357,15 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
// ********** fetch **********
public FetchType getFetch() {
+ return this.fetch;
+ }
+
+ protected void setFetch(FetchType fetch) {
+ FetchType old = this.fetch;
+ this.firePropertyChanged(FETCH_PROPERTY, old, this.fetch = fetch);
+ }
+
+ protected FetchType buildFetch() {
return (this.specifiedFetch != null) ? this.specifiedFetch : this.defaultFetch;
}
@@ -358,8 +380,7 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
protected void setSpecifiedFetch_(FetchType fetch) {
FetchType old = this.specifiedFetch;
- this.specifiedFetch = fetch;
- this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, fetch);
+ this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, this.specifiedFetch = fetch);
}
protected FetchType buildSpecifiedFetch() {
@@ -372,8 +393,7 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
protected void setDefaultFetch(FetchType fetch) {
FetchType old = this.defaultFetch;
- this.defaultFetch = fetch;
- this.firePropertyChanged(DEFAULT_FETCH_PROPERTY, old, fetch);
+ this.firePropertyChanged(DEFAULT_FETCH_PROPERTY, old, this.defaultFetch = fetch);
}
protected FetchType buildDefaultFetch() {
@@ -824,6 +844,15 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
// ********** map key class **********
public String getMapKeyClass() {
+ return this.mapKeyClass;
+ }
+
+ protected void setMapKeyClass(String mapKeyClass) {
+ String old = this.mapKeyClass;
+ this.firePropertyChanged(MAP_KEY_CLASS_PROPERTY, old, this.mapKeyClass = mapKeyClass);
+ }
+
+ protected String buildMapKeyClass() {
return (this.specifiedMapKeyClass != null) ? this.specifiedMapKeyClass : this.defaultMapKeyClass;
}
@@ -849,14 +878,13 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
protected boolean setSpecifiedMapKeyClass_(String mapKeyClass) {
String old = this.specifiedMapKeyClass;
- this.specifiedMapKeyClass = mapKeyClass;
- return this.firePropertyChanged(SPECIFIED_MAP_KEY_CLASS_PROPERTY, old, mapKeyClass);
+ return this.firePropertyChanged(SPECIFIED_MAP_KEY_CLASS_PROPERTY, old, this.specifiedMapKeyClass = mapKeyClass);
}
protected XmlClassReference buildXmlMapKeyClassReference() {
- XmlClassReference mapKeyClass = OrmFactory.eINSTANCE.createXmlClassReference();
- this.xmlAttributeMapping.setMapKeyClass(mapKeyClass);
- return mapKeyClass;
+ XmlClassReference ref = OrmFactory.eINSTANCE.createXmlClassReference();
+ this.xmlAttributeMapping.setMapKeyClass(ref);
+ return ref;
}
protected String buildSpecifiedMapKeyClass() {
@@ -870,8 +898,7 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
protected void setDefaultMapKeyClass(String mapKeyClass) {
String old = this.defaultMapKeyClass;
- this.defaultMapKeyClass = mapKeyClass;
- this.firePropertyChanged(DEFAULT_MAP_KEY_CLASS_PROPERTY, old, mapKeyClass);
+ this.firePropertyChanged(DEFAULT_MAP_KEY_CLASS_PROPERTY, old, this.defaultMapKeyClass = mapKeyClass);
}
protected String buildDefaultMapKeyClass() {
@@ -1149,7 +1176,7 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
protected ListIterable<OrmSpecifiedJoinColumn> getDefaultMapKeyJoinColumns() {
return (this.defaultMapKeyJoinColumn != null) ?
- new SingleElementListIterable<OrmSpecifiedJoinColumn>(this.defaultMapKeyJoinColumn) :
+ new SingleElementListIterable<>(this.defaultMapKeyJoinColumn) :
EmptyListIterable.<OrmSpecifiedJoinColumn>instance();
}
@@ -1275,7 +1302,7 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
}
protected Iterable<String> getQualifiedEmbeddableOverridableMappingNames(Transformer<AttributeMapping, Iterable<String>> transformer) {
- return new TransformationIterable<String, String>(this.getEmbeddableOverridableMappingNames(transformer), this.buildQualifierTransformer());
+ return new TransformationIterable<>(this.getEmbeddableOverridableMappingNames(transformer), this.buildQualifierTransformer());
}
/**
@@ -1363,7 +1390,7 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
if (this.specifiedMapKeyClass != null) {
PersistentType mapKeyType = this.getResolvedMapKeyType();
if ((mapKeyType != null) && mapKeyType.isFor(originalType.getFullyQualifiedName('.'))) {
- return new SingleElementIterable<ReplaceEdit>(this.createRenameMapKeyClassEdit(originalType, newName));
+ return new SingleElementIterable<>(this.createRenameMapKeyClassEdit(originalType, newName));
}
}
return EmptyIterable.instance();
@@ -1377,7 +1404,7 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
if (this.specifiedTargetClass != null) {
PersistentType targetType = this.getResolvedTargetType();
if ((targetType != null) && targetType.isFor(originalType.getFullyQualifiedName('.'))) {
- return new SingleElementIterable<ReplaceEdit>(this.xmlAttributeMapping.createRenameTargetClassEdit(originalType, newName));
+ return new SingleElementIterable<>(this.xmlAttributeMapping.createRenameTargetClassEdit(originalType, newName));
}
}
return EmptyIterable.instance();
@@ -1397,7 +1424,7 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
if (this.specifiedMapKeyClass != null) {
PersistentType mapKeyType = this.getResolvedMapKeyType();
if ((mapKeyType != null) && mapKeyType.isFor(originalType.getFullyQualifiedName('.'))) {
- return new SingleElementIterable<ReplaceEdit>(this.createMapKeyClassRenamePackageEdit(newPackage.getElementName()));
+ return new SingleElementIterable<>(this.createMapKeyClassRenamePackageEdit(newPackage.getElementName()));
}
}
return EmptyIterable.instance();
@@ -1407,7 +1434,7 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
if (this.specifiedTargetClass != null) {
PersistentType targetType = this.getResolvedTargetType();
if ((targetType != null) && targetType.isFor(originalType.getFullyQualifiedName('.'))) {
- return new SingleElementIterable<ReplaceEdit>(this.xmlAttributeMapping.createRenameTargetClassPackageEdit(newPackage.getElementName()));
+ return new SingleElementIterable<>(this.xmlAttributeMapping.createRenameTargetClassPackageEdit(newPackage.getElementName()));
}
}
return EmptyIterable.instance();
@@ -1427,7 +1454,7 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
if (this.specifiedMapKeyClass != null) {
PersistentType mapKeyType = this.getResolvedMapKeyType();
if ((mapKeyType != null) && mapKeyType.isIn(originalPackage)) {
- return new SingleElementIterable<ReplaceEdit>(this.createMapKeyClassRenamePackageEdit(newName));
+ return new SingleElementIterable<>(this.createMapKeyClassRenamePackageEdit(newName));
}
}
return EmptyIterable.instance();
@@ -1441,7 +1468,7 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
if (this.specifiedTargetClass != null) {
PersistentType targetType = this.getResolvedTargetType();
if ((targetType != null) && targetType.isIn(originalPackage)) {
- return new SingleElementIterable<ReplaceEdit>(this.xmlAttributeMapping.createRenameTargetClassPackageEdit(newName));
+ return new SingleElementIterable<>(this.xmlAttributeMapping.createRenameTargetClassPackageEdit(newName));
}
}
return EmptyIterable.instance();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CollectionMapping2_0.java
index 100f18e12b..dd692bdbe2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CollectionMapping2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CollectionMapping2_0.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2012 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.
@@ -35,6 +35,7 @@ public interface CollectionMapping2_0
// ********** map key class **********
String getMapKeyClass();
+ String MAP_KEY_CLASS_PROPERTY = "mapKeyClass"; //$NON-NLS-1$
String getSpecifiedMapKeyClass();
void setSpecifiedMapKeyClass(String value);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ElementCollectionMapping2_0.java
index 65fc024a40..232e78a20e 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ElementCollectionMapping2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ElementCollectionMapping2_0.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2012 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,7 @@ public interface ElementCollectionMapping2_0
// ********** target class **********
String getTargetClass();
+ String TARGET_CLASS_PROPERTY = "targetClass"; //$NON-NLS-1$
String getSpecifiedTargetClass();
void setSpecifiedTargetClass(String value);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/PersistenceUnit2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/PersistenceUnit2_0.java
index e9085e1786..40ca8c81ad 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/PersistenceUnit2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/PersistenceUnit2_0.java
@@ -40,17 +40,13 @@ public interface PersistenceUnit2_0
* whether specified or defaulted.
*/
SharedCacheMode2_0 getSharedCacheMode();
-
- /**
- * String constant associated with changes to the persistence unit's
- * specified shared cache mode
- */
- String SPECIFIED_SHARED_CACHE_MODE_PROPERTY = "specifiedSharedCacheMode"; //$NON-NLS-1$
+ String SHARED_CACHE_MODE_PROPERTY = "sharedCacheMode"; //$NON-NLS-1$
/**
* Return the persistence unit's specified shared cache mode.
*/
SharedCacheMode2_0 getSpecifiedSharedCacheMode();
+ String SPECIFIED_SHARED_CACHE_MODE_PROPERTY = "specifiedSharedCacheMode"; //$NON-NLS-1$
/**
* Set the persistence unit's specified shared cache mode.
@@ -77,17 +73,13 @@ public interface PersistenceUnit2_0
* whether specified or defaulted.
*/
ValidationMode2_0 getValidationMode();
-
- /**
- * String constant associated with changes to the persistence unit's
- * specified validation mode
- */
- String SPECIFIED_VALIDATION_MODE_PROPERTY = "specifiedValidationMode"; //$NON-NLS-1$
+ String VALIDATION_MODE_PROPERTY = "validationMode"; //$NON-NLS-1$
/**
* Return the persistence unit's specified validation mode.
*/
ValidationMode2_0 getSpecifiedValidationMode();
+ String SPECIFIED_VALIDATION_MODE_PROPERTY = "specifiedValidationMode"; //$NON-NLS-1$
/**
* Set the persistence unit's specified validation mode.
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkCaching.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkCaching.java
index e81f5b0ad3..5b32d962b4 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkCaching.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkCaching.java
@@ -175,11 +175,12 @@ public interface EclipseLinkCaching
* It is not valid to specify both
*/
Integer getExpiry();
+ String EXPIRY_PROPERTY = "expiry"; //$NON-NLS-1$
+
/**
* Setting this to a non-null value will set timeOfDayExpiry to null
*/
void setExpiry(Integer expiry);
- String EXPIRY_PROPERTY = "expiry"; //$NON-NLS-1$
// ********** expiry time of day **********
@@ -191,7 +192,7 @@ public interface EclipseLinkCaching
*/
EclipseLinkTimeOfDay getExpiryTimeOfDay();
String EXPIRY_TIME_OF_DAY_PROPERTY = "expiryTimeOfDay"; //$NON-NLS-1$
-
+
/**
* Add Cache expiryTimeOfDay annotation or xml element, this will set
* Expiry to null as it is not valid to set both expiry and timeOfDayExpiry
@@ -203,6 +204,18 @@ public interface EclipseLinkCaching
*/
void removeExpiryTimeOfDay();
+
+ // ********** no expiry **********
+
+ /**
+ * Return whether the caching has neither an expiry nor
+ * an expiry time of day.
+ */
+ boolean hasNoExpiry();
+ String NO_EXPIRY_PROPERTY = "noExpiry"; //$NON-NLS-1$
+
+ void setNoExpiry();
+
// ********** existence type **********
// TODO bjv rename existenceCheckingPolicy
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaCachingImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaCachingImpl.java
index 4a4881b65e..870ed6c6e7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaCachingImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaCachingImpl.java
@@ -69,6 +69,7 @@ public class EclipseLinkJavaCachingImpl
protected Integer expiry;
protected EclipseLinkJavaTimeOfDay expiryTimeOfDay;
+ protected boolean noExpiry;
protected boolean existenceChecking;
@@ -159,6 +160,7 @@ public class EclipseLinkJavaCachingImpl
if (this.expiryTimeOfDay != null) {
this.expiryTimeOfDay.update(monitor);
}
+ this.setNoExpiry(this.buildNoExpiry());
this.setDefaultExistenceType(this.buildDefaultExistenceType());
this.setExistenceType(this.buildExistenceType());
@@ -571,6 +573,29 @@ public class EclipseLinkJavaCachingImpl
}
+ // ********** no expiry **********
+
+ public boolean hasNoExpiry() {
+ return this.noExpiry;
+ }
+
+ public void setNoExpiry() {
+ this.setExpiry(null);
+ if (this.expiryTimeOfDay != null) {
+ this.removeExpiryTimeOfDay_();
+ }
+ }
+
+ protected void setNoExpiry(boolean value) {
+ boolean old = this.noExpiry;
+ this.firePropertyChanged(NO_EXPIRY_PROPERTY, old, this.noExpiry = value);
+ }
+
+ protected boolean buildNoExpiry() {
+ return (this.expiry == null) && (this.expiryTimeOfDay == null);
+ }
+
+
// ********** existence checking **********
public boolean isExistenceChecking() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmCachingImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmCachingImpl.java
index 63e9d20bb2..ce7e48593b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmCachingImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmCachingImpl.java
@@ -76,6 +76,7 @@ public class EclipseLinkOrmCachingImpl
protected Integer expiry;
protected EclipseLinkOrmTimeOfDay expiryTimeOfDay;
+ protected boolean noExpiry;
protected EclipseLinkExistenceType specifiedExistenceType;
protected EclipseLinkExistenceType defaultExistenceType = DEFAULT_EXISTENCE_TYPE;
@@ -165,6 +166,7 @@ public class EclipseLinkOrmCachingImpl
if (this.expiryTimeOfDay != null) {
this.expiryTimeOfDay.update(monitor);
}
+ this.setNoExpiry(this.buildNoExpiry());
// existence checking is its own xml attribute, it is not part of the cache xml element
this.setDefaultExistenceType(this.buildDefaultExistenceType());
@@ -708,6 +710,29 @@ public class EclipseLinkOrmCachingImpl
}
+ // ********** no expiry **********
+
+ public boolean hasNoExpiry() {
+ return this.noExpiry;
+ }
+
+ public void setNoExpiry() {
+ this.setExpiry(null);
+ if (this.expiryTimeOfDay != null) {
+ this.removeExpiryTimeOfDay_();
+ }
+ }
+
+ protected void setNoExpiry(boolean value) {
+ boolean old = this.noExpiry;
+ this.firePropertyChanged(NO_EXPIRY_PROPERTY, old, this.noExpiry = value);
+ }
+
+ protected boolean buildNoExpiry() {
+ return (this.expiry == null) && (this.expiryTimeOfDay == null);
+ }
+
+
// ********** existence type **********
public EclipseLinkExistenceType getExistenceType() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkCachingComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkCachingComposite.java
index 393566750e..442e0ae333 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkCachingComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkCachingComposite.java
@@ -138,7 +138,7 @@ public abstract class EclipseLinkCachingComposite<T extends EclipseLinkCaching>
TriStateCheckBox alwaysRefreshCheckBox = addTriStateCheckBoxWithDefault(
container,
JptJpaEclipseLinkUiDetailsMessages.ECLIPSELINK_ALWAYS_REFRESH_COMPOSITE_ALWAYS_REFRESH_LABEL,
- buildAlwaysRefreshModel(),
+ buildSpecifiedAlwaysRefreshModel(),
buildAlwaysRefreshStringModel(),
sharedCacheEnableModel,
EclipseLinkHelpContextIds.CACHING_ALWAYS_REFRESH
@@ -150,7 +150,7 @@ public abstract class EclipseLinkCachingComposite<T extends EclipseLinkCaching>
TriStateCheckBox refreshOnlyIfNewerCheckBox = addTriStateCheckBoxWithDefault(
container,
JptJpaEclipseLinkUiDetailsMessages.ECLIPSELINK_REFRESH_ONLY_IF_NEWER_COMPOSITE_REFRESH_ONLY_IF_NEWER_LABEL,
- buildRefreshOnlyIfNewerModel(),
+ buildSpecifiedRefreshOnlyIfNewerModel(),
buildRefreshOnlyIfNewerStringModel(),
sharedCacheEnableModel,
EclipseLinkHelpContextIds.CACHING_REFRESH_ONLY_IF_NEWER
@@ -162,7 +162,7 @@ public abstract class EclipseLinkCachingComposite<T extends EclipseLinkCaching>
TriStateCheckBox disableHitsCheckBox = addTriStateCheckBoxWithDefault(
container,
JptJpaEclipseLinkUiDetailsMessages.ECLIPSELINK_DISABLE_HITS_COMPOSITE_DISABLE_HITS_LABEL,
- buildDisableHitsModel(),
+ buildSpecifiedDisableHitsModel(),
buildDisableHitsStringModel(),
sharedCacheEnableModel,
EclipseLinkHelpContextIds.CACHING_DISABLE_HITS
@@ -214,7 +214,7 @@ public abstract class EclipseLinkCachingComposite<T extends EclipseLinkCaching>
);
}
- private ModifiablePropertyValueModel<Boolean> buildAlwaysRefreshModel() {
+ private ModifiablePropertyValueModel<Boolean> buildSpecifiedAlwaysRefreshModel() {
return PropertyValueModelTools.modifiableSubjectModelAspectAdapter(
this.getSubjectHolder(),
EclipseLinkCaching.SPECIFIED_ALWAYS_REFRESH_PROPERTY,
@@ -242,7 +242,7 @@ public abstract class EclipseLinkCachingComposite<T extends EclipseLinkCaching>
);
}
- private ModifiablePropertyValueModel<Boolean> buildRefreshOnlyIfNewerModel() {
+ private ModifiablePropertyValueModel<Boolean> buildSpecifiedRefreshOnlyIfNewerModel() {
return PropertyValueModelTools.modifiableSubjectModelAspectAdapter(
this.getSubjectHolder(),
EclipseLinkCaching.SPECIFIED_REFRESH_ONLY_IF_NEWER_PROPERTY,
@@ -270,7 +270,7 @@ public abstract class EclipseLinkCachingComposite<T extends EclipseLinkCaching>
);
}
- private ModifiablePropertyValueModel<Boolean> buildDisableHitsModel() {
+ private ModifiablePropertyValueModel<Boolean> buildSpecifiedDisableHitsModel() {
return PropertyValueModelTools.modifiableSubjectModelAspectAdapter(
this.getSubjectHolder(),
EclipseLinkCaching.SPECIFIED_DISABLE_HITS_PROPERTY,
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkExpiryComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkExpiryComposite.java
index d0f43b768d..8dcbb7db3a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkExpiryComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkExpiryComposite.java
@@ -51,7 +51,9 @@ import org.eclipse.swt.widgets.Label;
* @version 2.1
* @since 2.1
*/
-public class EclipseLinkExpiryComposite extends Pane<EclipseLinkCaching> {
+public class EclipseLinkExpiryComposite
+ extends Pane<EclipseLinkCaching>
+{
protected PropertyValueModel<Boolean> ttlEnabled;
public EclipseLinkExpiryComposite(Pane<? extends EclipseLinkCaching> parentPane,
@@ -162,23 +164,12 @@ public class EclipseLinkExpiryComposite extends Pane<EclipseLinkCaching> {
}
private ModifiablePropertyValueModel<Boolean> buildNoExpiryModel() {
- return new PropertyAspectAdapterXXXX<EclipseLinkCaching, Boolean>(
- getSubjectHolder(),
- EclipseLinkCaching.EXPIRY_PROPERTY,
- EclipseLinkCaching.EXPIRY_TIME_OF_DAY_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return Boolean.valueOf(this.subject.getExpiry() == null && this.subject.getExpiryTimeOfDay() == null);
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setExpiry(null);
- if (this.subject.getExpiryTimeOfDay() != null) {
- this.subject.removeExpiryTimeOfDay();
- }
- }
- };
+ return PropertyValueModelTools.modifiableSubjectModelAspectAdapter(
+ this.getSubjectHolder(),
+ EclipseLinkCaching.NO_EXPIRY_PROPERTY,
+ m -> Boolean.valueOf(m.hasNoExpiry()),
+ (m, value) -> m.setNoExpiry()
+ );
}
private ModifiablePropertyValueModel<Boolean> buildExpiryModel() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMultitenancyComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMultitenancyComposite.java
index db2db8989e..c65dfff5ea 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMultitenancyComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMultitenancyComposite.java
@@ -93,7 +93,7 @@ public class EclipseLinkMultitenancyComposite
TriStateCheckBox includeCriteriaCheckBox = addTriStateCheckBoxWithDefault(
container,
JptJpaEclipseLinkUiDetailsMessages.ECLIPSELINK_MULTITENANCY_COMPOSITE_INCLUDE_CRITERIA,
- buildIncludeCriteriaModel(),
+ buildSpecifiedIncludeCriteriaModel(),
buildIncludeCriteriaStringModel(),
EclipseLinkHelpContextIds.MULTITENANCY_INCLUDE_CRITERIA);
@@ -187,7 +187,7 @@ public class EclipseLinkMultitenancyComposite
};
}
- ModifiablePropertyValueModel<Boolean> buildIncludeCriteriaModel() {
+ ModifiablePropertyValueModel<Boolean> buildSpecifiedIncludeCriteriaModel() {
return new PropertyAspectAdapterXXXX<EclipseLinkMultitenancy2_3, Boolean>(getSubjectHolder(), EclipseLinkMultitenancy2_3.SPECIFIED_INCLUDE_CRITERIA_PROPERTY) {
@Override
protected Boolean buildValue_() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMutableTriStateCheckBox.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMutableTriStateCheckBox.java
index 4a17750771..984c93a8ad 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMutableTriStateCheckBox.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMutableTriStateCheckBox.java
@@ -65,13 +65,13 @@ public class EclipseLinkMutableTriStateCheckBox
this.checkBox = addTriStateCheckBoxWithDefault(
container,
JptJpaEclipseLinkUiDetailsMessages.ECLIPSELINK_MUTABLE_COMPOSITE_MUTABLE_LABEL,
- buildMutableModel(),
+ buildSpecifiedMutableModel(),
buildMutableStringModel(),
null
);
}
- private ModifiablePropertyValueModel<Boolean> buildMutableModel() {
+ private ModifiablePropertyValueModel<Boolean> buildSpecifiedMutableModel() {
return new PropertyAspectAdapterXXXX<EclipseLinkMutable, Boolean>(getSubjectHolder(), EclipseLinkMutable.SPECIFIED_MUTABLE_PROPERTY) {
@Override
protected Boolean buildValue_() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkTenantDiscriminatorColumnComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkTenantDiscriminatorColumnComposite.java
index bda192e7e1..3f158843e1 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkTenantDiscriminatorColumnComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkTenantDiscriminatorColumnComposite.java
@@ -91,7 +91,7 @@ public class EclipseLinkTenantDiscriminatorColumnComposite
TriStateCheckBox pkCheckBox = addTriStateCheckBoxWithDefault(
container,
JptJpaEclipseLinkUiDetailsMessages.TENANT_DISCRIMINATOR_COLUMN_COMPOSITE_PRIMARY_KEY,
- buildPrimaryKeyModel(),
+ buildSpecifiedPrimaryKeyModel(),
buildPrimaryKeyStringModel(),
EclipseLinkHelpContextIds.TENANT_DISCRIMINATOR_COLUMN_PRIMARY_KEY);
@@ -394,7 +394,7 @@ public class EclipseLinkTenantDiscriminatorColumnComposite
};
}
- ModifiablePropertyValueModel<Boolean> buildPrimaryKeyModel() {
+ ModifiablePropertyValueModel<Boolean> buildSpecifiedPrimaryKeyModel() {
return new PropertyAspectAdapterXXXX<EclipseLinkTenantDiscriminatorColumn2_3, Boolean>(getSubjectHolder(), EclipseLinkTenantDiscriminatorColumn2_3.SPECIFIED_PRIMARY_KEY_PROPERTY) {
@Override
protected Boolean buildValue_() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmAttributeTypeClassChooser.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmAttributeTypeClassChooser.java
index abb5cf8b82..01744025be 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmAttributeTypeClassChooser.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmAttributeTypeClassChooser.java
@@ -13,7 +13,7 @@ import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.internal.ui.refactoring.contentassist.JavaTypeCompletionProcessor;
import org.eclipse.jpt.common.ui.internal.widgets.ClassChooserPane;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
-import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapterXXXX;
+import org.eclipse.jpt.common.utility.internal.StringTools;
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;
@@ -46,39 +46,27 @@ public class EclipseLinkOrmAttributeTypeClassChooser
}
@Override
+ @SuppressWarnings("restriction")
protected JavaTypeCompletionProcessor buildJavaTypeCompletionProcessor() {
return new JavaTypeCompletionProcessor(true, true);
}
@Override
protected ModifiablePropertyValueModel<String> buildTextModel() {
- return new PropertyAspectAdapterXXXX<AttributeMapping, String>(
- getSubjectHolder(),
- OrmAttributeMapping.DEFAULT_ATTRIBUTE_TYPE_PROPERTY,
- OrmAttributeMapping.SPECIFIED_ATTRIBUTE_TYPE_PROPERTY) {
- @Override
- protected String buildValue_() {
- if (this.subject.getPersistentAttribute().isVirtual()) {
- return this.subject.getPersistentAttribute().getTypeName();
+ // return 'attributeType' instead of 'specifiedAttributeType'
+ // as this widget is enabled only if the mapping is VIRTUAL access;
+ // so we don't need to display the default differently
+ return PropertyValueModelTools.modifiableSubjectModelAspectAdapter(
+ this.getSubjectHolder(),
+ OrmAttributeMapping.ATTRIBUTE_TYPE_PROPERTY,
+ m -> m.getPersistentAttribute().isVirtual() ? m.getPersistentAttribute().getTypeName() : ((OrmAttributeMapping) m).getAttributeType(),
+ (m, value) -> {
+ if (m.getPersistentAttribute().isSpecified()) {
+ // we can safely cast to an orm.xml mapping since it is not virtual
+ ((OrmAttributeMapping) m).setSpecifiedAttributeType(StringTools.isBlank(value) ? null : value);
+ }
}
- //get the attributeType instead of the specifiedAttributeType.
- //this widget will only be enabled if the mapping is VIRTUAL access
- //so we don't need to display the default differently
- return ((OrmAttributeMapping) this.subject).getAttributeType();
- }
-
- @Override
- protected void setValue_(String value) {
- if (this.subject.getPersistentAttribute().isVirtual()) {
- return;
- }
- if (value.length() == 0) {
- value = null;
- }
- // we can safely cast to an orm.xml mapping since it is not virtual
- ((OrmAttributeMapping) this.subject).setSpecifiedAttributeType(value);
- }
- };
+ );
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/EclipseLinkPersistenceUnitCachingEditorPage2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/EclipseLinkPersistenceUnitCachingEditorPage2_0.java
index b69a622723..e4f0d228c6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/EclipseLinkPersistenceUnitCachingEditorPage2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/EclipseLinkPersistenceUnitCachingEditorPage2_0.java
@@ -160,15 +160,11 @@ public class EclipseLinkPersistenceUnitCachingEditorPage2_0
}
private PropertyValueModel<SharedCacheMode2_0> buildSharedCacheModeModel(PropertyValueModel<PersistenceUnit2_0> persistenceUnitModel) {
- return new PropertyAspectAdapterXXXX<PersistenceUnit2_0, SharedCacheMode2_0>(
- persistenceUnitModel,
- PersistenceUnit2_0.SPECIFIED_SHARED_CACHE_MODE_PROPERTY,
- PersistenceUnit2_0.DEFAULT_SHARED_CACHE_MODE_PROPERTY) {
- @Override
- protected SharedCacheMode2_0 buildValue_() {
- return this.subject.getSharedCacheMode();
- }
- };
+ return PropertyValueModelTools.subjectModelAspectAdapter(
+ persistenceUnitModel,
+ PersistenceUnit2_0.SHARED_CACHE_MODE_PROPERTY,
+ m -> m.getSharedCacheMode()
+ );
}
protected EnumFormComboViewer<EclipseLinkCaching, EclipseLinkCacheType> buildDefaultCacheTypeCombo(Composite container) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/EclipseLinkConnectionPropertiesComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/EclipseLinkConnectionPropertiesComposite.java
index 96943f850d..523b63fed2 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/EclipseLinkConnectionPropertiesComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/EclipseLinkConnectionPropertiesComposite.java
@@ -138,15 +138,11 @@ public class EclipseLinkConnectionPropertiesComposite<T extends EclipseLinkConne
}
private PropertyValueModel<PersistenceUnitTransactionType> buildTransactionTypeModel() {
- return new PropertyAspectAdapterXXXX<PersistenceUnit, PersistenceUnitTransactionType>(
- buildPersistenceUnitModel(),
- PersistenceUnit.SPECIFIED_TRANSACTION_TYPE_PROPERTY,
- PersistenceUnit.DEFAULT_TRANSACTION_TYPE_PROPERTY) {
- @Override
- protected PersistenceUnitTransactionType buildValue_() {
- return this.subject.getTransactionType();
- }
- };
+ return PropertyValueModelTools.subjectModelAspectAdapter(
+ this.buildPersistenceUnitModel(),
+ PersistenceUnit.TRANSACTION_TYPE_PROPERTY,
+ m -> m.getTransactionType()
+ );
}
private PropertyValueModel<PersistenceUnit> buildPersistenceUnitModel() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractInheritanceComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractInheritanceComposite.java
index abf948e1e9..3a4777cda7 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractInheritanceComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractInheritanceComposite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2006, 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.
@@ -15,6 +15,7 @@ import org.eclipse.jpt.common.ui.internal.widgets.EnumFormComboViewer;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapterXXXX;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyListValueModelAdapter;
+import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools;
import org.eclipse.jpt.common.utility.internal.transformer.TransformerTools;
import org.eclipse.jpt.common.utility.model.value.ListValueModel;
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
@@ -64,21 +65,13 @@ import org.eclipse.swt.widgets.Control;
* @see Entity
* @see AbstractEntityComposite - The parent container
* @see ColumnCombo
- * @see EnumComboViewer
- * @see PrimaryKeyJoinColumnsComposite
*
* @version 2.0
* @since 2.0
*/
-public abstract class AbstractInheritanceComposite<T extends Entity> extends Pane<T> {
-
-
- /**
- * Creates a new <code>InheritanceComposite</code>.
- *
- * @param parentPane The parent container of this one
- * @param parent The parent container
- */
+public abstract class AbstractInheritanceComposite<T extends Entity>
+ extends Pane<T>
+{
public AbstractInheritanceComposite(Pane<? extends T> parentPane,
Composite parent) {
@@ -113,7 +106,7 @@ public abstract class AbstractInheritanceComposite<T extends Entity> extends Pan
);
// Discriminator column widgets
- DiscriminatorColumnComposite<Entity> discriminatorColumnComposite = new DiscriminatorColumnComposite<Entity>(this, container);
+ DiscriminatorColumnComposite<Entity> discriminatorColumnComposite = new DiscriminatorColumnComposite<>(this, container);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
gridData.verticalIndent = 10;
@@ -136,21 +129,20 @@ public abstract class AbstractInheritanceComposite<T extends Entity> extends Pan
}
private ListValueModel<String> buildDefaultDiscriminatorListValueHolder() {
- return new PropertyListValueModelAdapter<String>(
+ return new PropertyListValueModelAdapter<>(
buildDefaultDiscriminatorValueHolder()
);
}
- private ModifiablePropertyValueModel<String> buildDefaultDiscriminatorValueHolder() {
- return new PropertyAspectAdapterXXXX<Entity, String>(getSubjectHolder(), Entity.DEFAULT_DISCRIMINATOR_VALUE_PROPERTY, Entity.DISCRIMINATOR_VALUE_IS_UNDEFINED_PROPERTY) {
- @Override
- protected String buildValue_() {
- return defaultValue(this.subject);
- }
- };
+ private PropertyValueModel<String> buildDefaultDiscriminatorValueHolder() {
+ return PropertyValueModelTools.subjectModelAspectAdapter(
+ this.getSubjectHolder(),
+ Entity.DISCRIMINATOR_VALUE_PROPERTY,
+ m -> defaultValue(m)
+ );
}
- private String defaultValue(Entity subject) {
+ String defaultValue(Entity subject) {
String defaultValue = subject.getDefaultDiscriminatorValue();
if (defaultValue == null && subject.discriminatorValueIsUndefined()) {
@@ -170,11 +162,11 @@ public abstract class AbstractInheritanceComposite<T extends Entity> extends Pan
return new PropertyAspectAdapterXXXX<Entity, String>(getSubjectHolder(), Entity.SPECIFIED_DISCRIMINATOR_VALUE_PROPERTY) {
@Override
protected String buildValue_() {
- String value = this.subject.getSpecifiedDiscriminatorValue();
- if (value == null) {
+ String v = this.subject.getSpecifiedDiscriminatorValue();
+ if (v == null) {
return defaultValue(this.subject);
}
- return value;
+ return v;
}
@Override
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/ColumnComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/ColumnComposite.java
index 600aefe97c..a854602dfd 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/ColumnComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/ColumnComposite.java
@@ -135,7 +135,7 @@ public class ColumnComposite
};
}
- ModifiablePropertyValueModel<Boolean> buildInsertableModel() {
+ ModifiablePropertyValueModel<Boolean> buildSpecifiedInsertableModel() {
return new PropertyAspectAdapterXXXX<Column, Boolean>(getSubjectHolder(), BaseColumn.SPECIFIED_INSERTABLE_PROPERTY) {
@Override
protected Boolean buildValue_() {
@@ -168,7 +168,7 @@ public class ColumnComposite
);
}
- ModifiablePropertyValueModel<Boolean> buildNullableModel() {
+ ModifiablePropertyValueModel<Boolean> buildSpecifiedNullableModel() {
return new PropertyAspectAdapterXXXX<Column, Boolean>(
getSubjectHolder(),
BaseColumn.SPECIFIED_NULLABLE_PROPERTY) {
@@ -256,7 +256,7 @@ public class ColumnComposite
};
}
- ModifiablePropertyValueModel<Boolean> buildUniqueModel() {
+ ModifiablePropertyValueModel<Boolean> buildSpecifiedUniqueModel() {
return new PropertyAspectAdapterXXXX<Column, Boolean>(
getSubjectHolder(),
BaseColumn.SPECIFIED_UNIQUE_PROPERTY) {
@@ -292,22 +292,13 @@ public class ColumnComposite
);
}
- ModifiablePropertyValueModel<Boolean> buildUpdatableModel() {
- return new PropertyAspectAdapterXXXX<Column, Boolean>(
- getSubjectHolder(),
- BaseColumn.DEFAULT_UPDATABLE_PROPERTY,
- BaseColumn.SPECIFIED_UPDATABLE_PROPERTY) {
-
- @Override
- protected Boolean buildValue_() {
- return this.subject.getSpecifiedUpdatable();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- ((SpecifiedColumn) this.subject).setSpecifiedUpdatable(value);
- }
- };
+ ModifiablePropertyValueModel<Boolean> buildSpecifiedUpdatableModel() {
+ return PropertyValueModelTools.modifiableSubjectModelAspectAdapter(
+ this.getSubjectHolder(),
+ BaseColumn.SPECIFIED_UPDATABLE_PROPERTY,
+ m -> m.getSpecifiedUpdatable(),
+ (m, value) -> ((SpecifiedColumn) m).setSpecifiedUpdatable(value)
+ );
}
PropertyValueModel<String> buildUpdatableStringModel() {
@@ -376,7 +367,7 @@ public class ColumnComposite
TriStateCheckBox insertableCheckBox = addTriStateCheckBoxWithDefault(
detailsClient,
JptJpaUiDetailsMessages.COLUMN_COMPOSITE_INSERTABLE,
- buildInsertableModel(),
+ buildSpecifiedInsertableModel(),
buildInsertableStringModel(),
JpaHelpContextIds.MAPPING_COLUMN_INSERTABLE);
GridData gridData = new GridData();
@@ -387,7 +378,7 @@ public class ColumnComposite
TriStateCheckBox updatableCheckBox = addTriStateCheckBoxWithDefault(
detailsClient,
JptJpaUiDetailsMessages.COLUMN_COMPOSITE_UPDATABLE,
- buildUpdatableModel(),
+ buildSpecifiedUpdatableModel(),
buildUpdatableStringModel(),
JpaHelpContextIds.MAPPING_COLUMN_UPDATABLE);
gridData = new GridData();
@@ -398,7 +389,7 @@ public class ColumnComposite
TriStateCheckBox uniqueCheckBox = addTriStateCheckBoxWithDefault(
detailsClient,
JptJpaUiDetailsMessages.COLUMN_COMPOSITE_UNIQUE,
- buildUniqueModel(),
+ buildSpecifiedUniqueModel(),
buildUniqueStringModel(),
JpaHelpContextIds.MAPPING_COLUMN_UNIQUE);
gridData = new GridData();
@@ -409,7 +400,7 @@ public class ColumnComposite
TriStateCheckBox nullableCheckBox = addTriStateCheckBoxWithDefault(
detailsClient,
JptJpaUiDetailsMessages.COLUMN_COMPOSITE_NULLABLE,
- buildNullableModel(),
+ buildSpecifiedNullableModel(),
buildNullableStringModel(),
JpaHelpContextIds.MAPPING_COLUMN_NULLABLE);
gridData = new GridData();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/EntityNameCombo.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/EntityNameCombo.java
index 8233429453..24c4b99d99 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/EntityNameCombo.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/EntityNameCombo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 Oracle. All rights reserved.
+ * Copyright (c) 2006, 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.
@@ -14,11 +14,13 @@ import org.eclipse.jpt.common.ui.internal.swt.widgets.ComboTools;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapterXXXX;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyListValueModelAdapter;
+import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools;
import org.eclipse.jpt.common.utility.internal.transformer.TransformerTools;
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.jpa.core.context.Entity;
+import org.eclipse.jpt.jpa.core.context.TypeMapping;
import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Combo;
@@ -72,21 +74,19 @@ public class EntityNameCombo
protected void initializeLayout(Composite container) {
this.combo = addEditableCombo(
container,
- buildDefaultEntityNameListHolder(),
- buildEntityNameHolder(),
+ buildDefaultEntityNameListModel(),
+ buildEntityNameModel(),
TransformerTools.<String>objectToStringTransformer(),
JpaHelpContextIds.ENTITY_NAME);
ComboTools.handleDefaultValue(this.combo);
}
- private ListValueModel<String> buildDefaultEntityNameListHolder() {
- return new PropertyListValueModelAdapter<String>(
- buildDefaultEntityNameHolder()
- );
+ private ListValueModel<String> buildDefaultEntityNameListModel() {
+ return new PropertyListValueModelAdapter<>(this.buildDefaultEntityNameModel());
}
- private PropertyValueModel<String> buildDefaultEntityNameHolder() {
+ private PropertyValueModel<String> buildDefaultEntityNameModel() {
return new PropertyAspectAdapterXXXX<Entity, String>(getSubjectHolder(), Entity.DEFAULT_NAME_PROPERTY) {
@Override
protected String buildValue_() {
@@ -95,41 +95,19 @@ public class EntityNameCombo
};
}
- private ModifiablePropertyValueModel<String> buildEntityNameHolder() {
- return new PropertyAspectAdapterXXXX<Entity, String>(getSubjectHolder(), Entity.SPECIFIED_NAME_PROPERTY, Entity.DEFAULT_NAME_PROPERTY) {
- @Override
- protected String buildValue_() {
-
- String name = this.subject.getSpecifiedName();
-
- if (name == null) {
- name = defaultValue(this.subject);
- }
-
- return name;
- }
-
- @Override
- protected void setValue_(String value) {
-
- if (defaultValue(this.subject).equals(value)) {
- value = null;
- }
-
- this.subject.setSpecifiedName(value);
- }
- };
+ private ModifiablePropertyValueModel<String> buildEntityNameModel() {
+ return PropertyValueModelTools.modifiableSubjectModelAspectAdapter(
+ this.getSubjectHolder(),
+ TypeMapping.NAME_PROPERTY,
+ m -> (m.getSpecifiedName() == null) ? this.defaultValue(m) : m.getSpecifiedName(),
+ (m, value) -> m.setSpecifiedName(defaultValue(m).equals(value) ? null : value)
+ );
}
- private String defaultValue(Entity subject) {
+ String defaultValue(Entity subject) {
String defaultValue = subject.getDefaultName();
-
- if (defaultValue != null) {
- return NLS.bind(
- JptCommonUiMessages.DEFAULT_WITH_ONE_PARAM,
- defaultValue
- );
- }
- return JptCommonUiMessages.DEFAULT_EMPTY;
+ return (defaultValue == null) ?
+ JptCommonUiMessages.DEFAULT_EMPTY :
+ NLS.bind(JptCommonUiMessages.DEFAULT_WITH_ONE_PARAM, defaultValue);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/IdClassChooser.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/IdClassChooser.java
index 5cccae72df..72b8c4c98c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/IdClassChooser.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/IdClassChooser.java
@@ -15,6 +15,7 @@ import org.eclipse.jpt.common.ui.internal.widgets.ClassChooserComboPane;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapterXXXX;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyListValueModelAdapter;
+import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools;
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;
@@ -57,34 +58,19 @@ public class IdClassChooser
@Override
protected ModifiablePropertyValueModel<String> buildTextModel() {
- return new PropertyAspectAdapterXXXX<IdClassReference, String>(
- getSubjectHolder(),
- IdClassReference.SPECIFIED_ID_CLASS_NAME_PROPERTY,
- IdClassReference.DEFAULT_ID_CLASS_NAME_PROPERTY) {
-
- @Override
- protected String buildValue_() {
- String className = this.subject.getSpecifiedIdClassName();
- return (className == null) ? defaultText(this.subject) : className;
- }
-
- @Override
- protected void setValue_(String value) {
- if (value == null
- || value.length() == 0
- || value.equals(defaultText(this.subject))) {
- value = null;
- }
- this.subject.setSpecifiedIdClassName(value);
- }
- };
+ return PropertyValueModelTools.modifiableSubjectModelAspectAdapter(
+ this.getSubjectHolder(),
+ IdClassReference.ID_CLASS_NAME_PROPERTY,
+ m -> (m.getSpecifiedIdClassName() == null) ? this.defaultText(m) : m.getSpecifiedIdClassName(),
+ (m, value) -> m.setSpecifiedIdClassName(defaultText(m).equals(value) ? null : value)
+ );
}
protected String defaultText(IdClassReference idClassReference) {
- String defaultClassName = idClassReference.getDefaultIdClassName();
- return (defaultClassName == null) ?
- JptCommonUiMessages.NONE_SELECTED
- : NLS.bind(JptCommonUiMessages.DEFAULT_WITH_ONE_PARAM, defaultClassName);
+ String defaultName = idClassReference.getDefaultIdClassName();
+ return (defaultName == null) ?
+ JptCommonUiMessages.NONE_SELECTED :
+ NLS.bind(JptCommonUiMessages.DEFAULT_WITH_ONE_PARAM, defaultName);
}
@Override
@@ -98,4 +84,4 @@ public class IdClassChooser
}
});
}
-} \ No newline at end of file
+}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/TargetEntityClassChooser.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/TargetEntityClassChooser.java
index 6b25cd0e57..1b62f7c609 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/TargetEntityClassChooser.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/TargetEntityClassChooser.java
@@ -19,6 +19,7 @@ import org.eclipse.jpt.common.ui.internal.widgets.ClassChooserComboPane;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapterXXXX;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyListValueModelAdapter;
+import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools;
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;
@@ -88,29 +89,12 @@ public class TargetEntityClassChooser
@Override
protected ModifiablePropertyValueModel<String> buildTextModel() {
- return new PropertyAspectAdapterXXXX<RelationshipMapping, String>(
- this.getSubjectHolder(),
- RelationshipMapping.SPECIFIED_TARGET_ENTITY_PROPERTY,
- RelationshipMapping.DEFAULT_TARGET_ENTITY_PROPERTY) {
- @Override
- protected String buildValue_() {
-
- String name = this.subject.getSpecifiedTargetEntity();
- if (name == null) {
- name = TargetEntityClassChooser.this.getDefaultValue(this.subject);
- }
- return name;
- }
-
- @Override
- protected void setValue_(String value) {
-
- if (getDefaultValue(this.subject).equals(value)) {
- value = null;
- }
- this.subject.setSpecifiedTargetEntity(value);
- }
- };
+ return PropertyValueModelTools.modifiableSubjectModelAspectAdapter(
+ this.getSubjectHolder(),
+ RelationshipMapping.TARGET_ENTITY_PROPERTY,
+ m -> (m.getSpecifiedTargetEntity() == null) ? this.defaultValue(m) : m.getSpecifiedTargetEntity(),
+ (m, value) -> m.setSpecifiedTargetEntity(defaultValue(m).equals(value) ? null : value)
+ );
}
@Override
@@ -128,21 +112,16 @@ public class TargetEntityClassChooser
return new PropertyAspectAdapterXXXX<RelationshipMapping, String>(this.getSubjectHolder(), RelationshipMapping.DEFAULT_TARGET_ENTITY_PROPERTY) {
@Override
protected String buildValue_() {
- return TargetEntityClassChooser.this.getDefaultValue(this.subject);
+ return TargetEntityClassChooser.this.defaultValue(this.subject);
}
};
}
- String getDefaultValue(RelationshipMapping subject) {
+ String defaultValue(RelationshipMapping subject) {
String defaultValue = subject.getDefaultTargetEntity();
-
- if (defaultValue != null) {
- return NLS.bind(
- JptCommonUiMessages.DEFAULT_WITH_ONE_PARAM,
- defaultValue
- );
- }
- return JptCommonUiMessages.DEFAULT_EMPTY;
+ return (defaultValue == null) ?
+ JptCommonUiMessages.DEFAULT_EMPTY :
+ NLS.bind(JptCommonUiMessages.DEFAULT_WITH_ONE_PARAM, defaultValue);
}
/*
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/CacheableTriStateCheckBox2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/CacheableTriStateCheckBox2_0.java
index cb956d7a11..3b7e722d83 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/CacheableTriStateCheckBox2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/CacheableTriStateCheckBox2_0.java
@@ -11,7 +11,6 @@ package org.eclipse.jpt.jpa.ui.internal.jpa2.details;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
import org.eclipse.jpt.common.ui.internal.widgets.TriStateCheckBox;
-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.model.value.ModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
@@ -61,29 +60,20 @@ public class CacheableTriStateCheckBox2_0
this.checkBox = addTriStateCheckBoxWithDefault(
container,
JptJpaUiDetailsMessages2_0.ENTITY_CACHEABLE_LABEL,
- buildCacheableBooleanModel(),
+ buildSpecifiedCacheableBooleanModel(),
buildCacheableStringModel(),
JpaHelpContextIds.ENTITY_CACHEABLE
);
}
- private ModifiablePropertyValueModel<Boolean> buildCacheableBooleanModel() {
- return new PropertyAspectAdapterXXXX<Cacheable2_0, Boolean>(
- getSubjectHolder(),
- Cacheable2_0.DEFAULT_CACHEABLE_PROPERTY,
- Cacheable2_0.SPECIFIED_CACHEABLE_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getSpecifiedCacheable();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setSpecifiedCacheable(value);
- }
- };
+ private ModifiablePropertyValueModel<Boolean> buildSpecifiedCacheableBooleanModel() {
+ return PropertyValueModelTools.modifiableSubjectModelAspectAdapter(
+ this.getSubjectHolder(),
+ Cacheable2_0.SPECIFIED_CACHEABLE_PROPERTY,
+ m -> m.getSpecifiedCacheable(),
+ (m, value) -> m.setSpecifiedCacheable(value)
+ );
}
private PropertyValueModel<String> buildCacheableStringModel() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OrderColumnComposite2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OrderColumnComposite2_0.java
index 9b1787b1f6..44570c8fec 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OrderColumnComposite2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OrderColumnComposite2_0.java
@@ -145,7 +145,7 @@ public class OrderColumnComposite2_0 extends Pane<SpecifiedOrderColumn2_0> {
};
}
- private ModifiablePropertyValueModel<Boolean> buildInsertableModel() {
+ private ModifiablePropertyValueModel<Boolean> buildSpecifiedInsertableModel() {
return new PropertyAspectAdapterXXXX<SpecifiedOrderColumn2_0, Boolean>(getSubjectHolder(), BaseColumn.SPECIFIED_INSERTABLE_PROPERTY) {
@Override
protected Boolean buildValue_() {
@@ -178,7 +178,7 @@ public class OrderColumnComposite2_0 extends Pane<SpecifiedOrderColumn2_0> {
);
}
- private ModifiablePropertyValueModel<Boolean> buildNullableModel() {
+ private ModifiablePropertyValueModel<Boolean> buildSpecifiedNullableModel() {
return new PropertyAspectAdapterXXXX<SpecifiedOrderColumn2_0, Boolean>(
getSubjectHolder(),
BaseColumn.SPECIFIED_NULLABLE_PROPERTY)
@@ -215,22 +215,13 @@ public class OrderColumnComposite2_0 extends Pane<SpecifiedOrderColumn2_0> {
}
- private ModifiablePropertyValueModel<Boolean> buildUpdatableModel() {
- return new PropertyAspectAdapterXXXX<SpecifiedOrderColumn2_0, Boolean>(
- getSubjectHolder(),
- BaseColumn.DEFAULT_UPDATABLE_PROPERTY,
- BaseColumn.SPECIFIED_UPDATABLE_PROPERTY)
- {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getSpecifiedUpdatable();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setSpecifiedUpdatable(value);
- }
- };
+ private ModifiablePropertyValueModel<Boolean> buildSpecifiedUpdatableModel() {
+ return PropertyValueModelTools.modifiableSubjectModelAspectAdapter(
+ this.getSubjectHolder(),
+ BaseColumn.SPECIFIED_UPDATABLE_PROPERTY,
+ m -> m.getSpecifiedUpdatable(),
+ (m, value) -> m.setSpecifiedUpdatable(value)
+ );
}
private PropertyValueModel<String> buildUpdatableStringModel() {
@@ -279,7 +270,7 @@ public class OrderColumnComposite2_0 extends Pane<SpecifiedOrderColumn2_0> {
TriStateCheckBox insertableCheckBox = addTriStateCheckBoxWithDefault(
detailsClient,
JptJpaUiDetailsMessages.COLUMN_COMPOSITE_INSERTABLE,
- buildInsertableModel(),
+ buildSpecifiedInsertableModel(),
buildInsertableStringModel(),
JpaHelpContextIds.MAPPING_COLUMN_INSERTABLE
);
@@ -291,7 +282,7 @@ public class OrderColumnComposite2_0 extends Pane<SpecifiedOrderColumn2_0> {
TriStateCheckBox updatableCheckBox = addTriStateCheckBoxWithDefault(
detailsClient,
JptJpaUiDetailsMessages.COLUMN_COMPOSITE_UPDATABLE,
- buildUpdatableModel(),
+ buildSpecifiedUpdatableModel(),
buildUpdatableStringModel(),
JpaHelpContextIds.MAPPING_COLUMN_UPDATABLE
);
@@ -303,7 +294,7 @@ public class OrderColumnComposite2_0 extends Pane<SpecifiedOrderColumn2_0> {
TriStateCheckBox nullableCheckBox = addTriStateCheckBoxWithDefault(
detailsClient,
JptJpaUiDetailsMessages.COLUMN_COMPOSITE_NULLABLE,
- buildNullableModel(),
+ buildSpecifiedNullableModel(),
buildNullableStringModel(),
JpaHelpContextIds.MAPPING_COLUMN_NULLABLE
);
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OrphanRemovalTriStateCheckBox2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OrphanRemovalTriStateCheckBox2_0.java
index a9da252ab0..60a297ad59 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OrphanRemovalTriStateCheckBox2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OrphanRemovalTriStateCheckBox2_0.java
@@ -11,7 +11,6 @@ package org.eclipse.jpt.jpa.ui.internal.jpa2.details;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
import org.eclipse.jpt.common.ui.internal.widgets.TriStateCheckBox;
-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.model.value.ModifiablePropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
@@ -75,20 +74,12 @@ public class OrphanRemovalTriStateCheckBox2_0 extends Pane<OrphanRemovable2_0>
}
private ModifiablePropertyValueModel<Boolean> buildSpecifiedOrphanRemovalModel() {
- return new PropertyAspectAdapterXXXX<OrphanRemovable2_0, Boolean>(
- this.getSubjectHolder(),
- OrphanRemovable2_0.DEFAULT_ORPHAN_REMOVAL_PROPERTY,
- OrphanRemovable2_0.SPECIFIED_ORPHAN_REMOVAL_PROPERTY) {
- @Override
- protected Boolean buildValue_() {
- return this.subject.getSpecifiedOrphanRemoval();
- }
-
- @Override
- protected void setValue_(Boolean value) {
- this.subject.setSpecifiedOrphanRemoval(value);
- }
- };
+ return PropertyValueModelTools.modifiableSubjectModelAspectAdapter(
+ this.getSubjectHolder(),
+ OrphanRemovable2_0.SPECIFIED_ORPHAN_REMOVAL_PROPERTY,
+ m -> m.getSpecifiedOrphanRemoval(),
+ (m, value) -> m.setSpecifiedOrphanRemoval(value)
+ );
}
private PropertyValueModel<String> buildOrphanRemovalStringModel() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/TargetClassChooser2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/TargetClassChooser2_0.java
index bb35bf3c52..fa402d6aa8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/TargetClassChooser2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/TargetClassChooser2_0.java
@@ -15,9 +15,10 @@ import org.eclipse.jpt.common.ui.internal.widgets.ClassChooserComboPane;
import org.eclipse.jpt.common.ui.internal.widgets.Pane;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapterXXXX;
import org.eclipse.jpt.common.utility.internal.model.value.PropertyListValueModelAdapter;
+import org.eclipse.jpt.common.utility.internal.model.value.PropertyValueModelTools;
import org.eclipse.jpt.common.utility.model.value.ListValueModel;
-import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.common.utility.model.value.ModifiablePropertyValueModel;
+import org.eclipse.jpt.common.utility.model.value.PropertyValueModel;
import org.eclipse.jpt.jpa.core.jpa2.context.ElementCollectionMapping2_0;
import org.eclipse.jpt.jpa.ui.internal.JpaHelpContextIds;
import org.eclipse.osgi.util.NLS;
@@ -75,30 +76,13 @@ public class TargetClassChooser2_0 extends ClassChooserComboPane<ElementCollecti
@Override
protected ModifiablePropertyValueModel<String> buildTextModel() {
- return new PropertyAspectAdapterXXXX<ElementCollectionMapping2_0, String>(
- this.getSubjectHolder(),
- ElementCollectionMapping2_0.SPECIFIED_TARGET_CLASS_PROPERTY,
- ElementCollectionMapping2_0.DEFAULT_TARGET_CLASS_PROPERTY) {
- @Override
- protected String buildValue_() {
-
- String name = this.subject.getSpecifiedTargetClass();
- if (name == null) {
- name = TargetClassChooser2_0.this.getDefaultValue(this.subject);
- }
- return name;
- }
-
- @Override
- protected void setValue_(String value) {
-
- if (getDefaultValue(this.subject).equals(value)) {
- value = null;
- }
- this.subject.setSpecifiedTargetClass(value);
- }
- };
- }
+ return PropertyValueModelTools.modifiableSubjectModelAspectAdapter(
+ this.getSubjectHolder(),
+ ElementCollectionMapping2_0.TARGET_CLASS_PROPERTY,
+ m -> (m.getSpecifiedTargetClass() == null) ? this.defaultValue(m) : m.getSpecifiedTargetClass(),
+ (m, value) -> m.setSpecifiedTargetClass(defaultValue(m).equals(value) ? null : value)
+ );
+ }
@Override
protected ListValueModel<String> buildClassListModel() {
@@ -115,20 +99,15 @@ public class TargetClassChooser2_0 extends ClassChooserComboPane<ElementCollecti
return new PropertyAspectAdapterXXXX<ElementCollectionMapping2_0, String>(this.getSubjectHolder(), ElementCollectionMapping2_0.DEFAULT_TARGET_CLASS_PROPERTY) {
@Override
protected String buildValue_() {
- return TargetClassChooser2_0.this.getDefaultValue(this.subject);
+ return TargetClassChooser2_0.this.defaultValue(this.subject);
}
};
}
- String getDefaultValue(ElementCollectionMapping2_0 subject) {
+ String defaultValue(ElementCollectionMapping2_0 subject) {
String defaultValue = subject.getDefaultTargetClass();
-
- if (defaultValue != null) {
- return NLS.bind(
- JptCommonUiMessages.DEFAULT_WITH_ONE_PARAM,
- defaultValue
- );
- }
- return JptCommonUiMessages.DEFAULT_EMPTY;
+ return (defaultValue == null) ?
+ JptCommonUiMessages.DEFAULT_EMPTY :
+ NLS.bind(JptCommonUiMessages.DEFAULT_WITH_ONE_PARAM, defaultValue);
}
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/PersistenceUnitConnectionEditorPage2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/PersistenceUnitConnectionEditorPage2_0.java
index 9f2b630d24..f57c2b294f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/PersistenceUnitConnectionEditorPage2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/PersistenceUnitConnectionEditorPage2_0.java
@@ -235,14 +235,10 @@ public class PersistenceUnitConnectionEditorPage2_0
}
private PropertyValueModel<PersistenceUnitTransactionType> buildTransactionTypeModel() {
- return new PropertyAspectAdapterXXXX<PersistenceUnit, PersistenceUnitTransactionType>(
- buildPersistenceUnitModel(),
- PersistenceUnit.SPECIFIED_TRANSACTION_TYPE_PROPERTY,
- PersistenceUnit.DEFAULT_TRANSACTION_TYPE_PROPERTY) {
- @Override
- protected PersistenceUnitTransactionType buildValue_() {
- return this.subject.getTransactionType();
- }
- };
+ return PropertyValueModelTools.subjectModelAspectAdapter(
+ this.buildPersistenceUnitModel(),
+ PersistenceUnit.TRANSACTION_TYPE_PROPERTY,
+ m -> m.getTransactionType()
+ );
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitClassesComposite.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitClassesComposite.java
index 6e38f66d31..1c1b9a39ef 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitClassesComposite.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitClassesComposite.java
@@ -82,7 +82,7 @@ public class PersistenceUnitClassesComposite
this.addTriStateCheckBoxWithDefault(
container,
JptJpaUiPersistenceMessages.PERSISTENCE_UNIT_CLASSES_COMPOSITE_EXCLUDE_UNLISTED_CLASSES,
- buildExcludeUnlistedClassesModel(),
+ buildSpecifiedExcludeUnlistedClassesModel(),
buildExcludeUnlistedClassesStringModel(),
JpaHelpContextIds.PERSISTENCE_XML_GENERAL
);
@@ -153,7 +153,7 @@ public class PersistenceUnitClassesComposite
};
}
- private ModifiablePropertyValueModel<Boolean> buildExcludeUnlistedClassesModel() {
+ private ModifiablePropertyValueModel<Boolean> buildSpecifiedExcludeUnlistedClassesModel() {
return new PropertyAspectAdapterXXXX<PersistenceUnit, Boolean>(
getSubjectHolder(),
PersistenceUnit.SPECIFIED_EXCLUDE_UNLISTED_CLASSES_PROPERTY)
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitConnectionEditorPage.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitConnectionEditorPage.java
index 4391ab0ef9..66710ca79a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitConnectionEditorPage.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/PersistenceUnitConnectionEditorPage.java
@@ -192,15 +192,10 @@ public class PersistenceUnitConnectionEditorPage
}
private PropertyValueModel<PersistenceUnitTransactionType> buildTransactionTypeModel() {
- return new PropertyAspectAdapterXXXX<PersistenceUnit, PersistenceUnitTransactionType>(
- getSubjectHolder(),
- PersistenceUnit.DEFAULT_TRANSACTION_TYPE_PROPERTY,
- PersistenceUnit.SPECIFIED_TRANSACTION_TYPE_PROPERTY)
- {
- @Override
- protected PersistenceUnitTransactionType buildValue_() {
- return this.subject.getTransactionType();
- }
- };
+ return PropertyValueModelTools.subjectModelAspectAdapter(
+ this.getSubjectHolder(),
+ PersistenceUnit.TRANSACTION_TYPE_PROPERTY,
+ m -> m.getTransactionType()
+ );
}
} \ No newline at end of file

Back to the top