diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt')
18 files changed, 317 insertions, 159 deletions
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. |