Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbvosburgh2009-12-01 01:07:13 -0500
committerbvosburgh2009-12-01 01:07:13 -0500
commitad57d60958e249b4031db34bb48d728e60ed2131 (patch)
tree53abcbbaa096f8562233dacdfd7aa9806b37a0a6
parent208570496e979c13ee92b8ce6a6646ea374b4dc4 (diff)
downloadwebtools.dali-ad57d60958e249b4031db34bb48d728e60ed2131.tar.gz
webtools.dali-ad57d60958e249b4031db34bb48d728e60ed2131.tar.xz
webtools.dali-ad57d60958e249b4031db34bb48d728e60ed2131.zip
[293976] various metamodel generation problems
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/property_files/jpa_core.properties1
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaProject.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/JpaRootContextNode.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/PersistentType.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/TypeMapping.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaAttributeMapping.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaTypeMapping.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmPersistentType.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmTypeMapping.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/persistence/Persistence.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/persistence/PersistenceUnit.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/persistence/PersistenceXml.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaAnnotationDefintionProvider.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaFactory.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java144
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaAnnotationProvider.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCoreMessages.java1
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaAttributeMapping.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMapping.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEmbeddable.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappedSuperclass.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToManyMapping.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToOneMapping.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentAttribute.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentType.java630
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMapping.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMapping.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullTypeMapping.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmPersistentAttribute.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTypeMapping.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNode.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java929
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericRootContextNode.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPersistentType.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistentType.java1347
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistence.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceXml.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericJpaFactory2_0.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericMetamodelSynchronizer.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericPersistentTypeMetamodelSynchronizer.java189
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/NullMetamodelSynchronizer.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/NullPersistentTypeMetamodelSynchronizer.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java136
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java206
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentMember.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentType.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentAttribute.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentMember.java160
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentType.java326
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/JpaFactory2_0.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/JpaProject2_0.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/MetamodelSynchronizer.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/JpaRootContextNode2_0.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/PersistentTypeMetamodelSynchronizer.java)19
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/PersistentType2_0.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaPersistentType2_0.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/MetamodelGenerator.java)18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmPersistentType2_0.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/persistence/Persistence2_0.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/persistence/PersistenceUnit2_0.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/persistence/PersistenceXml2_0.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/GeneratedAnnotation.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/StaticMetamodelAnnotation.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/java/JavaResourcePersistentMember.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/java/JavaResourcePersistentType.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapping.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkIdMapping.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkManyToManyMapping.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkManyToOneMapping.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMapping.java13
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToOneMapping.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkVersionMapping.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v2_0/EclipseLink2_0JpaFactory.java14
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/properties/JpaProjectPropertiesPage.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/entity/data/operation/NewEntityClassOperation.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestTypeMapping.java7
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentAttributeTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java11
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java3
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentAttributeTests.java8
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentTypeTests.java62
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmBasicMappingTests.java46
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmCascadeTests.java20
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmColumnTests.java50
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedIdMappingTests.java30
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedMappingTests.java30
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmGeneratedValueTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmIdMappingTests.java48
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinColumnTests.java32
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinTableTests.java44
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToManyMappingTests.java50
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToOneMappingTests.java26
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToManyMappingTests.java50
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToOneMappingTests.java56
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTransientMappingTests.java26
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmVersionMappingTests.java30
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/GenericJavaOneToManyMapping2_0Tests.java3
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/GenericJavaOneToOneMapping2_0Tests.java3
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0Tests.java3
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/java/GenericJavaPersistentType2_0Tests.java17
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0Tests.java30
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmEmbeddedMapping2_0Tests.java56
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmManyToManyMapping2_0Tests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmOneToManyMapping2_0Tests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmOneToOneMapping2_0Tests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmPersistentAttribute2_0Tests.java10
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jpa2/context/orm/GenericOrmPersistentType2_0Tests.java8
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourcePersistentAttributeTests.java18
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourcePersistentTypeTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaOneToManyMappingTests.java20
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/java/EclipseLinkJavaOneToOneMappingTests.java20
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmBasicMappingTests.java16
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmConverterTests.java12
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmIdMappingTests.java16
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmManyToManyMappingTests.java8
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmManyToOneMappingTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmObjectTypeConverterTests.java30
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmOneToManyMappingTests.java12
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmOneToOneMappingTests.java8
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmPersistentAttributeTests.java8
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmStructConverterTests.java12
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmTransientMappingTests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmTypeConverterTests.java18
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmVersionMappingTests.java16
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/resource/java/TransformationAnnotationTests.java5
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/EclipseLink1_1OrmPersistentAttributeTests.java8
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink1_1/core/tests/internal/context/orm/EclipseLink1_1OrmTransientMappingTests.java2
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink2_0/core/tests/internal/context/java/EclipseLink2_0JavaOneToManyMappingTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink2_0/core/tests/internal/context/java/EclipseLink2_0JavaOneToOneMappingTests.java3
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink2_0/core/tests/internal/context/orm/EclipseLink2_0OrmOneToManyMappingTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink2_0/core/tests/internal/context/orm/EclipseLink2_0OrmOneToOneMappingTests.java6
143 files changed, 4108 insertions, 2857 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/property_files/jpa_core.properties b/jpa/plugins/org.eclipse.jpt.core/property_files/jpa_core.properties
index 52414732ba..f7b77f9ccb 100644
--- a/jpa/plugins/org.eclipse.jpt.core/property_files/jpa_core.properties
+++ b/jpa/plugins/org.eclipse.jpt.core/property_files/jpa_core.properties
@@ -43,7 +43,6 @@ REGISTRY_MISSING_ATTRIBUTE=The extension element ''{0}'' in plug-in ''{1}'' is m
REGISTRY_DUPLICATE=The plug-ins ''{0}'' and ''{1}'' have registered a duplicate attribute ''{2}'' for the extension element ''{3}'': ''{4}''.
REGISTRY_FAILED_INSTANTIATION=Unable to instantiate the class ''{0}'' for the extension element ''{1}'' in the plug-in ''{2}''.
UPDATE_JOB_NAME=Update JPA project: ''{0}''
-SYNCHRONIZE_METAMODEL_JOB_NAME=Synchronize JPA Canonical Metamodel: ''{0}''
PLATFORM_ID_DOES_NOT_EXIST=No JPA platform exists for the id: ''{0}''. The JPA project was not created for project ''{1}''. Ensure that the platform''s plugin has been added to this Eclipse installation.
DALI_EVENT_HANDLER_THREAD_NAME=Dali Event Handler
PREFERENCES_FLUSH_JOB_NAME=Flush Preferences: {0}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaProject.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaProject.java
index 4f63da8621..d087ef979c 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaProject.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/JpaProject.java
@@ -172,6 +172,13 @@ public interface JpaProject
// ********** Java resources **********
/**
+ * Return the Java resource compilation unit corresponding to the specified
+ * file. Return null if the file is not part of the JPA project or if the
+ * file's content is not Java source code.
+ */
+ JavaResourceCompilationUnit getJavaResourceCompilationUnit(IFile file);
+
+ /**
* Return the names of the JPA project's annotated Java classes
* (ignoring classes in JARs referenced in the persistence.xml).
*/
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/JpaRootContextNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/JpaRootContextNode.java
index 2dae5a0782..ad3dcf068b 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/JpaRootContextNode.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/JpaRootContextNode.java
@@ -10,9 +10,9 @@
package org.eclipse.jpt.core.context;
import java.util.List;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jpt.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.core.jpa2.MetamodelGenerator;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -26,7 +26,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IReporter;
* will almost certainly be broken (repeatedly) as the API evolves.
*/
public interface JpaRootContextNode
- extends JpaContextNode, MetamodelGenerator
+ extends JpaContextNode
{
// ********** persistence.xml **********
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/PersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/PersistentType.java
index 068bb29ef3..3d463641e0 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/PersistentType.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/PersistentType.java
@@ -14,7 +14,6 @@ import java.util.List;
import java.util.ListIterator;
import org.eclipse.jpt.core.JpaStructureNode;
-import org.eclipse.jpt.core.jpa2.MetamodelGenerator;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -28,7 +27,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IReporter;
* will almost certainly be broken (repeatedly) as the API evolves.
*/
public interface PersistentType
- extends JpaContextNode, JpaStructureNode, AccessHolder, MetamodelGenerator
+ extends JpaContextNode, JpaStructureNode, AccessHolder
{
// ********** name **********
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/TypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/TypeMapping.java
index d8b535445a..7867746d49 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/TypeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/TypeMapping.java
@@ -10,7 +10,6 @@
package org.eclipse.jpt.core.context;
import java.util.Iterator;
-import java.util.ListIterator;
import org.eclipse.jpt.db.Schema;
/**
@@ -89,7 +88,7 @@ public interface TypeMapping extends JpaContextNode {
/**
* A convenience methods for getting the attribute mappings from PersistentType.attributes()
*/
- <T extends AttributeMapping> ListIterator<T> attributeMappings();
+ <T extends AttributeMapping> Iterator<T> attributeMappings();
/**
* Return all the attribute mappings in the type mapping's
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaAttributeMapping.java
index 74e7af80ab..e8bea3fc5c 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaAttributeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaAttributeMapping.java
@@ -9,8 +9,6 @@
******************************************************************************/
package org.eclipse.jpt.core.context.java;
-import java.util.Iterator;
-
import org.eclipse.jpt.core.context.AttributeMapping;
import org.eclipse.jpt.core.resource.java.Annotation;
@@ -50,6 +48,6 @@ public interface JavaAttributeMapping
* Return all fully qualified annotation names that are supported with this mapping type.
* This includes all possible annotations, not just the ones that currently exist on the attribute.
*/
- Iterator<String> supportingAnnotationNames();
+ Iterable<String> getSupportingAnnotationNames();
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaTypeMapping.java
index 2c8f34f5f2..6e88d13c06 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaTypeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/java/JavaTypeMapping.java
@@ -10,38 +10,40 @@
package org.eclipse.jpt.core.context.java;
import java.util.Iterator;
-import java.util.ListIterator;
+
import org.eclipse.jpt.core.context.TypeMapping;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
/**
- *
- *
+ * Java type mapping (Entity, MappedSuperclass, Embeddable).
+ * <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
* stability. It is available at this early stage to solicit feedback from
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*/
-public interface JavaTypeMapping extends TypeMapping, JavaJpaContextNode
+public interface JavaTypeMapping
+ extends TypeMapping, JavaJpaContextNode
{
void initialize(JavaResourcePersistentType jrpt);
-
+
/**
- * Update the JavaTypeMapping context model object to match the JavaResourcePersistentType
- * resource model object. see {@link org.eclipse.jpt.core.JpaProject#update()}
+ * Update the context Java type mapping to match the resource model.
+ * @see org.eclipse.jpt.core.JpaProject#update()
*/
void update(JavaResourcePersistentType jrpt);
String getAnnotationName();
-
- Iterator<String> supportingAnnotationNames();
-
-
+
+ Iterable<String> getSupportingAnnotationNames();
+
+
// ********** covariant overrides **********
JavaPersistentType getPersistentType();
-
+
@SuppressWarnings("unchecked")
- ListIterator<JavaAttributeMapping> attributeMappings();
-} \ No newline at end of file
+ Iterator<JavaAttributeMapping> attributeMappings();
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmPersistentType.java
index 4c092108d6..a3f85778f6 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmPersistentType.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmPersistentType.java
@@ -52,9 +52,9 @@ public interface OrmPersistentType
int specifiedAttributesSize();
//TODO these are currently only used by tests, possibly remove them. OrmPersistenAttributes.setVirtual(boolean) is used by the UI
- OrmPersistentAttribute addSpecifiedPersistentAttribute(String mappingKey, String attributeName);
+ OrmPersistentAttribute addSpecifiedAttribute(String mappingKey, String attributeName);
- void removeSpecifiedPersistentAttribute(OrmPersistentAttribute ormPersistentAttribute);
+ void removeSpecifiedAttribute(OrmPersistentAttribute specifiedAttribute);
//***************** virtual attributes *************************************
@@ -77,28 +77,28 @@ public interface OrmPersistentType
/**
* Return whether this persistent type contains the given virtual persistent attribute.
*/
- boolean containsVirtualPersistentAttribute(OrmPersistentAttribute ormPersistentAttribute);
+ boolean containsVirtualAttribute(OrmPersistentAttribute ormPersistentAttribute);
/**
* Remove the given specified orm persistent attribute from the orm.xml. The attribute
* will be removed from the orm.xml and moved from the list of specified attributes
* to the list of virtual attributes.
*/
- void makePersistentAttributeVirtual(OrmPersistentAttribute ormPersistentAttribute);
+ void makeAttributeVirtual(OrmPersistentAttribute ormPersistentAttribute);
/**
* Add the given virtual orm persistent attribute to the orm.xml. The attribute will
* be added to the orm.xml and moved from the list of virtual attributes to the list
* of specified attributes
*/
- void makePersistentAttributeSpecified(OrmPersistentAttribute ormPersistentAttribute);
+ void makeAttributeSpecified(OrmPersistentAttribute ormPersistentAttribute);
/**
* Add the given virtual orm persistent attribute to the orm.xml with a mapping of
* type mappingKey. The attribute will be added to the orm.xml and moved from
* the list of virtual attributes to the list of specified attributes
*/
- void makePersistentAttributeSpecified(OrmPersistentAttribute ormPersistentAttribute, String mappingKey);
+ void makeAttributeSpecified(OrmPersistentAttribute ormPersistentAttribute, String mappingKey);
//******************* mapping morphing *******************
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmTypeMapping.java
index 6189cab0a5..375ab166cf 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmTypeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/orm/OrmTypeMapping.java
@@ -9,7 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.core.context.orm;
-import java.util.ListIterator;
+import java.util.Iterator;
+
import org.eclipse.jpt.core.context.TypeMapping;
import org.eclipse.jpt.core.context.XmlContextNode;
import org.eclipse.jpt.core.resource.orm.XmlEntityMappings;
@@ -82,6 +83,6 @@ public interface OrmTypeMapping
OrmPersistentType getPersistentType();
@SuppressWarnings("unchecked")
- ListIterator<OrmAttributeMapping> attributeMappings();
+ Iterator<OrmAttributeMapping> attributeMappings();
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/persistence/Persistence.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/persistence/Persistence.java
index e34141dbf1..b10fd0c16e 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/persistence/Persistence.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/persistence/Persistence.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2009 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.
@@ -10,9 +10,9 @@
package org.eclipse.jpt.core.context.persistence;
import java.util.ListIterator;
+
import org.eclipse.jpt.core.JpaStructureNode;
import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.jpa2.MetamodelGenerator;
import org.eclipse.jpt.core.resource.persistence.XmlPersistence;
/**
@@ -25,7 +25,7 @@ import org.eclipse.jpt.core.resource.persistence.XmlPersistence;
* will almost certainly be broken (repeatedly) as the API evolves.
*/
public interface Persistence
- extends XmlContextNode, JpaStructureNode, MetamodelGenerator
+ extends XmlContextNode, JpaStructureNode
{
/**
* Return the resource model object associated with this context model object
@@ -42,7 +42,7 @@ public interface Persistence
/**
* String constant associated with changes to the persistence units list
*/
- public final static String PERSISTENCE_UNITS_LIST = "persistenceUnits"; //$NON-NLS-1$
+ String PERSISTENCE_UNITS_LIST = "persistenceUnits"; //$NON-NLS-1$
/**
* Return an iterator on the list of persistence units.
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/persistence/PersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/persistence/PersistenceUnit.java
index f70066f74f..5ef826b65a 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/persistence/PersistenceUnit.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/persistence/PersistenceUnit.java
@@ -20,7 +20,6 @@ import org.eclipse.jpt.core.context.Generator;
import org.eclipse.jpt.core.context.PersistentType;
import org.eclipse.jpt.core.context.Query;
import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.jpa2.MetamodelGenerator;
import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
import org.eclipse.jpt.core.resource.persistence.XmlProperty;
@@ -36,7 +35,7 @@ import org.eclipse.jpt.core.resource.persistence.XmlProperty;
* will almost certainly be broken (repeatedly) as the API evolves.
*/
public interface PersistenceUnit
- extends XmlContextNode, JpaStructureNode, MetamodelGenerator
+ extends XmlContextNode, JpaStructureNode
{
/**
* Covariant override.
@@ -634,18 +633,19 @@ public interface PersistenceUnit
// ********** root entities **********
/**
- * The entity with the given name should be a root entity that has sub entities.
+ * The entity with the given name is a root entity that has sub entities.
* This will be stored by the persistence unit so that the entity can later
- * call {@link #isRootWithSubEntities(String)}
+ * call {@link #entityIsRootWithSubEntities(String)}
*/
- void addRootWithSubEntities(String entityName);
+ void addRootEntityWithSubEntities(String entityName);
/**
* Return whether the entity with the given name is a root entity
* that also has sub entities.
- * @see #addRootWithSubEntities(String)
+ * @see #addRootEntityWithSubEntities(String)
*/
- boolean isRootWithSubEntities(String entityName);
+ boolean entityIsRootWithSubEntities(String entityName);
+
// ********** updating **********
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/persistence/PersistenceXml.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/persistence/PersistenceXml.java
index a87a5c95f8..e78ca34667 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/persistence/PersistenceXml.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/persistence/PersistenceXml.java
@@ -10,7 +10,6 @@
package org.eclipse.jpt.core.context.persistence;
import org.eclipse.jpt.core.context.XmlFile;
-import org.eclipse.jpt.core.jpa2.MetamodelGenerator;
import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
/**
@@ -23,9 +22,9 @@ import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
* will almost certainly be broken (repeatedly) as the API evolves.
*/
public interface PersistenceXml
- extends XmlFile, MetamodelGenerator
+ extends XmlFile
{
- // **************** persistence *******************************************
+ // ********** persistence **********
/**
* String constant associated with changes to the persistence property
@@ -33,18 +32,18 @@ public interface PersistenceXml
public final static String PERSISTENCE_PROPERTY = "persistence"; //$NON-NLS-1$
/**
- * Return the content represented by the root of the persistence.xml file.
+ * Return the content represented by the root of the <code>persistence.xml</code> file.
* This may be null.
*/
Persistence getPersistence();
- // **************** updating **********************************************
+ // ********** updating **********
/**
- * Update the PersistenceXml context model object to match the JpaXmlResource
- * resource model object.
+ * Update the context persistence XML model to match the resource model.
* @see org.eclipse.jpt.core.JpaProject#update()
*/
void update(JpaXmlResource resource);
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaAnnotationDefintionProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaAnnotationDefintionProvider.java
index fb420786e3..90bc29d85a 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaAnnotationDefintionProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaAnnotationDefintionProvider.java
@@ -18,63 +18,64 @@ import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
import org.eclipse.jpt.utility.internal.iterators.ArrayListIterator;
public abstract class AbstractJpaAnnotationDefintionProvider
- implements JpaAnnotationDefinitionProvider
+ implements JpaAnnotationDefinitionProvider
{
private AnnotationDefinition[] typeAnnotationDefinitions;
-
+
private AnnotationDefinition[] typeMappingAnnotationDefinitions;
-
+
private AnnotationDefinition[] attributeAnnotationDefinitions;
-
-
+
+
protected AbstractJpaAnnotationDefintionProvider() {
super();
}
-
-
+
// ********** type annotation definitions **********
-
+
public synchronized Iterator<AnnotationDefinition> typeAnnotationDefinitions() {
if (this.typeAnnotationDefinitions == null) {
this.typeAnnotationDefinitions = this.buildTypeAnnotationDefinitions();
}
return new ArrayIterator<AnnotationDefinition>(this.typeAnnotationDefinitions);
}
-
+
protected AnnotationDefinition[] buildTypeAnnotationDefinitions() {
ArrayList<AnnotationDefinition> definitions = new ArrayList<AnnotationDefinition>();
this.addTypeAnnotationDefinitionsTo(definitions);
return definitions.toArray(new AnnotationDefinition[definitions.size()]);
}
-
+
/**
* Subclasses must override this to specify type annotation definitions.
*/
- protected void addTypeAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) {
+ protected void addTypeAnnotationDefinitionsTo(@SuppressWarnings("unused") List<AnnotationDefinition> definitions) {
// no op
}
-
+
+ // ********** type mapping annotation definitions **********
+
public synchronized Iterator<AnnotationDefinition> typeMappingAnnotationDefinitions() {
if (this.typeMappingAnnotationDefinitions == null) {
this.typeMappingAnnotationDefinitions = this.buildTypeMappingAnnotationDefinitions();
}
return new ArrayIterator<AnnotationDefinition>(this.typeMappingAnnotationDefinitions);
}
-
+
protected AnnotationDefinition[] buildTypeMappingAnnotationDefinitions() {
ArrayList<AnnotationDefinition> definitions = new ArrayList<AnnotationDefinition>();
this.addTypeMappingAnnotationDefinitionsTo(definitions);
return definitions.toArray(new AnnotationDefinition[definitions.size()]);
}
-
+
/**
- * Subclasses must override this to specify type mapping annotation definitions.
+ * Subclasses must override this to specify type mapping annotation
+ * definitions.
*/
- protected void addTypeMappingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) {
+ protected void addTypeMappingAnnotationDefinitionsTo(@SuppressWarnings("unused") List<AnnotationDefinition> definitions) {
// no op
}
-
-
+
// ********** attribute annotation definitions **********
public synchronized Iterator<AnnotationDefinition> attributeAnnotationDefinitions() {
@@ -83,17 +84,18 @@ public abstract class AbstractJpaAnnotationDefintionProvider
}
return new ArrayListIterator<AnnotationDefinition>(this.attributeAnnotationDefinitions);
}
-
+
protected AnnotationDefinition[] buildAttributeAnnotationDefinitions() {
ArrayList<AnnotationDefinition> definitions = new ArrayList<AnnotationDefinition>();
this.addAttributeAnnotationDefinitionsTo(definitions);
return definitions.toArray(new AnnotationDefinition[definitions.size()]);
}
-
+
/**
- * Subclasses must override this to specify attribute annotation definitions.
+ * Subclasses must override this to specify attribute annotation
+ * definitions.
*/
- protected void addAttributeAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) {
+ protected void addAttributeAnnotationDefinitionsTo(@SuppressWarnings("unused") List<AnnotationDefinition> definitions) {
// no op
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaFactory.java
index 452979a45d..10a5528f35 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaFactory.java
@@ -123,8 +123,6 @@ import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaUniqueConstrai
import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaVersionMapping;
import org.eclipse.jpt.core.internal.jpa1.context.java.NullJavaAssociationOverrideContainer;
import org.eclipse.jpt.core.internal.jpa1.context.java.VirtualAssociationOverride1_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.NullMetamodelSynchronizer;
-import org.eclipse.jpt.core.internal.jpa2.NullPersistentTypeMetamodelSynchronizer;
import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaOrderColumn2_0;
import org.eclipse.jpt.core.internal.jpa2.context.java.NullJavaCacheable2_0;
import org.eclipse.jpt.core.internal.jpa2.context.java.NullJavaDerivedId2_0;
@@ -132,8 +130,7 @@ import org.eclipse.jpt.core.internal.jpa2.context.java.NullJavaMapsId2_0;
import org.eclipse.jpt.core.internal.jpa2.context.java.NullJavaOrphanRemoval2_0;
import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
import org.eclipse.jpt.core.jpa2.JpaProject2_0;
-import org.eclipse.jpt.core.jpa2.MetamodelSynchronizer;
-import org.eclipse.jpt.core.jpa2.PersistentTypeMetamodelSynchronizer;
+import org.eclipse.jpt.core.jpa2.context.PersistentType2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaCacheable2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaCacheableHolder2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaDerivedId2_0;
@@ -169,12 +166,8 @@ public abstract class AbstractJpaFactory
return new GenericJpaProject((JpaProject2_0.Config) config);
}
- public MetamodelSynchronizer buildMetamodelSynchronizer(JpaProject2_0 jpaProject) {
- return NullMetamodelSynchronizer.instance();
- }
-
- public PersistentTypeMetamodelSynchronizer buildPersistentTypeMetamodelSynchronizer(PersistentTypeMetamodelSynchronizer.Owner owner, PersistentType persistentType) {
- return new NullPersistentTypeMetamodelSynchronizer();
+ public PersistentType2_0.MetamodelSynchronizer buildPersistentTypeMetamodelSynchronizer(PersistentType2_0 persistentType) {
+ return null;
}
public JpaDataSource buildJpaDataSource(JpaProject jpaProject, String connectionProfileName) {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java
index 474dbe761e..489eedc8ae 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java
@@ -29,7 +29,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jdt.core.ElementChangedEvent;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
@@ -47,15 +46,13 @@ import org.eclipse.jpt.core.JpaResourceModel;
import org.eclipse.jpt.core.JpaResourceModelListener;
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.context.JpaRootContextNode;
-import org.eclipse.jpt.core.context.PersistentType;
import org.eclipse.jpt.core.internal.resource.java.binary.BinaryPersistentTypeCache;
import org.eclipse.jpt.core.internal.resource.java.source.SourceCompilationUnit;
import org.eclipse.jpt.core.internal.utility.PlatformTools;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
import org.eclipse.jpt.core.jpa2.JpaProject2_0;
-import org.eclipse.jpt.core.jpa2.MetamodelSynchronizer;
+import org.eclipse.jpt.core.jpa2.context.JpaRootContextNode2_0;
import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
import org.eclipse.jpt.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragmentRoot;
@@ -80,7 +77,6 @@ import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException;
-import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -184,10 +180,12 @@ public abstract class AbstractJpaProject
*/
protected final ThreadLocalCommandExecutor modifySharedDocumentCommandExecutor;
- // ********** metamodel **********
+ /**
+ * The name of the Java project source folder that holds the generated
+ * metamodel. If the name is <code>null</code> the metamodel is not
+ * generated.
+ */
protected String metamodelSourceFolderName;
- protected final MetamodelSynchronizer metamodelSynchronizer;
- protected final Job metamodelSynchronizationJob;
// ********** constructor/initialization **********
@@ -213,14 +211,12 @@ public abstract class AbstractJpaProject
this.externalJavaResourcePersistentTypeCache = this.buildExternalJavaResourcePersistentTypeCache();
- this.rootContextNode = this.buildRootContextNode();
-
this.metamodelSourceFolderName = config.getMetamodelSourceFolderName();
if (this.metamodelSoureFolderNameIsInvalid()) {
this.metamodelSourceFolderName = null;
}
- this.metamodelSynchronizer = this.buildMetamodelSynchronizer();
- this.metamodelSynchronizationJob = this.buildMetamodelSynchronizationJob();
+
+ this.rootContextNode = this.buildRootContextNode();
// "update" the project before returning
this.setUpdater_(new SynchronousJpaProjectUpdater(this));
@@ -264,28 +260,6 @@ public abstract class AbstractJpaProject
return this.getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0);
}
- protected MetamodelSynchronizer buildMetamodelSynchronizer() {
- return this.isJpa2_0Compatible() ?
- ((JpaFactory2_0) this.getJpaFactory()).buildMetamodelSynchronizer(this) :
- null;
- }
-
- protected Job buildMetamodelSynchronizationJob() {
- return this.isJpa2_0Compatible() ?
- this.buildMetamodelSynchronizationJob_() :
- null;
- }
-
- protected Job buildMetamodelSynchronizationJob_() {
- Job job = new MetamodelSynchronizationJob(this.buildMetamodelSynchronizationJobName());
- job.setRule(this.project);
- return job;
- }
-
- protected String buildMetamodelSynchronizationJobName() {
- return NLS.bind(JptCoreMessages.SYNCHRONIZE_METAMODEL_JOB_NAME, this.getName());
- }
-
// ***** inner class
protected class InitialResourceProxyVisitor implements IResourceProxyVisitor {
protected InitialResourceProxyVisitor() {
@@ -317,18 +291,6 @@ public abstract class AbstractJpaProject
}
}
- // ***** inner class
- protected class MetamodelSynchronizationJob extends Job {
- protected MetamodelSynchronizationJob(String name) {
- super(name);
- }
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- AbstractJpaProject.this.synchronizeMetamodel_();
- return Status.OK_STATUS;
- }
- }
-
// ********** miscellaneous **********
@@ -724,7 +686,8 @@ public abstract class AbstractJpaProject
public JpaXmlResource getPersistenceXmlResource() {
return (JpaXmlResource) this.getResourceModel(
JptCorePlugin.DEFAULT_PERSISTENCE_XML_FILE_PATH,
- JptCorePlugin.PERSISTENCE_XML_CONTENT_TYPE);
+ JptCorePlugin.PERSISTENCE_XML_CONTENT_TYPE
+ );
}
public JpaXmlResource getDefaultOrmXmlResource() {
@@ -759,12 +722,11 @@ public abstract class AbstractJpaProject
// ********** annotated Java source classes **********
public Iterator<String> annotatedJavaSourceClassNames() {
- return getAnnotatedJavaSourceClassNames().iterator();
+ return this.getAnnotatedJavaSourceClassNames().iterator();
}
protected Iterable<String> getAnnotatedJavaSourceClassNames() {
- return new TransformationIterable<JavaResourcePersistentType, String>(
- getInternalAnnotatedSourceJavaResourcePersistentTypes()) {
+ return new TransformationIterable<JavaResourcePersistentType, String>(this.getInternalAnnotatedSourceJavaResourcePersistentTypes()) {
@Override
protected String transform(JavaResourcePersistentType jrpType) {
return jrpType.getQualifiedName();
@@ -778,8 +740,7 @@ public abstract class AbstractJpaProject
* @see org.eclipse.jpt.core.internal.utility.jdt.JPTTools#typeIsPersistable(org.eclipse.jpt.core.internal.utility.jdt.JPTTools.TypeAdapter)
*/
protected Iterable<JavaResourcePersistentType> getInternalAnnotatedSourceJavaResourcePersistentTypes() {
- return new FilteringIterable<JavaResourcePersistentType, JavaResourcePersistentType>(
- getInternalSourceJavaResourcePersistentTypes()) {
+ return new FilteringIterable<JavaResourcePersistentType, JavaResourcePersistentType>(this.getInternalSourceJavaResourcePersistentTypes()) {
@Override
protected boolean accept(JavaResourcePersistentType jrpType) {
return jrpType.isPersistable() && jrpType.isAnnotated(); // i.e. the type is valid and has a valid type annotation
@@ -792,30 +753,28 @@ public abstract class AbstractJpaProject
}
protected Iterable<String> getMappedJavaSourceClassNames() {
- return new TransformationIterable<JavaResourcePersistentType, String>(
- getInternalMappedSourceJavaResourcePersistentTypes()) {
+ return new TransformationIterable<JavaResourcePersistentType, String>(this.getInternalMappedSourceJavaResourcePersistentTypes()) {
@Override
protected String transform(JavaResourcePersistentType jrpType) {
return jrpType.getQualifiedName();
}
};
}
-
+
/**
* return only those valid "mapped" (i.e. annotated with @Entity, @Embeddable, etc.) Java
* resource persistent types that are part of the JPA project, ignoring those in JARs
* referenced in persistence.xml
*/
protected Iterable<JavaResourcePersistentType> getInternalMappedSourceJavaResourcePersistentTypes() {
- return new FilteringIterable<JavaResourcePersistentType, JavaResourcePersistentType>(
- getInternalAnnotatedSourceJavaResourcePersistentTypes()) {
+ return new FilteringIterable<JavaResourcePersistentType, JavaResourcePersistentType>(this.getInternalAnnotatedSourceJavaResourcePersistentTypes()) {
@Override
protected boolean accept(JavaResourcePersistentType jrpType) {
return jrpType.isMapped(); // i.e. the type is already persistable and annotated
}
};
}
-
+
/**
* return only those Java resource persistent types that are
* part of the JPA project, ignoring those in JARs referenced in persistence.xml
@@ -858,6 +817,26 @@ public abstract class AbstractJpaProject
}
+ // ********** metamodel **********
+
+ public Iterable<JavaResourcePersistentType> getGeneratedMetamodelTypes() {
+ if (this.metamodelSourceFolderName == null) {
+ return EmptyIterable.instance();
+ }
+ final IPackageFragmentRoot genSourceFolder = this.getMetamodelPackageFragmentRoot();
+ return new FilteringIterable<JavaResourcePersistentType, JavaResourcePersistentType>(this.getInternalSourceJavaResourcePersistentTypes()) {
+ @Override
+ protected boolean accept(JavaResourcePersistentType jrpt) {
+ return jrpt.isGeneratedMetamodel(genSourceFolder);
+ }
+ };
+ }
+
+ public JavaResourceCompilationUnit getJavaResourceCompilationUnit(IFile file) {
+ return (JavaResourceCompilationUnit) this.getResourceModel(file, JptCorePlugin.JAVA_SOURCE_CONTENT_TYPE);
+ }
+
+
// ********** Java resource persistent type look-up **********
public JavaResourcePersistentType getJavaResourcePersistentType(String typeName) {
@@ -963,8 +942,21 @@ public abstract class AbstractJpaProject
public void setMetamodelSourceFolderName(String metamodelSourceFolderName) {
String old = this.metamodelSourceFolderName;
this.metamodelSourceFolderName = metamodelSourceFolderName;
- JptCorePlugin.setMetamodelSourceFolderName(this.project, metamodelSourceFolderName);
- this.firePropertyChanged(METAMODEL_SOURCE_FOLDER_NAME_PROPERTY, old, metamodelSourceFolderName);
+ if (this.attributeValueHasChanged(old, metamodelSourceFolderName)) {
+ JptCorePlugin.setMetamodelSourceFolderName(this.project, metamodelSourceFolderName);
+ this.firePropertyChanged(METAMODEL_SOURCE_FOLDER_NAME_PROPERTY, old, metamodelSourceFolderName);
+ if (metamodelSourceFolderName == null) {
+ this.disposeMetamodel();
+ } else {
+ this.initializeMetamodel();
+ }
+ }
+ }
+
+ public void initializeMetamodel() {
+ if (this.isJpa2_0Compatible()) {
+ ((JpaRootContextNode2_0) this.rootContextNode).initializeMetamodel();
+ }
}
/**
@@ -973,17 +965,15 @@ public abstract class AbstractJpaProject
public void synchronizeMetamodel() {
if (this.isJpa2_0Compatible()) {
if (this.metamodelSourceFolderName != null) {
- this.metamodelSynchronizationJob.schedule();
+ ((JpaRootContextNode2_0) this.rootContextNode).synchronizeMetamodel();
}
}
}
- protected void synchronizeMetamodel_() {
- this.getRootContextNode().synchronizeMetamodel();
- }
-
- public void synchronizeMetamodel(PersistentType persistentType) {
- this.metamodelSynchronizer.synchronize(persistentType);
+ public void disposeMetamodel() {
+ if (this.isJpa2_0Compatible()) {
+ ((JpaRootContextNode2_0) this.rootContextNode).disposeMetamodel();
+ }
}
public IPackageFragmentRoot getMetamodelPackageFragmentRoot() {
@@ -995,7 +985,7 @@ public abstract class AbstractJpaProject
}
/**
- * If the metamodel source folder is not longer a Java project source
+ * If the metamodel source folder is no longer a Java project source
* folder, clear it out.
*/
protected void checkMetamodelSourceFolderName() {
@@ -1005,27 +995,27 @@ public abstract class AbstractJpaProject
}
protected boolean metamodelSoureFolderNameIsInvalid() {
- return ! this.metamodelSoureFolderNameIsValid();
+ return ! this.metamodelSourceFolderNameIsValid();
}
- protected boolean metamodelSoureFolderNameIsValid() {
- return CollectionTools.contains(this.getSourceFolderNames(), this.metamodelSourceFolderName);
+ protected boolean metamodelSourceFolderNameIsValid() {
+ return CollectionTools.contains(this.getJavaSourceFolderNames(), this.metamodelSourceFolderName);
}
- // ********** source folder names **********
+ // ********** Java source folder names **********
- public Iterable<String> getSourceFolderNames() {
+ public Iterable<String> getJavaSourceFolderNames() {
try {
- return this.getSourceFolderNames_();
+ return this.getJavaSourceFolderNames_();
} catch (JavaModelException ex) {
JptCorePlugin.log(ex);
return EmptyIterable.instance();
}
}
- protected Iterable<String> getSourceFolderNames_() throws JavaModelException {
- return new TransformationIterable<IPackageFragmentRoot, String>(this.getSourceFolders()) {
+ protected Iterable<String> getJavaSourceFolderNames_() throws JavaModelException {
+ return new TransformationIterable<IPackageFragmentRoot, String>(this.getJavaSourceFolders()) {
@Override
protected String transform(IPackageFragmentRoot pfr) {
return pfr.getElementName();
@@ -1033,7 +1023,7 @@ public abstract class AbstractJpaProject
};
}
- protected Iterable<IPackageFragmentRoot> getSourceFolders() throws JavaModelException {
+ protected Iterable<IPackageFragmentRoot> getJavaSourceFolders() throws JavaModelException {
return new FilteringIterable<IPackageFragmentRoot, IPackageFragmentRoot>(
this.getPackageFragmentRoots(),
SOURCE_PACKAGE_FRAGMENT_ROOT_FILTER
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaAnnotationProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaAnnotationProvider.java
index 640b4bffbe..07794ca782 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaAnnotationProvider.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaAnnotationProvider.java
@@ -41,10 +41,9 @@ public class GenericJpaAnnotationProvider
}
- // ********** static methods **********
+ // ********** convenience methods **********
- protected static Iterator<String> annotationNames(
- Iterator<AnnotationDefinition> annotationDefinitions) {
+ protected Iterator<String> annotationNames(Iterator<AnnotationDefinition> annotationDefinitions) {
return new TransformationIterator<AnnotationDefinition, String>(annotationDefinitions) {
@Override
protected String transform(AnnotationDefinition annotationDefinition) {
@@ -53,8 +52,7 @@ public class GenericJpaAnnotationProvider
};
}
- protected static AnnotationDefinition getAnnotationDefinition(
- String annotationName, Iterator<AnnotationDefinition> annotationDefinitions) {
+ protected AnnotationDefinition selectAnnotationDefinition(Iterator<AnnotationDefinition> annotationDefinitions, String annotationName) {
while (annotationDefinitions.hasNext()) {
AnnotationDefinition annotationDefinition = annotationDefinitions.next();
if (annotationDefinition.getAnnotationName().equals(annotationName)) {
@@ -74,109 +72,92 @@ public class GenericJpaAnnotationProvider
// ********** type annotations **********
- @SuppressWarnings("unchecked")
public Iterator<String> typeAnnotationNames() {
- return new CompositeIterator<String>(
- annotationNames(typeAnnotationDefinitions()));
+ return this.annotationNames(this.typeAnnotationDefinitions());
}
protected Iterator<AnnotationDefinition> typeAnnotationDefinitions() {
return new CompositeIterator<AnnotationDefinition> (
- new TransformationIterator<JpaAnnotationDefinitionProvider, Iterator<AnnotationDefinition>>(
- this.annotationDefinitionProviders()) {
+ new TransformationIterator<JpaAnnotationDefinitionProvider, Iterator<AnnotationDefinition>>(this.annotationDefinitionProviders()) {
@Override
- protected Iterator<AnnotationDefinition> transform(
- JpaAnnotationDefinitionProvider annotationDefinitionProvider) {
+ protected Iterator<AnnotationDefinition> transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) {
return annotationDefinitionProvider.typeAnnotationDefinitions();
}
- });
+ }
+ );
}
public Iterator<String> typeMappingAnnotationNames() {
- return new CompositeIterator<String>(
- annotationNames(typeMappingAnnotationDefinitions()));
+ return this.annotationNames(typeMappingAnnotationDefinitions());
}
protected Iterator<AnnotationDefinition> typeMappingAnnotationDefinitions() {
return new CompositeIterator<AnnotationDefinition> (
- new TransformationIterator<JpaAnnotationDefinitionProvider, Iterator<AnnotationDefinition>>(
- this.annotationDefinitionProviders()) {
+ new TransformationIterator<JpaAnnotationDefinitionProvider, Iterator<AnnotationDefinition>>(this.annotationDefinitionProviders()) {
@Override
- protected Iterator<AnnotationDefinition> transform(
- JpaAnnotationDefinitionProvider annotationDefinitionProvider) {
+ protected Iterator<AnnotationDefinition> transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) {
return annotationDefinitionProvider.typeMappingAnnotationDefinitions();
}
- });
+ }
+ );
}
- public Annotation buildTypeAnnotation(
- JavaResourcePersistentType parent, Type type, String annotationName) {
+ public Annotation buildTypeAnnotation(JavaResourcePersistentType parent, Type type, String annotationName) {
return this.getTypeAnnotationDefinition(annotationName).buildAnnotation(parent, type);
}
- public Annotation buildTypeAnnotation(
- JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
- return this.getTypeAnnotationDefinition(jdtAnnotation.getElementName()).
- buildAnnotation(parent, jdtAnnotation);
+ public Annotation buildTypeAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ return this.getTypeAnnotationDefinition(jdtAnnotation.getElementName()).buildAnnotation(parent, jdtAnnotation);
}
protected AnnotationDefinition getTypeAnnotationDefinition(String annotationName) {
- AnnotationDefinition annotationDefinition =
- getAnnotationDefinition(annotationName, this.typeAnnotationDefinitions());
+ AnnotationDefinition annotationDefinition = this.selectAnnotationDefinition(this.typeAnnotationDefinitions(), annotationName);
if (annotationDefinition == null) {
throw new IllegalArgumentException("unsupported type annotation: " + annotationName); //$NON-NLS-1$
}
return annotationDefinition;
}
- public Annotation buildNullTypeAnnotation(
- JavaResourcePersistentType parent, String annotationName) {
+ public Annotation buildNullTypeAnnotation(JavaResourcePersistentType parent, String annotationName) {
return this.getTypeAnnotationDefinition(annotationName).buildNullAnnotation(parent);
}
// ********** attribute annotations **********
- @SuppressWarnings("unchecked")
public Iterator<String> attributeAnnotationNames() {
- return new CompositeIterator<String>(
- annotationNames(attributeAnnotationDefinitions()));
+ return this.annotationNames(attributeAnnotationDefinitions());
}
protected Iterator<AnnotationDefinition> attributeAnnotationDefinitions() {
return new CompositeIterator<AnnotationDefinition> (
- new TransformationIterator<JpaAnnotationDefinitionProvider, Iterator<AnnotationDefinition>>(
- this.annotationDefinitionProviders()) {
+ new TransformationIterator<JpaAnnotationDefinitionProvider, Iterator<AnnotationDefinition>>(this.annotationDefinitionProviders()) {
@Override
- protected Iterator<AnnotationDefinition> transform(
- JpaAnnotationDefinitionProvider annotationDefinitionProvider) {
+ protected Iterator<AnnotationDefinition> transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) {
return annotationDefinitionProvider.attributeAnnotationDefinitions();
}
- });
+ }
+ );
}
- public Annotation buildAttributeAnnotation(
- JavaResourcePersistentAttribute parent, Attribute attribute, String annotationName) {
+ public Annotation buildAttributeAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute, String annotationName) {
return this.getAttributeAnnotationDefinition(annotationName).buildAnnotation(parent, attribute);
}
- public Annotation buildAttributeAnnotation(
- JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
- return this.getAttributeAnnotationDefinition(jdtAnnotation.getElementName()).
- buildAnnotation(parent, jdtAnnotation);
+ public Annotation buildAttributeAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) {
+ return this.getAttributeAnnotationDefinition(jdtAnnotation.getElementName()).buildAnnotation(parent, jdtAnnotation);
}
- public Annotation buildNullAttributeAnnotation(
- JavaResourcePersistentAttribute parent, String annotationName) {
+ public Annotation buildNullAttributeAnnotation(JavaResourcePersistentAttribute parent, String annotationName) {
return this.getAttributeAnnotationDefinition(annotationName).buildNullAnnotation(parent);
}
protected AnnotationDefinition getAttributeAnnotationDefinition(String annotationName) {
- AnnotationDefinition annotationDefinition =
- getAnnotationDefinition(annotationName, this.attributeAnnotationDefinitions());
+ AnnotationDefinition annotationDefinition = this.selectAnnotationDefinition(this.attributeAnnotationDefinitions(), annotationName);
if (annotationDefinition == null) {
throw new IllegalArgumentException("unsupported attribute annotation: " + annotationName); //$NON-NLS-1$
}
return annotationDefinition;
}
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCoreMessages.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCoreMessages.java
index e0915d1a5d..1786c2e900 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCoreMessages.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCoreMessages.java
@@ -51,7 +51,6 @@ public class JptCoreMessages {
public static String REGISTRY_DUPLICATE;
public static String REGISTRY_FAILED_INSTANTIATION;
public static String UPDATE_JOB_NAME;
- public static String SYNCHRONIZE_METAMODEL_JOB_NAME;
public static String PLATFORM_ID_DOES_NOT_EXIST;
public static String DALI_EVENT_HANDLER_THREAD_NAME;
public static String PREFERENCES_FLUSH_JOB_NAME;
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaAttributeMapping.java
index 9d2348efe7..bd856bfd80 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaAttributeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaAttributeMapping.java
@@ -12,6 +12,7 @@ package org.eclipse.jpt.core.internal.context.java;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Vector;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.context.AttributeMapping;
@@ -33,7 +34,6 @@ import org.eclipse.jpt.core.resource.java.Annotation;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.iterators.ArrayListIterator;
import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
import org.eclipse.jpt.utility.internal.iterators.SingleElementIterator;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -48,13 +48,33 @@ public abstract class AbstractJavaAttributeMapping<T extends Annotation>
{
protected T mappingAnnotation;
- private String[] supportingAnnotationNames;
+ protected Vector<String> supportingAnnotationNames;
protected AbstractJavaAttributeMapping(JavaPersistentAttribute parent) {
super(parent);
}
+ @SuppressWarnings("unchecked")
+ public void initialize(Annotation annotation) {
+ this.mappingAnnotation = (T) annotation;
+ this.initialize();
+ }
+
+ protected void initialize() {
+ // do nothing by default
+ }
+
+ @SuppressWarnings("unchecked")
+ public void update(Annotation annotation) {
+ this.mappingAnnotation = (T) annotation;
+ this.update();
+ }
+
+ protected void update() {
+ // do nothing by default
+ }
+
@Override
public JavaPersistentAttribute getParent() {
return (JavaPersistentAttribute) super.getParent();
@@ -167,47 +187,29 @@ public abstract class AbstractJavaAttributeMapping<T extends Annotation>
return null;
}
- // ********** supporting annotation names **********
-
- public Iterator<String> supportingAnnotationNames() {
- return new ArrayListIterator<String>(getSupportingAnnotationNames());
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.getName());
}
-
- protected synchronized String[] getSupportingAnnotationNames() {
+
+
+ // ********** supporting annotation names **********
+
+ public Iterable<String> getSupportingAnnotationNames() {
if (this.supportingAnnotationNames == null) {
this.supportingAnnotationNames = this.buildSupportingAnnotationNames();
}
return this.supportingAnnotationNames;
}
-
- protected String[] buildSupportingAnnotationNames() {
- return new String[0];
- }
-
-
- @SuppressWarnings("unchecked")
- public void initialize(Annotation annotation) {
- this.mappingAnnotation = (T) annotation;
- this.initialize();
- }
- protected void initialize() {
- // do nothing by default
+ protected Vector<String> buildSupportingAnnotationNames() {
+ Vector<String> names = new Vector<String>();
+ this.addSupportingAnnotationNamesTo(names);
+ return names;
}
- @SuppressWarnings("unchecked")
- public void update(Annotation annotation) {
- this.mappingAnnotation = (T) annotation;
- this.update();
- }
-
- protected void update() {
- // do nothing by default
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getName());
+ protected void addSupportingAnnotationNamesTo(@SuppressWarnings("unused") Vector<String> names) {
+ // the default is none
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java
index b7181fc07f..84b65f332f 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java
@@ -11,6 +11,8 @@ package org.eclipse.jpt.core.internal.context.java;
import java.util.Iterator;
import java.util.List;
+import java.util.Vector;
+
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.context.AttributeMapping;
@@ -25,7 +27,6 @@ import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.core.resource.java.Annotation;
import org.eclipse.jpt.core.resource.java.JPA;
import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.ArrayTools;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
@@ -58,11 +59,10 @@ public abstract class AbstractJavaBaseEmbeddedMapping<T extends Annotation>
//****************** JavaAttributeMapping implementation *******************
@Override
- protected String[] buildSupportingAnnotationNames() {
- return ArrayTools.addAll(
- super.buildSupportingAnnotationNames(),
- JPA.ATTRIBUTE_OVERRIDE,
- JPA.ATTRIBUTE_OVERRIDES);
+ protected void addSupportingAnnotationNamesTo(Vector<String> names) {
+ super.addSupportingAnnotationNamesTo(names);
+ names.add(JPA.ATTRIBUTE_OVERRIDE);
+ names.add(JPA.ATTRIBUTE_OVERRIDES);
}
public Embeddable getEmbeddable() {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMapping.java
index 95c7c29a94..b4630cbc31 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMapping.java
@@ -11,6 +11,7 @@ package org.eclipse.jpt.core.internal.context.java;
import java.util.Iterator;
import java.util.List;
+import java.util.Vector;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.MappingKeys;
@@ -31,7 +32,6 @@ import org.eclipse.jpt.core.resource.java.JPA;
import org.eclipse.jpt.core.resource.java.LobAnnotation;
import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.ArrayTools;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -81,13 +81,12 @@ public abstract class AbstractJavaBasicMapping
}
@Override
- protected String[] buildSupportingAnnotationNames() {
- return ArrayTools.addAll(
- super.buildSupportingAnnotationNames(),
- JPA.COLUMN,
- JPA.LOB,
- JPA.TEMPORAL,
- JPA.ENUMERATED);
+ protected void addSupportingAnnotationNamesTo(Vector<String> names) {
+ super.addSupportingAnnotationNamesTo(names);
+ names.add(JPA.COLUMN);
+ names.add(JPA.LOB);
+ names.add(JPA.TEMPORAL);
+ names.add(JPA.ENUMERATED);
}
public String getDefaultColumnName() {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEmbeddable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEmbeddable.java
index 272d0f0cd3..0bcff08ea6 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEmbeddable.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEmbeddable.java
@@ -9,12 +9,11 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.context.java;
-import java.util.Iterator;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.java.JavaEmbeddable;
import org.eclipse.jpt.core.context.java.JavaPersistentType;
import org.eclipse.jpt.core.resource.java.EmbeddableAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
public abstract class AbstractJavaEmbeddable
@@ -33,8 +32,8 @@ public abstract class AbstractJavaEmbeddable
return EmbeddableAnnotation.ANNOTATION_NAME;
}
- public Iterator<String> supportingAnnotationNames() {
- return EmptyIterator.instance();
+ public Iterable<String> getSupportingAnnotationNames() {
+ return EmptyIterable.instance();
}
public boolean isMapped() {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java
index e5ace7151e..5023cfb1f1 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java
@@ -67,7 +67,7 @@ import org.eclipse.jpt.db.Schema;
import org.eclipse.jpt.utility.Filter;
import org.eclipse.jpt.utility.internal.ArrayTools;
import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
@@ -360,8 +360,10 @@ public abstract class AbstractJavaEntity
return EntityAnnotation.ANNOTATION_NAME;
}
- public Iterator<String> supportingAnnotationNames() {
- return new ArrayIterator<String>(
+ public Iterable<String> getSupportingAnnotationNames() {
+ return SUPPORTING_ANNOTATION_NAMES;
+ }
+ protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
JPA.TABLE,
JPA.SECONDARY_TABLE,
JPA.SECONDARY_TABLES,
@@ -391,8 +393,9 @@ public abstract class AbstractJavaEntity
JPA.ATTRIBUTE_OVERRIDE,
JPA.ATTRIBUTE_OVERRIDES,
JPA.ASSOCIATION_OVERRIDE,
- JPA.ASSOCIATION_OVERRIDES);
- }
+ JPA.ASSOCIATION_OVERRIDES
+ };
+ protected static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
//****************** Entity implementation *******************
@@ -886,7 +889,7 @@ public abstract class AbstractJavaEntity
* and has no descendants and no specified inheritance strategy has been defined.
*/
protected boolean isRootNoDescendantsNoStrategyDefined() {
- return isRoot() && !getPersistenceUnit().isRootWithSubEntities(this.getName()) && getSpecifiedInheritanceStrategy() == null;
+ return isRoot() && !getPersistenceUnit().entityIsRootWithSubEntities(this.getName()) && getSpecifiedInheritanceStrategy() == null;
}
/**
@@ -1159,7 +1162,7 @@ public abstract class AbstractJavaEntity
}
public void addSubEntity(Entity subEntity) {
- getPersistenceUnit().addRootWithSubEntities(getName());
+ getPersistenceUnit().addRootEntityWithSubEntities(getName());
}
protected void updateDiscriminatorColumn() {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java
index 47725d019c..b52c20ffb7 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java
@@ -11,6 +11,7 @@ package org.eclipse.jpt.core.internal.context.java;
import java.util.Iterator;
import java.util.List;
+import java.util.Vector;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.MappingKeys;
@@ -31,7 +32,6 @@ import org.eclipse.jpt.core.resource.java.SequenceGeneratorAnnotation;
import org.eclipse.jpt.core.resource.java.TableGeneratorAnnotation;
import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.ArrayTools;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
@@ -98,14 +98,13 @@ public abstract class AbstractJavaIdMapping
}
@Override
- protected String[] buildSupportingAnnotationNames() {
- return ArrayTools.addAll(
- super.buildSupportingAnnotationNames(),
- JPA.COLUMN,
- JPA.GENERATED_VALUE,
- JPA.TEMPORAL,
- JPA.TABLE_GENERATOR,
- JPA.SEQUENCE_GENERATOR);
+ protected void addSupportingAnnotationNamesTo(Vector<String> names) {
+ super.addSupportingAnnotationNamesTo(names);
+ names.add(JPA.COLUMN);
+ names.add(JPA.GENERATED_VALUE);
+ names.add(JPA.TEMPORAL);
+ names.add(JPA.TABLE_GENERATOR);
+ names.add(JPA.SEQUENCE_GENERATOR);
}
public String getDefaultColumnName() {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappedSuperclass.java
index f8eccaa765..afb7f125fc 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappedSuperclass.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappedSuperclass.java
@@ -9,8 +9,6 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.context.java;
-import java.util.Iterator;
-
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.java.JavaMappedSuperclass;
import org.eclipse.jpt.core.context.java.JavaPersistentType;
@@ -18,7 +16,7 @@ import org.eclipse.jpt.core.resource.java.IdClassAnnotation;
import org.eclipse.jpt.core.resource.java.JPA;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.core.resource.java.MappedSuperclassAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
public abstract class AbstractJavaMappedSuperclass extends AbstractJavaTypeMapping
implements JavaMappedSuperclass
@@ -42,8 +40,10 @@ public abstract class AbstractJavaMappedSuperclass extends AbstractJavaTypeMappi
return MappedSuperclassAnnotation.ANNOTATION_NAME;
}
- public Iterator<String> supportingAnnotationNames() {
- return new ArrayIterator<String>(
+ public Iterable<String> getSupportingAnnotationNames() {
+ return SUPPORTING_ANNOTATION_NAMES;
+ }
+ protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
JPA.ID_CLASS,
JPA.EXCLUDE_DEFAULT_LISTENERS,
JPA.EXCLUDE_SUPERCLASS_LISTENERS,
@@ -54,8 +54,9 @@ public abstract class AbstractJavaMappedSuperclass extends AbstractJavaTypeMappi
JPA.POST_REMOVE,
JPA.PRE_UPDATE,
JPA.POST_UPDATE,
- JPA.POST_LOAD);
- }
+ JPA.POST_LOAD
+ };
+ protected static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
public char getIdClassEnclosingTypeSeparator() {
return '.';
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java
index 438aa8caa9..17006f6fbc 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java
@@ -11,6 +11,7 @@ package org.eclipse.jpt.core.internal.context.java;
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.Vector;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.JptCorePlugin;
@@ -26,7 +27,6 @@ import org.eclipse.jpt.core.resource.java.JPA;
import org.eclipse.jpt.core.resource.java.MapKeyAnnotation;
import org.eclipse.jpt.core.resource.java.RelationshipMappingAnnotation;
import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.ArrayTools;
import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
@@ -72,20 +72,14 @@ public abstract class AbstractJavaMultiRelationshipMapping<T extends Relationshi
// ********** AbstractJavaAttributeMapping implementation **********
@Override
- protected String[] buildSupportingAnnotationNames() {
- String[] annotationNames = ArrayTools.addAll(
- super.buildSupportingAnnotationNames(),
- JPA.JOIN_TABLE,
- JPA.MAP_KEY,
- JPA.ORDER_BY);
-
- if (getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
- annotationNames = ArrayTools.addAll(
- annotationNames,
- JPA2_0.ORDER_COLUMN);
+ protected void addSupportingAnnotationNamesTo(Vector<String> names) {
+ super.addSupportingAnnotationNamesTo(names);
+ names.add(JPA.JOIN_TABLE);
+ names.add(JPA.MAP_KEY);
+ names.add(JPA.ORDER_BY);
+ if (this.getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
+ names.add(JPA2_0.ORDER_COLUMN);
}
-
- return annotationNames;
}
// ********** AbstractJavaRelationshipMapping implementation **********
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToManyMapping.java
index f0fcc2128c..b936a215f1 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToManyMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToManyMapping.java
@@ -9,7 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.context.java;
-import org.eclipse.jpt.core.JptCorePlugin;
+import java.util.Vector;
+
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.java.JavaOneToManyRelationshipReference;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
@@ -17,10 +18,8 @@ import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaOneToManyMapping2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovable2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.core.resource.java.JPA;
import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
-import org.eclipse.jpt.utility.internal.ArrayTools;
public abstract class AbstractJavaOneToManyMapping<T extends OneToManyAnnotation>
@@ -54,19 +53,10 @@ public abstract class AbstractJavaOneToManyMapping<T extends OneToManyAnnotation
}
@Override
- protected String[] buildSupportingAnnotationNames() {
- String[] annotationNames = ArrayTools.addAll(
- super.buildSupportingAnnotationNames(),
- JPA.JOIN_COLUMN,
- JPA.JOIN_COLUMNS);
-
- if (getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
- annotationNames = ArrayTools.addAll(
- annotationNames,
- JPA2_0.ONE_TO_MANY__ORPHAN_REMOVAL);
- }
-
- return annotationNames;
+ protected void addSupportingAnnotationNamesTo(Vector<String> names) {
+ super.addSupportingAnnotationNamesTo(names);
+ names.add(JPA.JOIN_COLUMN);
+ names.add(JPA.JOIN_COLUMNS);
}
public String getKey() {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToOneMapping.java
index 1932fff04a..a5e9c49144 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToOneMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToOneMapping.java
@@ -9,7 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.context.java;
-import org.eclipse.jpt.core.JptCorePlugin;
+import java.util.Vector;
+
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.java.JavaOneToOneRelationshipReference;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
@@ -18,10 +19,8 @@ import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaOneToOneMapping2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovable2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.core.resource.java.JPA;
import org.eclipse.jpt.core.resource.java.OneToOneAnnotation;
-import org.eclipse.jpt.utility.internal.ArrayTools;
public abstract class AbstractJavaOneToOneMapping
@@ -60,21 +59,12 @@ public abstract class AbstractJavaOneToOneMapping
}
@Override
- protected String[] buildSupportingAnnotationNames() {
- String[] annotationNames = ArrayTools.addAll(
- super.buildSupportingAnnotationNames(),
- JPA.PRIMARY_KEY_JOIN_COLUMN,
- JPA.PRIMARY_KEY_JOIN_COLUMNS);
-
- if (getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
- annotationNames = ArrayTools.addAll(
- annotationNames,
- JPA2_0.ONE_TO_ONE__ORPHAN_REMOVAL);
- }
-
- return annotationNames;
+ protected void addSupportingAnnotationNamesTo(Vector<String> names) {
+ super.addSupportingAnnotationNamesTo(names);
+ names.add(JPA.PRIMARY_KEY_JOIN_COLUMN);
+ names.add(JPA.PRIMARY_KEY_JOIN_COLUMNS);
}
-
+
public String getKey() {
return MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentAttribute.java
index 6e70385954..a66f6f2cad 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentAttribute.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentAttribute.java
@@ -36,7 +36,7 @@ import org.eclipse.jpt.utility.internal.ArrayTools;
import org.eclipse.jpt.utility.internal.ClassTools;
import org.eclipse.jpt.utility.internal.Tools;
import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -456,8 +456,7 @@ public abstract class AbstractJavaPersistentAttribute
String newAnnotation = (newMapping == null) ? null : newMapping.getAnnotationName();
JavaAttributeMapping mapping = (newMapping == null) ? this.defaultMapping : newMapping;
- String[] newSupportingAnnotationNames = ArrayTools.array(mapping.supportingAnnotationNames(), EMPTY_STRING_ARRAY);
- this.resourcePersistentAttribute.setPrimaryAnnotation(newAnnotation, newSupportingAnnotationNames);
+ this.resourcePersistentAttribute.setPrimaryAnnotation(newAnnotation, mapping.getSupportingAnnotationNames());
this.firePropertyChanged(SPECIFIED_MAPPING_PROPERTY, old, newMapping);
}
protected static final String[] EMPTY_STRING_ARRAY = new String[0];
@@ -478,9 +477,9 @@ public abstract class AbstractJavaPersistentAttribute
return mapping;
}
- protected Iterator<String> supportingAnnotationNames() {
+ protected Iterable<String> getSupportingAnnotationNames() {
JavaAttributeMapping mapping = this.getMapping();
- return (mapping != null) ? mapping.supportingAnnotationNames() : EmptyIterator.<String>instance();
+ return (mapping != null) ? mapping.getSupportingAnnotationNames() : EmptyIterable.<String>instance();
}
protected void updateSpecifiedMapping() {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentType.java
index 3b13e6599f..b9b7003fac 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentType.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentType.java
@@ -32,12 +32,10 @@ import org.eclipse.jpt.core.context.java.JavaStructureNodes;
import org.eclipse.jpt.core.context.java.JavaTypeMapping;
import org.eclipse.jpt.core.context.java.JavaTypeMappingDefinition;
import org.eclipse.jpt.core.internal.resource.java.source.SourceNode;
-import org.eclipse.jpt.core.jpa2.JpaProject2_0;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.ArrayTools;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.HashBag;
import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
@@ -51,80 +49,176 @@ import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledExcepti
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+/**
+ * Java persistent type:<ul>
+ * <li>name
+ * <li>access
+ * <li>mapping
+ * <li>attributes
+ * <li>super persistent type
+ * </ul>
+ */
public abstract class AbstractJavaPersistentType
extends AbstractJavaJpaContextNode
implements JavaPersistentType
{
protected JavaResourcePersistentType resourcePersistentType;
-
- protected PersistentType superPersistentType;
-
+
protected String name;
-
+
protected AccessType defaultAccess;
protected AccessType specifiedAccess;
-
+
protected JavaTypeMapping mapping;
-
- protected final Vector<JavaPersistentAttribute> attributes =
- new Vector<JavaPersistentAttribute>();
-
-
+
+ protected final Vector<JavaPersistentAttribute> attributes = new Vector<JavaPersistentAttribute>();
+
+ protected PersistentType superPersistentType;
+
+
protected AbstractJavaPersistentType(PersistentType.Owner parent, JavaResourcePersistentType jrpt) {
super(parent);
this.initialize(jrpt);
}
-
-
+
+ protected void initialize(JavaResourcePersistentType jrpt) {
+ this.resourcePersistentType = jrpt;
+ this.superPersistentType = this.buildSuperPersistentType();
+ this.name = this.buildName();
+ this.defaultAccess = buildDefaultAccess();
+ this.specifiedAccess = buildSpecifiedAccess();
+ this.mapping = buildMapping();
+ this.initializeAttributes();
+ }
+
+
+ // ********** update **********
+
+ public void update(JavaResourcePersistentType jrpt) {
+ this.resourcePersistentType = jrpt;
+ this.update();
+ }
+
+ public void update() {
+ JpaFile jpaFile = this.getJpaFile();
+ if (jpaFile != null) {
+ // the JPA file can be null if the resource type is "external"
+ jpaFile.addRootStructureNode(this.resourcePersistentType.getQualifiedName(), this);
+ }
+ this.setSuperPersistentType(this.buildSuperPersistentType());
+ this.setName(this.buildName());
+ this.updateAccess();
+ this.updateMapping();
+ this.updateAttributes();
+ }
+
+ @Override
+ public void postUpdate() {
+ super.postUpdate();
+ this.mapping.postUpdate();
+ for (PersistentAttribute attribute : this.getAttributes()) {
+ attribute.postUpdate();
+ }
+ }
+
+
+ // ********** AbstractJpaNode overrides **********
+
+ @Override
+ public PersistentType.Owner getParent() {
+ return (PersistentType.Owner) super.getParent();
+ }
+
@Override
public IResource getResource() {
return this.resourcePersistentType.getFile();
}
-
-
- //****************** JpaStructureNode implementation *******************
-
+
+
+ // ********** JpaStructureNode implementation **********
+
public String getId() {
return JavaStructureNodes.PERSISTENT_TYPE_ID;
}
-
-
- //****************** PersistentType implementation *******************
-
+
+ // it would be nice if the we passed in an astRoot here, but then we
+ // would need to pass it to the XML structure nodes too...
+ public JpaStructureNode getStructureNode(int offset) {
+ CompilationUnit astRoot = this.buildASTRoot();
+
+ if (this.contains(offset, astRoot)) {
+ for (JavaPersistentAttribute persistentAttribute : this.getAttributes()) {
+ if (persistentAttribute.contains(offset, astRoot)) {
+ return persistentAttribute;
+ }
+ }
+ return this;
+ }
+ return null;
+ }
+
+ protected boolean contains(int offset, CompilationUnit astRoot) {
+ TextRange fullTextRange = this.getFullTextRange(astRoot);
+ // 'fullTextRange' will be null if the type no longer exists in the java;
+ // the context model can be out of synch with the resource model
+ // when a selection event occurs before the context model has a
+ // chance to synch with the resource model via the update thread
+ return (fullTextRange == null) ? false : fullTextRange.includes(offset);
+ }
+
+ protected TextRange getFullTextRange(CompilationUnit astRoot) {
+ return this.resourcePersistentType.getTextRange(astRoot);
+ }
+
+ public TextRange getSelectionTextRange() {
+ return this.getSelectionTextRange(this.buildASTRoot());
+ }
+
+ protected TextRange getSelectionTextRange(CompilationUnit astRoot) {
+ return this.resourcePersistentType.getNameTextRange(astRoot);
+ }
+
+ public void dispose() {
+ JpaFile jpaFile = this.getJpaFile();
+ if (jpaFile != null) {
+ // the JPA file can be null if the .java file was deleted
+ // or the resource type is "external"
+ jpaFile.removeRootStructureNode(this.resourcePersistentType.getQualifiedName());
+ }
+ }
+
+
+ // ********** PersistentType implementation **********
+
public JavaResourcePersistentType getResourcePersistentType() {
return this.resourcePersistentType;
}
-
- @Override
- public PersistentType.Owner getParent() {
- return (PersistentType.Owner) super.getParent();
- }
-
-
- // **************** name **************************************************
-
+
+
+ // ********** name **********
+
public String getName() {
return this.name;
}
-
+
public String getShortName(){
- return getName().substring(getName().lastIndexOf('.') + 1);
+ return this.name.substring(this.name.lastIndexOf('.') + 1);
}
-
- protected void setName(String newName) {
- String oldName = this.name;
- this.name = newName;
- firePropertyChanged(NAME_PROPERTY, oldName, newName);
+
+ protected void setName(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(NAME_PROPERTY, old, name);
}
-
+
protected String buildName() {
return this.resourcePersistentType.getQualifiedName();
}
-
-
- // **************** access ************************************************
-
+
+
+ // ********** access **********
+
public AccessType getAccess() {
return (this.specifiedAccess != null) ? this.specifiedAccess : this.defaultAccess;
}
@@ -132,25 +226,29 @@ public abstract class AbstractJavaPersistentType
public AccessType getDefaultAccess() {
return this.defaultAccess;
}
-
- protected void setDefaultAccess(AccessType newDefaultAccess) {
- AccessType oldAccess = this.defaultAccess;
- this.defaultAccess = newDefaultAccess;
- firePropertyChanged(DEFAULT_ACCESS_PROPERTY, oldAccess, newDefaultAccess);
+
+ protected void setDefaultAccess(AccessType defaultAccess) {
+ AccessType old = this.defaultAccess;
+ this.defaultAccess = defaultAccess;
+ this.firePropertyChanged(DEFAULT_ACCESS_PROPERTY, old, defaultAccess);
}
-
+
public AccessType getSpecifiedAccess() {
return this.specifiedAccess;
}
-
+
/**
- * Check the access "specified" by the java resource model.
- * Check java annotations first.
- * If still null check xml mapping specified access
- * If still null then set to superPersistentType access.
- * If still null check entity-mappings specified access setting if this persistent-type is listed in an orm.xml file
- * If still null check the persistence-unit default Access
- * Default to FIELD if all else fails.
+ * Check the access "specified" by the Java resource model:<ul>
+ * <li>Check Java annotations first
+ * <li>If <code>null</code>, check XML mapping specified access
+ * <li>If still <code>null</code>, check {@link #superPersistentType} access
+ * <li>If still <code>null</code>, check <code>entity-mappings</code>
+ * specified access setting if the corresponding <code>persistent-type</code>
+ * is listed in a mapping (<code>orm.xml</code>) file
+ * <li>If still <code>null</code>, check the <code>persistence-unit</code>
+ * default Access
+ * <li>Default to <code>FIELD</code> if all else fails.
+ * </ul>
*/
protected AccessType buildDefaultAccess() {
AccessType accessType = AccessType.fromJavaResourceModel(this.resourcePersistentType.getAccess());
@@ -177,132 +275,109 @@ public abstract class AbstractJavaPersistentType
// last ditch attempt to allow the user to annotate *something*
return AccessType.FIELD;
}
-
+
+ protected void updateAccess() {
+ this.setDefaultAccess(this.buildDefaultAccess());
+ }
+
/**
* Build an access type based on annotations from the resource model.
- * (This is platform dependent)
+ * (This is JPA platform-dependent.)
*/
protected abstract AccessType buildSpecifiedAccess();
-
-
- // **************** mapping ***********************************************
-
+
+
+ // ********** mapping **********
+
public JavaTypeMapping getMapping() {
return this.mapping;
}
public String getMappingKey() {
- return getMapping().getKey();
+ return this.mapping.getKey();
}
-
+
public void setMappingKey(String key) {
- if (this.valuesAreEqual(key, this.getMapping().getKey())) {
+ if (this.valuesAreEqual(key, this.mapping.getKey())) {
return;
}
- JavaTypeMapping oldMapping = getMapping();
- JavaTypeMapping newMapping = buildMappingFromMappingKey(key);
-
+ JavaTypeMapping oldMapping = this.mapping;
+ JavaTypeMapping newMapping = this.buildMappingFromMappingKey(key);
+
this.mapping = newMapping;
- this.resourcePersistentType.setPrimaryAnnotation(
- newMapping.getAnnotationName(),
- ArrayTools.array(newMapping.supportingAnnotationNames(), new String[0]));
- firePropertyChanged(MAPPING_PROPERTY, oldMapping, newMapping);
+ this.resourcePersistentType.setPrimaryAnnotation(newMapping.getAnnotationName(), newMapping.getSupportingAnnotationNames());
+ this.firePropertyChanged(MAPPING_PROPERTY, oldMapping, newMapping);
}
-
- protected void setMapping(JavaTypeMapping newMapping) {
- JavaTypeMapping oldMapping = this.mapping;
- this.mapping = newMapping;
- firePropertyChanged(MAPPING_PROPERTY, oldMapping, newMapping);
+
+ protected void setMapping(JavaTypeMapping mapping) {
+ JavaTypeMapping old = this.mapping;
+ this.mapping = mapping;
+ this.firePropertyChanged(MAPPING_PROPERTY, old, mapping);
}
-
+
protected JavaTypeMapping buildMapping() {
- JavaTypeMappingDefinition mappingDefinition =
- getJpaPlatform().getJavaTypeMappingDefinition(this);
- return buildMapping(mappingDefinition);
+ JavaTypeMappingDefinition mappingDefinition = this.getJpaPlatform().getJavaTypeMappingDefinition(this);
+ return this.buildMapping(mappingDefinition);
}
-
+
protected JavaTypeMapping buildMapping(JavaTypeMappingDefinition mappingDefinition) {
- JavaTypeMapping jtMapping = mappingDefinition.buildMapping(this, getJpaFactory());
+ JavaTypeMapping jtMapping = mappingDefinition.buildMapping(this, this.getJpaFactory());
// mapping may be null
if (jtMapping != null) {
jtMapping.initialize(this.resourcePersistentType);
}
return jtMapping;
}
-
+
protected JavaTypeMapping buildMappingFromMappingKey(String key) {
- JavaTypeMappingDefinition mappingDefinition =
- getJpaPlatform().getJavaTypeMappingDefinition(key);
- JavaTypeMapping jtMapping = mappingDefinition.buildMapping(this, getJpaFactory());
+ JavaTypeMappingDefinition mappingDefinition = this.getJpaPlatform().getJavaTypeMappingDefinition(key);
+ JavaTypeMapping jtMapping = mappingDefinition.buildMapping(this, this.getJpaFactory());
//no mapping.initialize(JavaResourcePersistentType) call here
//we do not yet have a mapping annotation so we can't call initialize
return jtMapping;
}
-
-
- public boolean isMapped() {
- return getMapping().isMapped();
- }
-
- public AccessType getOwnerOverrideAccess() {
- return this.getParent().getOverridePersistentTypeAccess();
- }
- public AccessType getOwnerDefaultAccess() {
- return this.getParent().getDefaultPersistentTypeAccess();
+ protected void updateMapping() {
+ // There will always be a mapping definition, even if it is a "null" mapping definition ...
+ JavaTypeMappingDefinition mappingDefinition = this.getJpaPlatform().getJavaTypeMappingDefinition(this);
+ if ((this.mapping != null) && this.valuesAreEqual(this.mapping.getKey(), mappingDefinition.getKey())) {
+ this.mapping.update(this.resourcePersistentType);
+ } else {
+ this.setMapping(this.buildMapping(mappingDefinition));
+ }
}
- protected Iterator<JavaPersistentAttribute> attributesNamed(final String attributeName) {
- return new FilteringIterator<JavaPersistentAttribute, JavaPersistentAttribute>(attributes()) {
- @Override
- protected boolean accept(JavaPersistentAttribute o) {
- return attributeName.equals(o.getName());
- }
- };
- }
- public JavaPersistentAttribute getAttributeNamed(String attributeName) {
- Iterator<JavaPersistentAttribute> stream = attributesNamed(attributeName);
- return stream.hasNext() ? stream.next() : null;
- }
+ // ********** attributes **********
- public PersistentAttribute resolveAttribute(String attributeName) {
- Iterator<JavaPersistentAttribute> stream = attributesNamed(attributeName);
- if (stream.hasNext()) {
- JavaPersistentAttribute attribute = stream.next();
- return stream.hasNext() ? null /*more than one*/: attribute;
- }
- return (this.superPersistentType == null) ? null : this.superPersistentType.resolveAttribute(attributeName);
- }
-
public ListIterator<JavaPersistentAttribute> attributes() {
return new CloneListIterator<JavaPersistentAttribute>(this.attributes);
}
-
+
protected Iterable<JavaPersistentAttribute> getAttributes() {
return new LiveCloneIterable<JavaPersistentAttribute>(this.attributes);
}
-
+
public int attributesSize() {
return this.attributes.size();
}
-
+
private void addAttribute(int index, JavaPersistentAttribute attribute) {
- addItemToList(index, attribute, this.attributes, ATTRIBUTES_LIST);
+ this.addItemToList(index, attribute, this.attributes, ATTRIBUTES_LIST);
}
private void removeAttribute(JavaPersistentAttribute attribute) {
- removeItemFromList(attribute, this.attributes, ATTRIBUTES_LIST);
+ this.removeItemFromList(attribute, this.attributes, ATTRIBUTES_LIST);
}
-
+
private void moveAttribute(int index, JavaPersistentAttribute attribute) {
- moveItemInList(index, this.attributes.indexOf(attribute), this.attributes, ATTRIBUTES_LIST);
+ this.moveItemInList(index, this.attributes.indexOf(attribute), this.attributes, ATTRIBUTES_LIST);
}
-
+
public Iterator<String> attributeNames() {
return this.attributeNames(this.attributes());
}
-
+
protected Iterator<String> attributeNames(Iterator<? extends PersistentAttribute> attrs) {
return new TransformationIterator<PersistentAttribute, String>(attrs) {
@Override
@@ -311,136 +386,45 @@ public abstract class AbstractJavaPersistentType
}
};
}
-
- public Iterator<PersistentAttribute> allAttributes() {
- return new CompositeIterator<PersistentAttribute>(new TransformationIterator<PersistentType, Iterator<PersistentAttribute>>(this.inheritanceHierarchy()) {
- @Override
- protected Iterator<PersistentAttribute> transform(PersistentType pt) {
- return pt.attributes();
- }
- });
- }
-
- public Iterator<String> allAttributeNames() {
- return this.attributeNames(this.allAttributes());
- }
-
- @Override
- public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- Iterator<String> values = this.mapping.javaCompletionProposals(pos, filter, astRoot);
- if (values != null) {
- return values;
- }
- for (JavaPersistentAttribute attribute : this.getAttributes()) {
- values = attribute.javaCompletionProposals(pos, filter, astRoot);
- if (values != null) {
- return values;
- }
- }
- return EmptyIterator.instance();
- }
-
- // it would be nice if the we passed in an astRoot here, but then we
- // would need to pass it to the XML structure nodes too...
- public JpaStructureNode getStructureNode(int offset) {
- CompilationUnit astRoot = this.buildASTRoot();
-
- if (this.contains(offset, astRoot)) {
- for (JavaPersistentAttribute persistentAttribute : this.getAttributes()) {
- if (persistentAttribute.contains(offset, astRoot)) {
- return persistentAttribute;
- }
- }
- return this;
- }
- return null;
- }
-
- protected CompilationUnit buildASTRoot() {
- return this.resourcePersistentType.getJavaResourceCompilationUnit().buildASTRoot();
- }
-
- public boolean contains(int offset, CompilationUnit astRoot) {
- TextRange fullTextRange = this.getFullTextRange(astRoot);
- // 'fullTextRange' will be null if the type no longer exists in the java;
- // the context model can be out of synch with the resource model
- // when a selection event occurs before the context model has a
- // chance to synch with the resource model via the update thread
- return (fullTextRange == null) ? false : fullTextRange.includes(offset);
- }
-
-
- protected TextRange getFullTextRange(CompilationUnit astRoot) {
- return this.resourcePersistentType.getTextRange(astRoot);
- }
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getSelectionTextRange(astRoot);
- }
-
- public TextRange getSelectionTextRange(CompilationUnit astRoot) {
- return this.resourcePersistentType.getNameTextRange(astRoot);
- }
-
- public TextRange getSelectionTextRange() {
- return this.getSelectionTextRange(this.buildASTRoot());
- }
-
-
- public Iterator<PersistentType> inheritanceHierarchy() {
- return this.inheritanceHierarchyOf(this);
+ public JavaPersistentAttribute getAttributeNamed(String attributeName) {
+ Iterator<JavaPersistentAttribute> stream = this.attributesNamed(attributeName);
+ return stream.hasNext() ? stream.next() : null;
}
- public Iterator<PersistentType> ancestors() {
- return this.inheritanceHierarchyOf(this.superPersistentType);
+ public PersistentAttribute resolveAttribute(String attributeName) {
+ Iterator<JavaPersistentAttribute> stream = this.attributesNamed(attributeName);
+ if (stream.hasNext()) {
+ JavaPersistentAttribute attribute = stream.next();
+ return stream.hasNext() ? null /*more than one*/: attribute;
+ }
+ return (this.superPersistentType == null) ? null : this.superPersistentType.resolveAttribute(attributeName);
}
- protected Iterator<PersistentType> inheritanceHierarchyOf(PersistentType start) {
- // using a chain iterator to traverse up the inheritance tree
- return new ChainIterator<PersistentType>(start) {
+ protected Iterator<JavaPersistentAttribute> attributesNamed(final String attributeName) {
+ return new FilteringIterator<JavaPersistentAttribute, JavaPersistentAttribute>(this.attributes()) {
@Override
- protected PersistentType nextLink(PersistentType persistentType) {
- return persistentType.getSuperPersistentType();
+ protected boolean accept(JavaPersistentAttribute o) {
+ return attributeName.equals(o.getName());
}
};
}
- public PersistentType getSuperPersistentType() {
- return this.superPersistentType;
+ public Iterator<PersistentAttribute> allAttributes() {
+ return new CompositeIterator<PersistentAttribute>(
+ new TransformationIterator<PersistentType, Iterator<PersistentAttribute>>(this.inheritanceHierarchy()) {
+ @Override
+ protected Iterator<PersistentAttribute> transform(PersistentType pt) {
+ return pt.attributes();
+ }
+ }
+ );
}
- protected void setSuperPersistentType(PersistentType superPersistentType) {
- PersistentType old = this.superPersistentType;
- this.superPersistentType = superPersistentType;
- this.firePropertyChanged(SUPER_PERSISTENT_TYPE_PROPERTY, old, superPersistentType);
- }
-
- public boolean hasAnyAnnotatedAttributes() {
- return this.resourcePersistentType.hasAnyAnnotatedAttributes();
- }
-
- // **************** metamodel *****************************
-
- public void synchronizeMetamodel() {
- ((JpaProject2_0) this.getJpaProject()).synchronizeMetamodel(this);
- }
-
- // **************** initialization / updating *****************************
-
- protected void initialize(JavaResourcePersistentType jrpt) {
- this.resourcePersistentType = jrpt;
- this.superPersistentType = this.buildSuperPersistentType();
- this.name = this.buildName();
- this.defaultAccess = buildDefaultAccess();
- this.specifiedAccess = buildSpecifiedAccess();
- this.mapping = buildMapping();
- this.initializeAttributes();
+ public Iterator<String> allAttributeNames() {
+ return this.attributeNames(this.allAttributes());
}
-
+
protected void initializeAttributes() {
for (Iterator<JavaResourcePersistentAttribute> stream = this.resourceAttributes(); stream.hasNext(); ) {
this.attributes.add(this.createAttribute(stream.next()));
@@ -453,52 +437,11 @@ public abstract class AbstractJavaPersistentType
this.resourcePersistentType.persistableFields();
}
- public void update(JavaResourcePersistentType jrpt) {
- this.resourcePersistentType = jrpt;
- this.update();
- }
-
- public void update() {
- JpaFile jpaFile = this.getJpaFile();
- if (jpaFile != null) {
- // the JPA file can be null if the resource type is "external"
- jpaFile.addRootStructureNode(this.resourcePersistentType.getQualifiedName(), this);
- }
- this.setSuperPersistentType(this.buildSuperPersistentType());
- this.setName(this.buildName());
- this.updateAccess();
- this.updateMapping();
- this.updateAttributes();
- }
-
- protected JpaFile getJpaFile() {
- return this.getJpaFile(this.resourcePersistentType.getFile());
- }
-
- protected void updateAccess() {
- this.setDefaultAccess(this.buildDefaultAccess());
-
- }
-
- protected void updateMapping() {
- // There will always be a mapping definition, even if it is a "null" mapping definition ...
- JavaTypeMappingDefinition mappingDefinition =
- getJpaPlatform().getJavaTypeMappingDefinition(this);
- String mappingKey = mappingDefinition.getKey();
- if (this.mapping != null
- && valuesAreEqual(this.mapping.getKey(), mappingKey)) {
- this.mapping.update(this.resourcePersistentType);
- }
- else {
- setMapping(buildMapping(mappingDefinition));
- }
- }
-
protected void updateAttributes() {
HashBag<JavaPersistentAttribute> contextAttributesToRemove = CollectionTools.bag(this.attributes(), this.attributesSize());
ArrayList<JavaPersistentAttribute> contextAttributesToUpdate = new ArrayList<JavaPersistentAttribute>(this.attributesSize());
int resourceIndex = 0;
-
+
for (Iterator<JavaResourcePersistentAttribute> resourceAttributes = this.resourceAttributes(); resourceAttributes.hasNext(); ) {
JavaResourcePersistentAttribute resourceAttribute = resourceAttributes.next();
boolean match = false;
@@ -526,9 +469,26 @@ public abstract class AbstractJavaPersistentType
contextAttribute.update();
}
}
-
+
protected JavaPersistentAttribute createAttribute(JavaResourcePersistentAttribute jrpa) {
- return getJpaFactory().buildJavaPersistentAttribute(this, jrpa);
+ return this.getJpaFactory().buildJavaPersistentAttribute(this, jrpa);
+ }
+
+ public boolean hasAnyAnnotatedAttributes() {
+ return this.resourcePersistentType.hasAnyAnnotatedAttributes();
+ }
+
+
+ // ********** super persistent type **********
+
+ public PersistentType getSuperPersistentType() {
+ return this.superPersistentType;
+ }
+
+ protected void setSuperPersistentType(PersistentType superPersistentType) {
+ PersistentType old = this.superPersistentType;
+ this.superPersistentType = superPersistentType;
+ this.firePropertyChanged(SUPER_PERSISTENT_TYPE_PROPERTY, old, superPersistentType);
}
protected PersistentType buildSuperPersistentType() {
@@ -568,19 +528,54 @@ public abstract class AbstractJavaPersistentType
return (spt != null) ? spt : this.getSuperPersistentType(resourceType.getSuperclassQualifiedName(), visited); // recurse
}
- protected PersistentType getPersistentType(String fullyQualifiedTypeName) {
- return getPersistenceUnit().getPersistentType(fullyQualifiedTypeName);
+ protected PersistentType getPersistentType(String typeName) {
+ return this.getPersistenceUnit().getPersistentType(typeName);
}
+
+ // ********** inheritance **********
+
+ public Iterator<PersistentType> inheritanceHierarchy() {
+ return this.inheritanceHierarchyOf(this);
+ }
+
+ public Iterator<PersistentType> ancestors() {
+ return this.inheritanceHierarchyOf(this.superPersistentType);
+ }
+
+ protected Iterator<PersistentType> inheritanceHierarchyOf(PersistentType start) {
+ // using a chain iterator to traverse up the inheritance tree
+ return new ChainIterator<PersistentType>(start) {
+ @Override
+ protected PersistentType nextLink(PersistentType persistentType) {
+ return persistentType.getSuperPersistentType();
+ }
+ };
+ }
+
+
+ // ********** code completion **********
+
@Override
- public void postUpdate() {
- super.postUpdate();
- getMapping().postUpdate();
- for (PersistentAttribute attribute : CollectionTools.iterable(attributes())) {
- attribute.postUpdate();
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ Iterator<String> values = this.mapping.javaCompletionProposals(pos, filter, astRoot);
+ if (values != null) {
+ return values;
+ }
+ for (JavaPersistentAttribute attribute : this.getAttributes()) {
+ values = attribute.javaCompletionProposals(pos, filter, astRoot);
+ if (values != null) {
+ return values;
+ }
}
+ return EmptyIterator.instance();
}
-
+
+
// ********** validation **********
public void validate(List<IMessage> messages, IReporter reporter) {
@@ -600,14 +595,14 @@ public abstract class AbstractJavaPersistentType
this.validate(messages, reporter, this.buildASTRoot());
}
}
-
+
@Override
public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
super.validate(messages, reporter, astRoot);
this.validateMapping(messages, reporter, astRoot);
this.validateAttributes(messages, reporter, astRoot);
}
-
+
protected void validateMapping(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
try {
this.mapping.validate(messages, reporter, astRoot);
@@ -615,13 +610,13 @@ public abstract class AbstractJavaPersistentType
JptCorePlugin.log(t);
}
}
-
+
protected void validateAttributes(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
for (JavaPersistentAttribute attribute : this.getAttributes()) {
this.validateAttribute(attribute, reporter, messages, astRoot);
}
}
-
+
protected void validateAttribute(JavaPersistentAttribute attribute, IReporter reporter, List<IMessage> messages, CompilationUnit astRoot) {
try {
attribute.validate(messages, reporter, astRoot);
@@ -629,23 +624,38 @@ public abstract class AbstractJavaPersistentType
JptCorePlugin.log(t);
}
}
-
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.getSelectionTextRange(astRoot);
+ }
+
// ********** misc **********
+ public boolean isMapped() {
+ return this.mapping.isMapped();
+ }
+
+ public AccessType getOwnerOverrideAccess() {
+ return this.getParent().getOverridePersistentTypeAccess();
+ }
+
+ public AccessType getOwnerDefaultAccess() {
+ return this.getParent().getDefaultPersistentTypeAccess();
+ }
+
@Override
public void toString(StringBuilder sb) {
super.toString(sb);
sb.append(this.name);
}
- public void dispose() {
- JpaFile jpaFile = this.getJpaFile();
- if (jpaFile != null) {
- // the JPA file can be null if the .java file was deleted
- // or the resource type is "external"
- jpaFile.removeRootStructureNode(this.resourcePersistentType.getQualifiedName());
- }
+ protected CompilationUnit buildASTRoot() {
+ return this.resourcePersistentType.getJavaResourceCompilationUnit().buildASTRoot();
+ }
+
+ protected JpaFile getJpaFile() {
+ return this.getJpaFile(this.resourcePersistentType.getFile());
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java
index 09135771bc..c31c4a4ca6 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java
@@ -10,6 +10,8 @@
package org.eclipse.jpt.core.internal.context.java;
import java.util.List;
+import java.util.Vector;
+
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.context.FetchType;
@@ -23,7 +25,6 @@ import org.eclipse.jpt.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
import org.eclipse.jpt.core.resource.java.JPA;
import org.eclipse.jpt.core.resource.java.RelationshipMappingAnnotation;
-import org.eclipse.jpt.utility.internal.ArrayTools;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -64,21 +65,15 @@ public abstract class AbstractJavaSingleRelationshipMapping<T extends Relationsh
}
@Override
- protected String[] buildSupportingAnnotationNames() {
- String[] annotationNames = ArrayTools.addAll(
- super.buildSupportingAnnotationNames(),
- JPA.JOIN_COLUMN,
- JPA.JOIN_COLUMNS,
- JPA.JOIN_TABLE);
-
- if (getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
- annotationNames = ArrayTools.addAll(
- annotationNames,
- JPA.ID,
- JPA2_0.MAPS_ID);
+ protected void addSupportingAnnotationNamesTo(Vector<String> names) {
+ super.addSupportingAnnotationNamesTo(names);
+ names.add(JPA.JOIN_COLUMN);
+ names.add(JPA.JOIN_COLUMNS);
+ names.add(JPA.JOIN_TABLE);
+ if (this.getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
+ names.add(JPA.ID);
+ names.add(JPA2_0.MAPS_ID);
}
-
- return annotationNames;
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMapping.java
index 3a29a3dff0..fe52e1e5e7 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMapping.java
@@ -10,7 +10,7 @@
package org.eclipse.jpt.core.internal.context.java;
import java.util.Iterator;
-import java.util.ListIterator;
+
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.context.AttributeMapping;
import org.eclipse.jpt.core.context.Column;
@@ -30,14 +30,13 @@ import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationListIterator;
public abstract class AbstractJavaTypeMapping extends AbstractJavaJpaContextNode
implements JavaTypeMapping
{
protected JavaResourcePersistentType javaResourcePersistentType;
-
+
protected AbstractJavaTypeMapping(JavaPersistentType parent) {
super(parent);
@@ -103,8 +102,8 @@ public abstract class AbstractJavaTypeMapping extends AbstractJavaJpaContextNode
};
}
- public ListIterator<JavaAttributeMapping> attributeMappings() {
- return new TransformationListIterator<JavaPersistentAttribute, JavaAttributeMapping>(getPersistentType().attributes()) {
+ public Iterator<JavaAttributeMapping> attributeMappings() {
+ return new TransformationIterator<JavaPersistentAttribute, JavaAttributeMapping>(getPersistentType().attributes()) {
@Override
protected JavaAttributeMapping transform(JavaPersistentAttribute attribute) {
return attribute.getMapping();
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMapping.java
index 4eb847c3a5..9c6fba30fa 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMapping.java
@@ -11,6 +11,8 @@ package org.eclipse.jpt.core.internal.context.java;
import java.util.Iterator;
import java.util.List;
+import java.util.Vector;
+
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.Converter;
@@ -25,7 +27,6 @@ import org.eclipse.jpt.core.resource.java.JPA;
import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
import org.eclipse.jpt.core.resource.java.VersionAnnotation;
import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.ArrayTools;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -70,11 +71,10 @@ public abstract class AbstractJavaVersionMapping
@Override
- protected String[] buildSupportingAnnotationNames() {
- return ArrayTools.addAll(
- super.buildSupportingAnnotationNames(),
- JPA.COLUMN,
- JPA.TEMPORAL);
+ protected void addSupportingAnnotationNamesTo(Vector<String> names) {
+ super.addSupportingAnnotationNamesTo(names);
+ names.add(JPA.COLUMN);
+ names.add(JPA.TEMPORAL);
}
//************** NamedColumn.Owner implementation ***************
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullTypeMapping.java
index fefecbf43f..cbb5e22867 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullTypeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullTypeMapping.java
@@ -9,15 +9,15 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.context.java;
-import java.util.Iterator;
import java.util.List;
+
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.java.JavaPersistentType;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -40,8 +40,8 @@ public class JavaNullTypeMapping extends AbstractJavaTypeMapping
return false;
}
- public Iterator<String> supportingAnnotationNames() {
- return EmptyIterator.instance();
+ public Iterable<String> getSupportingAnnotationNames() {
+ return EmptyIterable.instance();
}
public boolean tableNameIsInvalid(String tableName) {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java
index 94eb087afd..1e4d6cb603 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java
@@ -1025,7 +1025,7 @@ public abstract class AbstractOrmEntity
* and has no descendants and no specified inheritance strategy has been defined.
*/
protected boolean isRootNoDescendantsNoStrategyDefined() {
- return isRoot() && !getPersistenceUnit().isRootWithSubEntities(this.getName()) && getSpecifiedInheritanceStrategy() == null;
+ return isRoot() && !getPersistenceUnit().entityIsRootWithSubEntities(this.getName()) && getSpecifiedInheritanceStrategy() == null;
}
/**
@@ -1409,7 +1409,7 @@ public abstract class AbstractOrmEntity
}
public void addSubEntity(Entity subEntity) {
- getPersistenceUnit().addRootWithSubEntities(getName());
+ getPersistenceUnit().addRootEntityWithSubEntities(getName());
}
protected void updateSpecifiedSecondaryTables() {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmPersistentAttribute.java
index 559a160528..a44bcc569d 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmPersistentAttribute.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmPersistentAttribute.java
@@ -137,14 +137,14 @@ public abstract class AbstractOrmPersistentAttribute
}
public boolean isVirtual() {
- return getPersistentType().containsVirtualPersistentAttribute(this);
+ return getPersistentType().containsVirtualAttribute(this);
}
public void makeVirtual() {
if (isVirtual()) {
throw new IllegalStateException("Attribute is already virtual"); //$NON-NLS-1$
}
- getPersistentType().makePersistentAttributeVirtual(this);
+ getPersistentType().makeAttributeVirtual(this);
}
public void makeSpecified() {
@@ -154,14 +154,14 @@ public abstract class AbstractOrmPersistentAttribute
if (getMappingKey() == MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY) {
throw new IllegalStateException("Use makeSpecified(String) instead and specify a mapping type"); //$NON-NLS-1$
}
- getPersistentType().makePersistentAttributeSpecified(this);
+ getPersistentType().makeAttributeSpecified(this);
}
public void makeSpecified(String mappingKey) {
if (!isVirtual()) {
throw new IllegalStateException("Attribute is already specified"); //$NON-NLS-1$
}
- getPersistentType().makePersistentAttributeSpecified(this, mappingKey);
+ getPersistentType().makeAttributeSpecified(this, mappingKey);
}
public String getPrimaryKeyColumnName() {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTypeMapping.java
index e19c5ff449..45ccf0df02 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTypeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTypeMapping.java
@@ -11,7 +11,7 @@ package org.eclipse.jpt.core.internal.context.orm;
import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
+
import org.eclipse.jpt.core.JpaStructureNode;
import org.eclipse.jpt.core.context.AttributeMapping;
import org.eclipse.jpt.core.context.Column;
@@ -33,7 +33,6 @@ import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.StringTools;
import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationListIterator;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -152,8 +151,8 @@ public abstract class AbstractOrmTypeMapping<T extends XmlTypeMapping>
return true;
}
- public ListIterator<OrmAttributeMapping> attributeMappings() {
- return new TransformationListIterator<OrmPersistentAttribute, OrmAttributeMapping>(getPersistentType().attributes()) {
+ public Iterator<OrmAttributeMapping> attributeMappings() {
+ return new TransformationIterator<OrmPersistentAttribute, OrmAttributeMapping>(getPersistentType().attributes()) {
@Override
protected OrmAttributeMapping transform(OrmPersistentAttribute attribute) {
return attribute.getMapping();
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNode.java
index c57fd8a5f5..cd85274c5d 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNode.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNode.java
@@ -11,7 +11,6 @@ package org.eclipse.jpt.core.internal.context.orm;
import org.eclipse.emf.ecore.EFactory;
import org.eclipse.jpt.core.context.JpaContextNode;
-import org.eclipse.jpt.core.context.XmlContextNode;
import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
import org.eclipse.jpt.core.context.orm.OrmXmlDefinition;
import org.eclipse.jpt.core.internal.context.AbstractXmlContextNode;
@@ -22,7 +21,6 @@ import org.eclipse.jpt.core.internal.context.AbstractXmlContextNode;
*/
public abstract class AbstractOrmXmlContextNode
extends AbstractXmlContextNode
- implements XmlContextNode
{
// ********** constructor **********
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java
index 8b07cdb747..2db8dd80d9 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.core.internal.context.persistence;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -18,6 +19,12 @@ import java.util.ListIterator;
import java.util.Set;
import java.util.Vector;
+import org.eclipse.jpt.core.context.persistence.PersistenceUnitProperties;
+import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceUnit2_0;
+import org.eclipse.jpt.core.jpa2.context.persistence.options.SharedCacheMode;
+import org.eclipse.jpt.core.jpa2.context.persistence.options.ValidationMode;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jpt.core.JpaStructureNode;
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.context.AccessType;
@@ -34,14 +41,14 @@ import org.eclipse.jpt.core.context.persistence.MappingFileRef;
import org.eclipse.jpt.core.context.persistence.Persistence;
import org.eclipse.jpt.core.context.persistence.PersistenceStructureNodes;
import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnitProperties;
import org.eclipse.jpt.core.context.persistence.PersistenceUnitTransactionType;
import org.eclipse.jpt.core.context.persistence.PersistentTypeContainer;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceUnit2_0;
-import org.eclipse.jpt.core.jpa2.context.persistence.options.SharedCacheMode;
-import org.eclipse.jpt.core.jpa2.context.persistence.options.ValidationMode;
+import org.eclipse.jpt.core.jpa2.JpaProject2_0;
+import org.eclipse.jpt.core.jpa2.context.PersistentType2_0;
+import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.core.resource.persistence.XmlJarFileRef;
import org.eclipse.jpt.core.resource.persistence.XmlJavaClassRef;
@@ -59,7 +66,6 @@ import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
import org.eclipse.jpt.utility.internal.iterators.CompositeListIterator;
import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
@@ -105,9 +111,9 @@ public abstract class AbstractPersistenceUnit
/* global query definitions, defined elsewhere in model */
protected final Vector<Query> queries = new Vector<Query>();
-
- protected final Set<String> rootEntities = new HashSet<String>();
-
+
+ protected final Set<String> rootEntityNames = Collections.synchronizedSet(new HashSet<String>());
+
protected AccessType defaultAccess;
protected String defaultCatalog;
protected String defaultSchema;
@@ -123,6 +129,9 @@ public abstract class AbstractPersistenceUnit
protected ValidationMode specifiedValidationMode;
protected ValidationMode defaultValidationMode;
+ protected final Set<IFile> metamodelFiles = Collections.synchronizedSet(new HashSet<IFile>());
+
+
// ********** construction/initialization **********
/**
@@ -163,6 +172,8 @@ public abstract class AbstractPersistenceUnit
this.specifiedValidationMode = this.buildSpecifiedValidationMode();
this.defaultValidationMode = this.buildDefaultValidationMode();
+
+ this.initializeMetamodelFiles();
}
/**
@@ -177,83 +188,73 @@ public abstract class AbstractPersistenceUnit
nonUpdateAspectNames.add(QUERIES_LIST);
}
- protected void initializeJarFileRefs() {
- for (XmlJarFileRef xmlJarFileRef : this.xmlPersistenceUnit.getJarFiles()) {
- this.jarFileRefs.add(this.buildJarFileRef(xmlJarFileRef));
- }
- }
-
- protected void initializeProperties() {
- this.connection = getContextNodeFactory().buildConnection(this);
- this.options = getContextNodeFactory().buildOptions(this);
-
- XmlProperties xmlProperties = this.xmlPersistenceUnit.getProperties();
- if (xmlProperties == null) {
- return;
- }
- for (XmlProperty xmlProperty : xmlProperties.getProperties()) {
- this.properties.add(this.buildProperty(xmlProperty));
- }
- }
+
+ // ********** updating **********
- protected void initializeSpecifiedClassRefs() {
- for (XmlJavaClassRef xmlJavaClassRef : this.xmlPersistenceUnit.getClasses()) {
- this.specifiedClassRefs.add(this.buildClassRef(xmlJavaClassRef));
- }
- }
+ public void update(XmlPersistenceUnit xpu) {
+ this.xmlPersistenceUnit = xpu;
- protected void initializeMappingFileRefs() {
- for (XmlMappingFileRef xmlMappingFileRef : this.xmlPersistenceUnit.getMappingFiles()) {
- this.specifiedMappingFileRefs.add(this.buildSpecifiedMappingFileRef(xmlMappingFileRef));
- }
- if ( ! this.impliedMappingFileIsSpecified() && this.impliedMappingFileExists()) {
- this.impliedMappingFileRef = this.buildImpliedMappingFileRef();
- }
- }
+ // the 'generators' and 'queries' lists are simply cleared out with each
+ // "update" and completely rebuilt as the "update" cascades through
+ // the persistence unit. When the persistence unit's "update" is
+ // complete, the lists have been populated and we fire the change event.
+ // @see #addGenerator(Generator) (and references)
+ // @see #addQuery(Query) (and references)
+ this.generators.clear();
+ this.queries.clear();
- protected void initializeImpliedClassRefs() {
- if ( ! this.excludesUnlistedClasses()) {
- this.initializeImpliedClassRefs_();
- }
- }
+ this.rootEntityNames.clear();
+
+ this.setName(xpu.getName());
+ this.setSpecifiedTransactionType(this.buildSpecifiedTransactionType());
+ this.setDefaultTransactionType(this.buildDefaultTransactionType());
+ this.setDescription(xpu.getDescription());
+ this.setProvider(xpu.getProvider());
+ this.setJtaDataSource(xpu.getJtaDataSource());
+ this.setNonJtaDataSource(xpu.getNonJtaDataSource());
+ this.updateJarFileRefs();
- protected void initializeImpliedClassRefs_() {
- for (Iterator<String> stream = this.getJpaProject().mappedJavaSourceClassNames(); stream.hasNext(); ) {
- String typeName = stream.next();
- if ( ! this.specifiesPersistentType(typeName)) {
- this.impliedClassRefs.add(this.buildClassRef(typeName));
- }
- }
- }
+ // update 'specifiedClassRefs' before 'mappingFileRefs' because of
+ // JpaFile rootStructureNode, we want the mapping file to "win",
+ // as it would in a JPA runtime implementation
+ this.updateSpecifiedClassRefs();
+ this.updateMappingFileRefs();
- protected void initializePersistenceUnitDefaults() {
- MappingFilePersistenceUnitDefaults defaults = this.getDefaults();
- this.defaultAccess = this.buildDefaultAccess(defaults);
- this.defaultCatalog = this.buildDefaultCatalog(defaults);
- this.defaultSchema = this.buildDefaultSchema(defaults);
- this.defaultCascadePersist = this.buildDefaultCascadePersist(defaults);
- }
+ // update 'impliedClassRefs' last since it depends on the contents of
+ // both 'specifiedClassRefs' and 'mappingFileRefs'
+ this.updateImpliedClassRefs();
- protected XmlPersistenceUnit getXmlPersistenceUnit() {
- return this.xmlPersistenceUnit;
- }
+ this.setSpecifiedExcludeUnlistedClasses(xpu.getExcludeUnlistedClasses());
+ this.updateProperties();
+ this.updatePersistenceUnitDefaults();
+
+ this.setSpecifiedSharedCacheMode(this.buildSpecifiedSharedCacheMode());
+ this.setDefaultSharedCacheMode(this.buildDefaultSharedCacheMode());
+ this.setSpecifiedValidationMode(this.buildSpecifiedValidationMode());
+ this.setDefaultValidationMode(this.buildDefaultValidationMode());
- protected SharedCacheMode buildSpecifiedSharedCacheMode() {
- return SharedCacheMode.fromXmlResourceModel(this.getXmlPersistenceUnit().getSharedCacheMode());
+ // see comment at top of method
+ this.fireListChanged(GENERATORS_LIST, this.generators);
+ this.fireListChanged(QUERIES_LIST, this.queries);
}
- protected SharedCacheMode buildDefaultSharedCacheMode() {
- return SharedCacheMode.UNSPECIFIED;
- }
-
- protected ValidationMode buildSpecifiedValidationMode() {
- return ValidationMode.fromXmlResourceModel(this.getXmlPersistenceUnit().getValidationMode());
+ @Override
+ public void postUpdate() {
+ super.postUpdate();
+ for (ClassRef classRef : this.getSpecifiedClassRefs()) {
+ classRef.postUpdate();
+ }
+ for (ClassRef classRef : this.getImpliedClassRefs()) {
+ classRef.postUpdate();
+ }
+ for (MappingFileRef mappingFileRef : CollectionTools.iterable(this.specifiedMappingFileRefs())) {
+ mappingFileRef.postUpdate();
+ }
+ if (this.impliedMappingFileRef != null) {
+ this.impliedMappingFileRef.postUpdate();
+ }
}
- protected ValidationMode buildDefaultValidationMode() {
- return DEFAULT_VALIDATION_MODE;
- }
-
// ********** JpaContextNode implementation **********
@@ -329,6 +330,20 @@ public abstract class AbstractPersistenceUnit
this.firePropertyChanged(DEFAULT_TRANSACTION_TYPE_PROPERTY, old, defaultTransactionType);
}
+ protected PersistenceUnitTransactionType buildSpecifiedTransactionType() {
+ return PersistenceUnitTransactionType.fromXmlResourceModel(this.xmlPersistenceUnit.getTransactionType());
+ }
+
+ /**
+ * TODO - calculate default
+ * From the JPA spec: "In a Java EE environment, if this element is not
+ * specified, the default is JTA. In a Java SE environment, if this element
+ * is not specified, a default of RESOURCE_LOCAL may be assumed."
+ */
+ protected PersistenceUnitTransactionType buildDefaultTransactionType() {
+ return PersistenceUnitTransactionType.JTA; //return JTA for now, fixing regression in bug 277524
+ }
+
// ********** description **********
@@ -418,6 +433,75 @@ public abstract class AbstractPersistenceUnit
};
}
+ protected void initializeMappingFileRefs() {
+ for (XmlMappingFileRef xmlMappingFileRef : this.xmlPersistenceUnit.getMappingFiles()) {
+ this.specifiedMappingFileRefs.add(this.buildSpecifiedMappingFileRef(xmlMappingFileRef));
+ }
+ if ( ! this.impliedMappingFileIsSpecified() && this.impliedMappingFileExists()) {
+ this.impliedMappingFileRef = this.buildImpliedMappingFileRef();
+ }
+ }
+
+ /**
+ * Since this is a *list*, we simply loop through the elements and match
+ * the context to the resource element by index, not by name like we do
+ * with 'impliedClassRefs'.
+ */
+ protected void updateMappingFileRefs() {
+ // first update the specified mapping file refs...
+ // make a copy of the XML file refs (to prevent ConcurrentModificationException)
+ Iterator<XmlMappingFileRef> xmlFileRefs = new CloneIterator<XmlMappingFileRef>(this.xmlPersistenceUnit.getMappingFiles());
+
+ for (Iterator<MappingFileRef> contextFileRefs = this.specifiedMappingFileRefs(); contextFileRefs.hasNext(); ) {
+ MappingFileRef contextFileRef = contextFileRefs.next();
+ if (xmlFileRefs.hasNext()) {
+ contextFileRef.update(xmlFileRefs.next());
+ } else {
+ this.removeSpecifiedMappingFileRef_(contextFileRef);
+ }
+ }
+
+ while (xmlFileRefs.hasNext()) {
+ this.addSpecifiedMappingFileRef_(this.buildSpecifiedMappingFileRef(xmlFileRefs.next()));
+ }
+
+ // ...then update the implied mapping file ref
+ if (this.impliedMappingFileIsSpecified()) {
+ if (this.impliedMappingFileRef != null) {
+ this.unsetImpliedMappingFileRef();
+ }
+ } else {
+ if (this.impliedMappingFileExists()) {
+ if (this.impliedMappingFileRef == null) {
+ this.setImpliedMappingFileRef();
+ }
+ this.impliedMappingFileRef.update(null);
+ } else {
+ if (this.impliedMappingFileRef != null) {
+ this.unsetImpliedMappingFileRef();
+ }
+ }
+ }
+ }
+
+ protected MappingFileRef buildSpecifiedMappingFileRef(XmlMappingFileRef xmlMappingFileRef) {
+ return this.getContextNodeFactory().buildMappingFileRef(this, xmlMappingFileRef);
+ }
+
+ protected boolean impliedMappingFileIsSpecified() {
+ String impliedMappingFileName = JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH;
+ for (Iterator<MappingFileRef> stream = this.specifiedMappingFileRefs(); stream.hasNext(); ) {
+ if (impliedMappingFileName.equals(stream.next().getFileName())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected boolean impliedMappingFileExists() {
+ return getJpaProject().getDefaultOrmXmlResource() != null;
+ }
+
// ********** specified mapping file refs **********
@@ -552,15 +636,44 @@ public abstract class AbstractPersistenceUnit
this.removeItemFromList(jarFileRef, this.jarFileRefs, JAR_FILE_REFS_LIST);
}
+ protected void initializeJarFileRefs() {
+ for (XmlJarFileRef xmlJarFileRef : this.xmlPersistenceUnit.getJarFiles()) {
+ this.jarFileRefs.add(this.buildJarFileRef(xmlJarFileRef));
+ }
+ }
+
+ /**
+ * Since this is a *list*, we simply loop through the elements and match
+ * the context to the resource element by index, not by name like we do
+ * with 'impliedClassRefs'.
+ */
+ protected void updateJarFileRefs() {
+ // make a copy of the XML file refs (to prevent ConcurrentModificationException)
+ Iterator<XmlJarFileRef> xmlFileRefs = new CloneIterator<XmlJarFileRef>(this.xmlPersistenceUnit.getJarFiles());
+
+ for (Iterator<JarFileRef> contextFileRefs = this.jarFileRefs(); contextFileRefs.hasNext(); ) {
+ JarFileRef contextFileRef = contextFileRefs.next();
+ if (xmlFileRefs.hasNext()) {
+ contextFileRef.update(xmlFileRefs.next());
+ } else {
+ this.removeJarFileRef_(contextFileRef);
+ }
+ }
+
+ while (xmlFileRefs.hasNext()) {
+ this.addJarFileRef_(this.buildJarFileRef(xmlFileRefs.next()));
+ }
+ }
+
+ protected JarFileRef buildJarFileRef(XmlJarFileRef xmlJarFileRef) {
+ return this.getContextNodeFactory().buildJarFileRef(this, xmlJarFileRef);
+ }
+
// ********** class refs **********
- @SuppressWarnings("unchecked")
public Iterator<ClassRef> classRefs() {
- return new CompositeIterator<ClassRef>(
- this.specifiedClassRefs(),
- this.impliedClassRefs()
- );
+ return this.getClassRefs().iterator();
}
@SuppressWarnings("unchecked")
@@ -640,6 +753,38 @@ public abstract class AbstractPersistenceUnit
this.removeItemFromList(classRef, this.specifiedClassRefs, SPECIFIED_CLASS_REFS_LIST);
}
+ protected void initializeSpecifiedClassRefs() {
+ for (XmlJavaClassRef xmlJavaClassRef : this.xmlPersistenceUnit.getClasses()) {
+ this.specifiedClassRefs.add(this.buildClassRef(xmlJavaClassRef));
+ }
+ }
+
+ /**
+ * Since this is a *list*, we simply loop through the elements and match
+ * the context to the resource element by index, not by name like we do
+ * with 'impliedClassRefs'.
+ */
+ protected void updateSpecifiedClassRefs() {
+ // make a copy of the XML class refs (to prevent ConcurrentModificationException)
+ Iterator<XmlJavaClassRef> xmlClassRefs = new CloneIterator<XmlJavaClassRef>(this.xmlPersistenceUnit.getClasses());
+
+ for (ClassRef contextClassRef : this.getSpecifiedClassRefs()) {
+ if (xmlClassRefs.hasNext()) {
+ contextClassRef.update(xmlClassRefs.next());
+ } else {
+ this.removeSpecifiedClassRef_(contextClassRef);
+ }
+ }
+
+ while (xmlClassRefs.hasNext()) {
+ this.addSpecifiedClassRef_(this.buildClassRef(xmlClassRefs.next()));
+ }
+ }
+
+ protected ClassRef buildClassRef(XmlJavaClassRef xmlClassRef) {
+ return this.getContextNodeFactory().buildClassRef(this, xmlClassRef);
+ }
+
// ********** implied class refs **********
@@ -670,6 +815,67 @@ public abstract class AbstractPersistenceUnit
this.removeItemFromCollection(classRef, this.impliedClassRefs, IMPLIED_CLASS_REFS_COLLECTION);
}
+ protected void initializeImpliedClassRefs() {
+ if ( ! this.excludesUnlistedClasses()) {
+ this.initializeImpliedClassRefs_();
+ }
+ }
+
+ protected void initializeImpliedClassRefs_() {
+ for (Iterator<String> stream = this.getJpaProject().mappedJavaSourceClassNames(); stream.hasNext(); ) {
+ String typeName = stream.next();
+ if ( ! this.specifiesPersistentType(typeName)) {
+ this.impliedClassRefs.add(this.buildClassRef(typeName));
+ }
+ }
+ }
+
+ protected void updateImpliedClassRefs() {
+ if (this.excludesUnlistedClasses()) {
+ this.clearImpliedClassRefs_();
+ } else {
+ this.updateImpliedClassRefs_();
+ }
+ }
+
+ protected void updateImpliedClassRefs_() {
+ HashBag<ClassRef> impliedRefsToRemove = CollectionTools.bag(this.impliedClassRefs(), this.impliedClassRefsSize());
+ ArrayList<ClassRef> impliedRefsToUpdate = new ArrayList<ClassRef>(this.impliedClassRefsSize());
+
+ for (Iterator<String> mappedClassNames = this.getJpaProject().mappedJavaSourceClassNames(); mappedClassNames.hasNext(); ) {
+ String mappedClassName = mappedClassNames.next();
+ if ( ! this.specifiesPersistentType(mappedClassName)) {
+ boolean match = false;
+ for (Iterator<ClassRef> classRefs = impliedRefsToRemove.iterator(); classRefs.hasNext(); ) {
+ ClassRef classRef = classRefs.next();
+ if (mappedClassName.equals(classRef.getClassName())) {
+ classRefs.remove();
+ impliedRefsToUpdate.add(classRef);
+ match = true;
+ break;
+ }
+ }
+ if ( ! match) {
+ this.addImpliedClassRef(mappedClassName);
+ }
+ }
+ }
+ for (ClassRef classRef : impliedRefsToRemove) {
+ this.removeImpliedClassRef(classRef);
+ }
+ // handle adding and removing implied class refs first, update the
+ // remaining implied class refs last; this reduces the churn during "update"
+ for (ClassRef classRef : impliedRefsToUpdate) {
+ classRef.update(classRef.getClassName());
+ }
+ }
+
+ protected void clearImpliedClassRefs_() {
+ for (ClassRef classRef : this.getImpliedClassRefs()) {
+ this.removeImpliedClassRef(classRef);
+ }
+ }
+
// ********** exclude unlisted classes **********
@@ -898,13 +1104,61 @@ public abstract class AbstractPersistenceUnit
this.options.propertyRemoved(propertyName);
}
- public PersistenceUnitProperties getConnection() {
- return this.connection;
+ protected void initializeProperties() {
+ this.connection = this.getContextNodeFactory().buildConnection(this);
+ this.options = this.getContextNodeFactory().buildOptions(this);
+
+ XmlProperties xmlProperties = this.xmlPersistenceUnit.getProperties();
+ if (xmlProperties == null) {
+ return;
+ }
+ for (XmlProperty xmlProperty : xmlProperties.getProperties()) {
+ this.properties.add(this.buildProperty(xmlProperty));
+ }
}
- public PersistenceUnitProperties getOptions() {
- return this.options;
+ /**
+ * Match the elements based on the XmlProperty resource object and also keep the order
+ * the same as the source.
+ */
+ protected void updateProperties() {
+ HashBag<Property> contextPropertiesToRemove = CollectionTools.bag(this.properties(), this.propertiesSize());
+ int resourceIndex = 0;
+
+ for (Iterator<XmlProperty> xmlProperties = this.xmlProperties(); xmlProperties.hasNext(); ) {
+ XmlProperty xmlProperty = xmlProperties.next();
+ boolean match = false;
+ for (Iterator<Property> contextProperties = contextPropertiesToRemove.iterator(); contextProperties.hasNext();) {
+ Property contextProperty = contextProperties.next();
+ if (contextProperty.getXmlProperty() == xmlProperty) {
+ contextProperties.remove();
+ this.moveProperty_(resourceIndex, contextProperty);
+ contextProperty.update();
+ match = true;
+ break;
+ }
+ }
+ if ( ! match) {
+ this.addProperty_(resourceIndex, this.buildProperty(xmlProperty));
+ }
+ resourceIndex++;
+ }
+ for (Property contextProperty : contextPropertiesToRemove) {
+ this.removeProperty_(contextProperty);
+ }
+ }
+
+ protected Iterator<XmlProperty> xmlProperties() {
+ XmlProperties xmlProperties = this.xmlPersistenceUnit.getProperties();
+ // make a copy of the XML properties (to prevent ConcurrentModificationException)
+ return (xmlProperties != null) ? new CloneIterator<XmlProperty>(xmlProperties.getProperties()) : EmptyIterator.<XmlProperty>instance();
}
+
+ protected int xmlPropertiesSize() {
+ XmlProperties xmlProperties = this.xmlPersistenceUnit.getProperties();
+ return xmlProperties == null ? 0 : xmlProperties.getProperties().size();
+ }
+
// ********** ORM persistence unit defaults **********
@@ -918,6 +1172,10 @@ public abstract class AbstractPersistenceUnit
this.firePropertyChanged(DEFAULT_ACCESS_PROPERTY, old, defaultAccess);
}
+ protected AccessType buildDefaultAccess(MappingFilePersistenceUnitDefaults defaults) {
+ return (defaults == null) ? null : defaults.getAccess();
+ }
+
public String getDefaultCatalog() {
return this.defaultCatalog;
}
@@ -928,6 +1186,11 @@ public abstract class AbstractPersistenceUnit
this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, defaultCatalog);
}
+ protected String buildDefaultCatalog(MappingFilePersistenceUnitDefaults defaults) {
+ String catalog = (defaults == null) ? null : defaults.getCatalog();
+ return (catalog != null) ? catalog : this.getJpaProject().getDefaultCatalog();
+ }
+
public String getDefaultSchema() {
return this.defaultSchema;
}
@@ -938,6 +1201,11 @@ public abstract class AbstractPersistenceUnit
this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, defaultSchema);
}
+ protected String buildDefaultSchema(MappingFilePersistenceUnitDefaults defaults) {
+ String schema = (defaults == null) ? null : defaults.getSchema();
+ return (schema != null) ? schema : this.getJpaProject().getDefaultSchema();
+ }
+
public boolean getDefaultCascadePersist() {
return this.defaultCascadePersist;
}
@@ -948,61 +1216,49 @@ public abstract class AbstractPersistenceUnit
this.firePropertyChanged(DEFAULT_CASCADE_PERSIST_PROPERTY, old, defaultCascadePersist);
}
-
- // ********** generators **********
-
- public ListIterator<Generator> generators() {
- return new CloneListIterator<Generator>(this.generators);
- }
-
- public int generatorsSize() {
- return this.generators.size();
+ protected boolean buildDefaultCascadePersist(MappingFilePersistenceUnitDefaults defaults) {
+ return (defaults == null) ? false : defaults.isCascadePersist();
}
- public void addGenerator(Generator generator) {
- this.generators.add(generator);
+ protected void initializePersistenceUnitDefaults() {
+ MappingFilePersistenceUnitDefaults defaults = this.getDefaults();
+ this.defaultAccess = this.buildDefaultAccess(defaults);
+ this.defaultCatalog = this.buildDefaultCatalog(defaults);
+ this.defaultSchema = this.buildDefaultSchema(defaults);
+ this.defaultCascadePersist = this.buildDefaultCascadePersist(defaults);
}
- public String[] uniqueGeneratorNames() {
- HashSet<String> names = new HashSet<String>(this.generators.size());
- this.addNonNullGeneratorNamesTo(names);
- return names.toArray(new String[names.size()]);
+ protected void updatePersistenceUnitDefaults() {
+ MappingFilePersistenceUnitDefaults defaults = this.getDefaults();
+ this.setDefaultAccess(this.buildDefaultAccess(defaults));
+ this.setDefaultCatalog(this.buildDefaultCatalog(defaults));
+ this.setDefaultSchema(this.buildDefaultSchema(defaults));
+ this.setDefaultCascadePersist(this.buildDefaultCascadePersist(defaults));
}
- protected void addNonNullGeneratorNamesTo(Set<String> names) {
- for (Iterator<Generator> stream = this.generators(); stream.hasNext(); ) {
- String generatorName = stream.next().getName();
- if (generatorName != null) {
- names.add(generatorName);
+ /**
+ * return the first persistence unit defaults we encounter in a mapping file
+ */
+ protected MappingFilePersistenceUnitDefaults getDefaults() {
+ for (Iterator<MappingFileRef> stream = this.mappingFileRefs(); stream.hasNext(); ) {
+ MappingFileRef mappingFileRef = stream.next();
+ if (mappingFileRef.persistenceUnitDefaultsExists()) {
+ return mappingFileRef.getPersistenceUnitDefaults();
}
}
+ return null;
}
+
+ //************** PersistenceUnit2_0 implementation ***********
- // ********** queries **********
-
- public ListIterator<Query> queries() {
- return new CloneListIterator<Query>(this.queries);
- }
-
- public int queriesSize() {
- return this.queries.size();
- }
-
- public void addQuery(Query query) {
- this.queries.add(query);
+ public PersistenceUnitProperties getConnection() {
+ return this.connection;
}
- public void addRootWithSubEntities(String entityName) {
- this.rootEntities.add(entityName);
- }
-
- public boolean isRootWithSubEntities(String entityName) {
- return this.rootEntities.contains(entityName);
+ public PersistenceUnitProperties getOptions() {
+ return this.options;
}
-
-
- //************** PersistenceUnit2_0 implementation ***********
// ********** shared cache mode **********
@@ -1017,7 +1273,7 @@ public abstract class AbstractPersistenceUnit
public void setSpecifiedSharedCacheMode(SharedCacheMode specifiedSharedCacheMode) {
SharedCacheMode old = this.specifiedSharedCacheMode;
this.specifiedSharedCacheMode = specifiedSharedCacheMode;
- this.getXmlPersistenceUnit().setSharedCacheMode(SharedCacheMode.toXmlResourceModel(specifiedSharedCacheMode));
+ this.xmlPersistenceUnit.setSharedCacheMode(SharedCacheMode.toXmlResourceModel(specifiedSharedCacheMode));
this.firePropertyChanged(SPECIFIED_SHARED_CACHE_MODE_PROPERTY, old, specifiedSharedCacheMode);
}
@@ -1044,6 +1300,14 @@ public abstract class AbstractPersistenceUnit
return false;//null
}
+ protected SharedCacheMode buildSpecifiedSharedCacheMode() {
+ return SharedCacheMode.fromXmlResourceModel(this.xmlPersistenceUnit.getSharedCacheMode());
+ }
+
+ protected SharedCacheMode buildDefaultSharedCacheMode() {
+ return SharedCacheMode.UNSPECIFIED;
+ }
+
// ********** validation mode **********
public ValidationMode getValidationMode() {
@@ -1057,7 +1321,7 @@ public abstract class AbstractPersistenceUnit
public void setSpecifiedValidationMode(ValidationMode specifiedValidationMode) {
ValidationMode old = this.specifiedValidationMode;
this.specifiedValidationMode = specifiedValidationMode;
- this.getXmlPersistenceUnit().setValidationMode(ValidationMode.toXmlResourceModel(specifiedValidationMode));
+ this.xmlPersistenceUnit.setValidationMode(ValidationMode.toXmlResourceModel(specifiedValidationMode));
this.firePropertyChanged(SPECIFIED_VALIDATION_MODE_PROPERTY, old, specifiedValidationMode);
}
@@ -1070,325 +1334,69 @@ public abstract class AbstractPersistenceUnit
this.defaultValidationMode = defaultValidationMode;
this.firePropertyChanged(DEFAULT_VALIDATION_MODE_PROPERTY, old, defaultValidationMode);
}
- // ********** updating **********
-
- public void update(XmlPersistenceUnit xpu) {
- this.xmlPersistenceUnit = xpu;
- // the 'generators' and 'queries' lists are simply cleared out with each
- // "update" and completely rebuilt as the "update" cascades through
- // the persistence unit. When the persistence unit's "update" is
- // complete, the lists have been populated and we fire the change event.
- // @see #addGenerator(Generator) (and references)
- // @see #addQuery(Query) (and references)
- this.generators.clear();
- this.queries.clear();
-
- this.rootEntities.clear();
-
- this.setName(xpu.getName());
- this.setSpecifiedTransactionType(this.buildSpecifiedTransactionType());
- this.setDefaultTransactionType(this.buildDefaultTransactionType());
- this.setDescription(xpu.getDescription());
- this.setProvider(xpu.getProvider());
- this.setJtaDataSource(xpu.getJtaDataSource());
- this.setNonJtaDataSource(xpu.getNonJtaDataSource());
- this.updateJarFileRefs();
-
- // update 'specifiedClassRefs' before 'mappingFileRefs' because of
- // JpaFile rootStructureNode, we want the mapping file to "win",
- // as it would in a JPA runtime implementation
- this.updateSpecifiedClassRefs();
- this.updateMappingFileRefs();
-
- // update 'impliedClassRefs' last since it depends on the contents of
- // both 'specifiedClassRefs' and 'mappingFileRefs'
- this.updateImpliedClassRefs();
-
- this.setSpecifiedExcludeUnlistedClasses(xpu.getExcludeUnlistedClasses());
- this.updateProperties();
- this.updatePersistenceUnitDefaults();
-
- this.setSpecifiedSharedCacheMode(this.buildSpecifiedSharedCacheMode());
- this.setDefaultSharedCacheMode(this.buildDefaultSharedCacheMode());
- this.setSpecifiedValidationMode(this.buildSpecifiedValidationMode());
- this.setDefaultValidationMode(this.buildDefaultValidationMode());
-
- // see comment at top of method
- this.fireListChanged(GENERATORS_LIST, this.generators);
- this.fireListChanged(QUERIES_LIST, this.queries);
- }
-
- @Override
- public void postUpdate() {
- super.postUpdate();
- for (ClassRef classRef : CollectionTools.iterable(this.specifiedClassRefs())) {
- classRef.postUpdate();
- }
- for (ClassRef classRef : CollectionTools.iterable(this.impliedClassRefs())) {
- classRef.postUpdate();
- }
- for (MappingFileRef mappingFileRef : CollectionTools.iterable(this.specifiedMappingFileRefs())) {
- mappingFileRef.postUpdate();
- }
- if (this.impliedMappingFileRef != null) {
- this.impliedMappingFileRef.postUpdate();
- }
+ protected ValidationMode buildSpecifiedValidationMode() {
+ return ValidationMode.fromXmlResourceModel(this.xmlPersistenceUnit.getValidationMode());
}
- protected PersistenceUnitTransactionType buildSpecifiedTransactionType() {
- return PersistenceUnitTransactionType.fromXmlResourceModel(this.xmlPersistenceUnit.getTransactionType());
+ protected ValidationMode buildDefaultValidationMode() {
+ return DEFAULT_VALIDATION_MODE;
}
- /**
- * TODO - calculate default
- * From the JPA spec: "In a Java EE environment, if this element is not
- * specified, the default is JTA. In a Java SE environment, if this element
- * is not specified, a default of RESOURCE_LOCAL may be assumed."
- */
- protected PersistenceUnitTransactionType buildDefaultTransactionType() {
- return PersistenceUnitTransactionType.JTA; //return JTA for now, fixing regression in bug 277524
- }
- /**
- * Since this is a *list*, we simply loop through the elements and match
- * the context to the resource element by index, not by name like we do
- * with 'impliedClassRefs'.
- */
- protected void updateJarFileRefs() {
- // make a copy of the XML file refs (to prevent ConcurrentModificationException)
- Iterator<XmlJarFileRef> xmlFileRefs = new CloneIterator<XmlJarFileRef>(this.xmlPersistenceUnit.getJarFiles());
-
- for (Iterator<JarFileRef> contextFileRefs = this.jarFileRefs(); contextFileRefs.hasNext(); ) {
- JarFileRef contextFileRef = contextFileRefs.next();
- if (xmlFileRefs.hasNext()) {
- contextFileRef.update(xmlFileRefs.next());
- } else {
- this.removeJarFileRef_(contextFileRef);
- }
- }
+ // ********** generators **********
- while (xmlFileRefs.hasNext()) {
- this.addJarFileRef_(this.buildJarFileRef(xmlFileRefs.next()));
- }
+ public ListIterator<Generator> generators() {
+ return new CloneListIterator<Generator>(this.generators);
}
- protected JarFileRef buildJarFileRef(XmlJarFileRef xmlJarFileRef) {
- return this.getContextNodeFactory().buildJarFileRef(this, xmlJarFileRef);
+ public int generatorsSize() {
+ return this.generators.size();
}
- /**
- * Since this is a *list*, we simply loop through the elements and match
- * the context to the resource element by index, not by name like we do
- * with 'impliedClassRefs'.
- */
- protected void updateSpecifiedClassRefs() {
- // make a copy of the XML class refs (to prevent ConcurrentModificationException)
- Iterator<XmlJavaClassRef> xmlClassRefs = new CloneIterator<XmlJavaClassRef>(this.xmlPersistenceUnit.getClasses());
-
- for (Iterator<ClassRef> contextClassRefs = this.specifiedClassRefs(); contextClassRefs.hasNext(); ) {
- ClassRef contextClassRef = contextClassRefs.next();
- if (xmlClassRefs.hasNext()) {
- contextClassRef.update(xmlClassRefs.next());
- } else {
- this.removeSpecifiedClassRef_(contextClassRef);
- }
- }
-
- while (xmlClassRefs.hasNext()) {
- this.addSpecifiedClassRef_(this.buildClassRef(xmlClassRefs.next()));
- }
+ public void addGenerator(Generator generator) {
+ this.generators.add(generator);
}
- protected ClassRef buildClassRef(XmlJavaClassRef xmlClassRef) {
- return this.getContextNodeFactory().buildClassRef(this, xmlClassRef);
+ public String[] uniqueGeneratorNames() {
+ HashSet<String> names = new HashSet<String>(this.generators.size());
+ this.addNonNullGeneratorNamesTo(names);
+ return names.toArray(new String[names.size()]);
}
- /**
- * Since this is a *list*, we simply loop through the elements and match
- * the context to the resource element by index, not by name like we do
- * with 'impliedClassRefs'.
- */
- protected void updateMappingFileRefs() {
- // first update the specified mapping file refs...
- // make a copy of the XML file refs (to prevent ConcurrentModificationException)
- Iterator<XmlMappingFileRef> xmlFileRefs = new CloneIterator<XmlMappingFileRef>(this.xmlPersistenceUnit.getMappingFiles());
-
- for (Iterator<MappingFileRef> contextFileRefs = this.specifiedMappingFileRefs(); contextFileRefs.hasNext(); ) {
- MappingFileRef contextFileRef = contextFileRefs.next();
- if (xmlFileRefs.hasNext()) {
- contextFileRef.update(xmlFileRefs.next());
- } else {
- this.removeSpecifiedMappingFileRef_(contextFileRef);
- }
- }
-
- while (xmlFileRefs.hasNext()) {
- this.addSpecifiedMappingFileRef_(this.buildSpecifiedMappingFileRef(xmlFileRefs.next()));
- }
-
- // ...then update the implied mapping file ref
- if (this.impliedMappingFileIsSpecified()) {
- if (this.impliedMappingFileRef != null) {
- this.unsetImpliedMappingFileRef();
- }
- } else {
- if (this.impliedMappingFileExists()) {
- if (this.impliedMappingFileRef == null) {
- this.setImpliedMappingFileRef();
- }
- this.impliedMappingFileRef.update(null);
- } else {
- if (this.impliedMappingFileRef != null) {
- this.unsetImpliedMappingFileRef();
- }
+ protected void addNonNullGeneratorNamesTo(Set<String> names) {
+ for (Iterator<Generator> stream = this.generators(); stream.hasNext(); ) {
+ String generatorName = stream.next().getName();
+ if (generatorName != null) {
+ names.add(generatorName);
}
}
}
- protected MappingFileRef buildSpecifiedMappingFileRef(XmlMappingFileRef xmlMappingFileRef) {
- return this.getContextNodeFactory().buildMappingFileRef(this, xmlMappingFileRef);
- }
- protected boolean impliedMappingFileIsSpecified() {
- String impliedMappingFileName = JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH;
- for (Iterator<MappingFileRef> stream = this.specifiedMappingFileRefs(); stream.hasNext(); ) {
- if (impliedMappingFileName.equals(stream.next().getFileName())) {
- return true;
- }
- }
- return false;
- }
+ // ********** queries **********
- protected boolean impliedMappingFileExists() {
- return getJpaProject().getDefaultOrmXmlResource() != null;
+ public ListIterator<Query> queries() {
+ return new CloneListIterator<Query>(this.queries);
}
- protected void updateImpliedClassRefs() {
- if (this.excludesUnlistedClasses()) {
- this.clearImpliedClassRefs_();
- } else {
- this.updateImpliedClassRefs_();
- }
+ public int queriesSize() {
+ return this.queries.size();
}
- protected void updateImpliedClassRefs_() {
- HashBag<ClassRef> impliedRefsToRemove = CollectionTools.bag(this.impliedClassRefs(), this.impliedClassRefsSize());
- ArrayList<ClassRef> impliedRefsToUpdate = new ArrayList<ClassRef>(this.impliedClassRefsSize());
-
- for (Iterator<String> mappedClassNames = this.getJpaProject().mappedJavaSourceClassNames(); mappedClassNames.hasNext(); ) {
- String mappedClassName = mappedClassNames.next();
- if ( ! this.specifiesPersistentType(mappedClassName)) {
- boolean match = false;
- for (Iterator<ClassRef> classRefs = impliedRefsToRemove.iterator(); classRefs.hasNext(); ) {
- ClassRef classRef = classRefs.next();
- if (mappedClassName.equals(classRef.getClassName())) {
- classRefs.remove();
- impliedRefsToUpdate.add(classRef);
- match = true;
- break;
- }
- }
- if ( ! match) {
- this.addImpliedClassRef(mappedClassName);
- }
- }
- }
- for (ClassRef classRef : impliedRefsToRemove) {
- this.removeImpliedClassRef(classRef);
- }
- // handle adding and removing implied class refs first, update the
- // remaining implied class refs last; this reduces the churn during "update"
- for (ClassRef classRef : impliedRefsToUpdate) {
- classRef.update(classRef.getClassName());
- }
+ public void addQuery(Query query) {
+ this.queries.add(query);
}
- protected void clearImpliedClassRefs_() {
- for (Iterator<ClassRef> stream = this.impliedClassRefs(); stream.hasNext(); ) {
- this.removeImpliedClassRef(stream.next());
- }
- }
- /**
- * Match the elements based on the XmlProperty resource object and also keep the order
- * the same as the source.
- */
- protected void updateProperties() {
- HashBag<Property> contextPropertiesToRemove = CollectionTools.bag(this.properties(), this.propertiesSize());
- int resourceIndex = 0;
-
- for (Iterator<XmlProperty> xmlProperties = this.xmlProperties(); xmlProperties.hasNext(); ) {
- XmlProperty xmlProperty = xmlProperties.next();
- boolean match = false;
- for (Iterator<Property> contextProperties = contextPropertiesToRemove.iterator(); contextProperties.hasNext();) {
- Property contextProperty = contextProperties.next();
- if (contextProperty.getXmlProperty() == xmlProperty) {
- contextProperties.remove();
- this.moveProperty_(resourceIndex, contextProperty);
- contextProperty.update();
- match = true;
- break;
- }
- }
- if ( ! match) {
- this.addProperty_(resourceIndex, this.buildProperty(xmlProperty));
- }
- resourceIndex++;
- }
- for (Property contextProperty : contextPropertiesToRemove) {
- this.removeProperty_(contextProperty);
- }
- }
+ // ********** root entities **********
- protected Iterator<XmlProperty> xmlProperties() {
- XmlProperties xmlProperties = this.xmlPersistenceUnit.getProperties();
- // make a copy of the XML properties (to prevent ConcurrentModificationException)
- return (xmlProperties != null) ? new CloneIterator<XmlProperty>(xmlProperties.getProperties()) : EmptyIterator.<XmlProperty>instance();
+ public void addRootEntityWithSubEntities(String entityName) {
+ this.rootEntityNames.add(entityName);
}
- protected int xmlPropertiesSize() {
- XmlProperties xmlProperties = this.xmlPersistenceUnit.getProperties();
- return xmlProperties == null ? 0 : xmlProperties.getProperties().size();
- }
-
- protected void updatePersistenceUnitDefaults() {
- MappingFilePersistenceUnitDefaults defaults = this.getDefaults();
- this.setDefaultAccess(this.buildDefaultAccess(defaults));
- this.setDefaultCatalog(this.buildDefaultCatalog(defaults));
- this.setDefaultSchema(this.buildDefaultSchema(defaults));
- this.setDefaultCascadePersist(this.buildDefaultCascadePersist(defaults));
- }
-
- /**
- * return the first persistence unit defaults we encounter in a mapping file
- */
- protected MappingFilePersistenceUnitDefaults getDefaults() {
- for (Iterator<MappingFileRef> stream = this.mappingFileRefs(); stream.hasNext(); ) {
- MappingFileRef mappingFileRef = stream.next();
- if (mappingFileRef.persistenceUnitDefaultsExists()) {
- return mappingFileRef.getPersistenceUnitDefaults();
- }
- }
- return null;
- }
-
- protected AccessType buildDefaultAccess(MappingFilePersistenceUnitDefaults defaults) {
- return (defaults == null) ? null : defaults.getAccess();
- }
-
- protected String buildDefaultCatalog(MappingFilePersistenceUnitDefaults defaults) {
- String catalog = (defaults == null) ? null : defaults.getCatalog();
- return (catalog != null) ? catalog : this.getJpaProject().getDefaultCatalog();
- }
-
- protected String buildDefaultSchema(MappingFilePersistenceUnitDefaults defaults) {
- String schema = (defaults == null) ? null : defaults.getSchema();
- return (schema != null) ? schema : this.getJpaProject().getDefaultSchema();
- }
-
- protected boolean buildDefaultCascadePersist(MappingFilePersistenceUnitDefaults defaults) {
- return (defaults == null) ? false : defaults.isCascadePersist();
+ public boolean entityIsRootWithSubEntities(String entityName) {
+ return this.rootEntityNames.contains(entityName);
}
@@ -1588,8 +1596,8 @@ public abstract class AbstractPersistenceUnit
}
public boolean specifiesPersistentType(String className) {
- for (Iterator<ClassRef> stream = this.specifiedClassRefs(); stream.hasNext(); ) {
- if (className.equals(stream.next().getClassName())) {
+ for (ClassRef classRef : this.getSpecifiedClassRefs()) {
+ if (className.equals(classRef.getClassName())) {
return true;
}
}
@@ -1631,31 +1639,110 @@ public abstract class AbstractPersistenceUnit
// ********** metamodel **********
+ // put metamodel stuff here so it can be shared by Generic and EclipseLink implementations
+
+ public void initializeMetamodel() {
+ this.initializeMetamodelFiles();
+ }
+
+ protected void initializeMetamodelFiles() {
+ CollectionTools.addAll(this.metamodelFiles, this.getGeneratedMetamodelFiles());
+ }
+
+ protected Iterable<IFile> getGeneratedMetamodelFiles() {
+ return new TransformationIterable<JavaResourcePersistentType, IFile>(this.getGeneratedMetamodelTypes()) {
+ @Override
+ protected IFile transform(JavaResourcePersistentType jrpt) {
+ return jrpt.getFile();
+ }
+ };
+ }
+
+ protected Iterable<JavaResourcePersistentType> getGeneratedMetamodelTypes() {
+ return ((JpaProject2_0) this.getJpaProject()).getGeneratedMetamodelTypes();
+ }
/**
* If we have the same persistent type in multiple locations, the last one
* we encounter wins (i.e. the classes in the orm.xml take precedence).
*/
public void synchronizeMetamodel() {
- HashMap<String, PersistentType> persistentTypes = new HashMap<String, PersistentType>();
+ // gather the persistent unit's types (eliminating duplicates, ignoring case)
+ HashMap<String, PersistentType2_0> persistentTypes = new HashMap<String, PersistentType2_0>();
this.addContainerPersistentTypesTo(this.getJarFileRefs(), persistentTypes);
this.addPersistentTypesTo(this.getNonNullClassRefPersistentTypes(), persistentTypes);
this.addContainerPersistentTypesTo(this.getMappingFileRefs(), persistentTypes);
- for (PersistentType persistentType : persistentTypes.values()) {
+
+ // copy the list of metamodel files...
+ HashSet<IFile> deadMetamodelFiles = new HashSet<IFile>(this.metamodelFiles);
+ this.metamodelFiles.clear();
+ for (PersistentType2_0 persistentType : persistentTypes.values()) {
+ IFile metamodelFile = persistentType.getMetamodelFile();
+ // ...remove whatever files are still present...
+ deadMetamodelFiles.remove(metamodelFile);
+ // ...rebuild the list of metamodel files...
+ if (this.fileIsGeneratedMetamodel(metamodelFile)) { // only add files with the Dali tag
+ this.metamodelFiles.add(metamodelFile);
+ }
+ }
+ // ...delete the files that are now gone
+ // [perform the deletes first - this is critical when a file has been
+ // renamed by only altering its name's case; since we will try to write
+ // out a new file that, on Windows, collides with the old file :-( ]
+ for (IFile deadMetamodelFile : deadMetamodelFiles) {
+ this.deleteMetamodelFile(deadMetamodelFile);
+ }
+ // now generate the metamodel classes
+ for (PersistentType2_0 persistentType : persistentTypes.values()) {
persistentType.synchronizeMetamodel();
}
}
- protected void addContainerPersistentTypesTo(Iterable<? extends PersistentTypeContainer> ptContainers, HashMap<String, PersistentType> persistentTypeMap) {
+ protected void addContainerPersistentTypesTo(Iterable<? extends PersistentTypeContainer> ptContainers, HashMap<String, PersistentType2_0> persistentTypeMap) {
for (PersistentTypeContainer ptContainer : ptContainers) {
this.addPersistentTypesTo(ptContainer.getPersistentTypes(), persistentTypeMap);
}
}
- protected void addPersistentTypesTo(Iterable<? extends PersistentType> persistentTypes, HashMap<String, PersistentType> persistentTypeMap) {
+ protected void addPersistentTypesTo(Iterable<? extends PersistentType> persistentTypes, HashMap<String, PersistentType2_0> persistentTypeMap) {
for (PersistentType persistentType : persistentTypes) {
- persistentTypeMap.put(persistentType.getName(), persistentType);
+ // hopefully this is case-insensitive enough...
+ persistentTypeMap.put(persistentType.getName().toLowerCase(), (PersistentType2_0) persistentType);
}
}
+ protected void deleteMetamodelFile(IFile file) {
+ try {
+ this.deleteMetamodelFile_(file);
+ } catch (CoreException ex) {
+ JptCorePlugin.log(ex);
+ }
+ }
+
+ protected void deleteMetamodelFile_(IFile file) throws CoreException {
+ if (this.fileIsGeneratedMetamodel(file)) {
+ file.delete(true, null); // true = force
+ }
+ }
+
+ protected boolean fileIsGeneratedMetamodel(IFile file) {
+ JavaResourceCompilationUnit jrcu = this.getJpaProject().getJavaResourceCompilationUnit(file);
+ if (jrcu == null) {
+ return false; // hmmm...
+ }
+ Iterator<JavaResourcePersistentType> types = jrcu.persistentTypes();
+ if ( ! types.hasNext()) {
+ return false; // no types in the file
+ }
+ JavaResourcePersistentType jrpt = types.next();
+ if (types.hasNext()) {
+ return false; // should have only a single type in the file
+ }
+ return jrpt.isGeneratedMetamodel();
+ }
+
+ public void disposeMetamodel() {
+ this.metamodelFiles.clear();
+ }
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericRootContextNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericRootContextNode.java
index a19b2b3451..62242132a2 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericRootContextNode.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericRootContextNode.java
@@ -10,13 +10,13 @@
package org.eclipse.jpt.core.internal.jpa1.context;
import java.util.List;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jpt.core.JpaProject;
import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.JpaRootContextNode;
import org.eclipse.jpt.core.context.MappingFileRoot;
import org.eclipse.jpt.core.context.persistence.Persistence;
import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
@@ -25,6 +25,8 @@ import org.eclipse.jpt.core.context.persistence.PersistenceXmlDefinition;
import org.eclipse.jpt.core.internal.context.AbstractJpaContextNode;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.core.jpa2.context.JpaRootContextNode2_0;
+import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceXml2_0;
import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
@@ -36,7 +38,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IReporter;
public class GenericRootContextNode
extends AbstractJpaContextNode
- implements JpaRootContextNode
+ implements JpaRootContextNode2_0
{
/* This object has no parent, so it must point to the JPA project explicitly. */
protected final JpaProject jpaProject;
@@ -108,14 +110,28 @@ public class GenericRootContextNode
this.firePropertyChanged(PERSISTENCE_XML_PROPERTY, old, persistenceXml);
}
+
// *************** metamodel ****************
+ public void initializeMetamodel() {
+ if (this.persistenceXml != null) {
+ ((PersistenceXml2_0) this.persistenceXml).initializeMetamodel();
+ }
+ }
+
public void synchronizeMetamodel() {
if (this.persistenceXml != null) {
- this.persistenceXml.synchronizeMetamodel();
+ ((PersistenceXml2_0) this.persistenceXml).synchronizeMetamodel();
}
}
-
+
+ public void disposeMetamodel() {
+ if (this.persistenceXml != null) {
+ ((PersistenceXml2_0) this.persistenceXml).disposeMetamodel();
+ }
+ }
+
+
// **************** updating ***********************************************
public void update(IProgressMonitor monitor) {
@@ -223,7 +239,7 @@ public class GenericRootContextNode
IMessage.HIGH_SEVERITY,
JpaValidationMessages.PERSISTENT_TYPE_MAPPED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT,
new String[] {jrpt.getName()},
- jrcu.getFile(),
+ jrpt.getFile(),
jrpt.getNameTextRange(jrcu.buildASTRoot())
)
);
@@ -234,7 +250,7 @@ public class GenericRootContextNode
IMessage.NORMAL_SEVERITY,
JpaValidationMessages.PERSISTENT_TYPE_ANNOTATED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT,
new String[] {jrpt.getName()},
- jrcu.getFile(),
+ jrpt.getFile(),
jrpt.getNameTextRange(jrcu.buildASTRoot())
)
);
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java
index ba97f1e1ba..1145a8c2ed 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java
@@ -10,6 +10,8 @@
package org.eclipse.jpt.core.internal.jpa1.context.java;
import java.util.Iterator;
+import java.util.Vector;
+
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.MappingKeys;
@@ -26,7 +28,6 @@ import org.eclipse.jpt.core.jpa2.context.java.JavaEmbeddedMapping2_0;
import org.eclipse.jpt.core.resource.java.EmbeddedAnnotation;
import org.eclipse.jpt.core.resource.java.JPA;
import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.ArrayTools;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
@@ -147,14 +148,12 @@ public class GenericJavaEmbeddedMapping
//****************** AbstractJavaAttributeMapping implementation *******************
@Override
- protected String[] buildSupportingAnnotationNames() {
- if (getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
- return ArrayTools.addAll(
- super.buildSupportingAnnotationNames(),
- JPA.ASSOCIATION_OVERRIDE,
- JPA.ASSOCIATION_OVERRIDES);
- }
- return super.buildSupportingAnnotationNames();
+ protected void addSupportingAnnotationNamesTo(Vector<String> names) {
+ super.addSupportingAnnotationNamesTo(names);
+ if (this.getJpaPlatformVersion().isCompatibleWithJpaVersion(JptCorePlugin.JPA_FACET_VERSION_2_0)) {
+ names.add(JPA.ASSOCIATION_OVERRIDE);
+ names.add(JPA.ASSOCIATION_OVERRIDES);
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPersistentType.java
index 963887add8..a18bb0ff37 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPersistentType.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPersistentType.java
@@ -14,6 +14,10 @@ import org.eclipse.jpt.core.context.PersistentType;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaPersistentType;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+/**
+ * JPA 1.0 Java persistent type.
+ * The specified access is always null.
+ */
public class GenericJavaPersistentType
extends AbstractJavaPersistentType
{
@@ -23,11 +27,11 @@ public class GenericJavaPersistentType
}
- // **************** access type *******************************************
+ // ********** access **********
/**
- * GenericJavaPersistentType does not support specified access (no Access annotation in 1.0),
- * so we return null
+ * GenericJavaPersistentType does not support specified access (no Access
+ * annotation in 1.0), so we return null
*/
@Override
protected AccessType buildSpecifiedAccess() {
@@ -35,9 +39,11 @@ public class GenericJavaPersistentType
}
/**
- * GenericJavaPersistentType does not support specified access (no Access annotation in 1.0)
+ * GenericJavaPersistentType does not support specified access
+ * (no Access annotation in 1.0)
*/
public void setSpecifiedAccess(AccessType specifiedAccess) {
throw new UnsupportedOperationException();
}
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistentType.java
index 40218c6b27..768a1d8082 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistentType.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistentType.java
@@ -15,6 +15,9 @@ import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
+import java.util.Vector;
+
+import org.eclipse.core.resources.IFile;
import org.eclipse.jpt.core.JpaStructureNode;
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.MappingKeys;
@@ -35,7 +38,9 @@ import org.eclipse.jpt.core.context.orm.OrmTypeMappingDefinition;
import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.JpaProject2_0;
+import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
+import org.eclipse.jpt.core.jpa2.context.PersistentType2_0;
+import org.eclipse.jpt.core.jpa2.context.orm.OrmPersistentType2_0;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.core.resource.orm.Attributes;
@@ -46,6 +51,9 @@ import org.eclipse.jpt.core.resource.xml.EmfTools;
import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.utility.internal.ClassTools;
import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.Tools;
+import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
+import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
import org.eclipse.jpt.utility.internal.iterators.ChainIterator;
import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
@@ -56,192 +64,159 @@ import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+/**
+ * ORM persistent type:<ul>
+ * <li>mapping
+ * <li>access
+ * <li>attributes
+ * <li>super persistent type
+ * <li>Java persistent type
+ * </ul>
+ */
public class GenericOrmPersistentType
extends AbstractOrmXmlContextNode
- implements OrmPersistentType
+ implements OrmPersistentType2_0
{
- protected final List<OrmPersistentAttribute> specifiedPersistentAttributes;
+ protected OrmTypeMapping mapping;
- protected final List<OrmPersistentAttribute> virtualPersistentAttributes;
-
protected AccessType defaultAccess;
-
+
protected AccessType specifiedAccess;
- protected OrmTypeMapping typeMapping;
-
+ protected final Vector<OrmPersistentAttribute> specifiedAttributes = new Vector<OrmPersistentAttribute>();
+
+ protected final Vector<OrmPersistentAttribute> virtualAttributes = new Vector<OrmPersistentAttribute>();
+
protected PersistentType superPersistentType;
-
+
protected JavaPersistentType javaPersistentType;
-
+ protected final PersistentType2_0.MetamodelSynchronizer metamodelSynchronizer;
+
+
public GenericOrmPersistentType(EntityMappings parent, XmlTypeMapping resourceMapping) {
super(parent);
- this.specifiedPersistentAttributes = new ArrayList<OrmPersistentAttribute>();
- this.virtualPersistentAttributes = new ArrayList<OrmPersistentAttribute>();
- this.typeMapping = buildTypeMapping(resourceMapping);
- this.specifiedAccess = this.getResourceAccess();
+ this.mapping = this.buildMapping(resourceMapping);
+ this.specifiedAccess = this.buildSpecifiedAccess();
this.defaultAccess = this.buildDefaultAccess();
this.javaPersistentType = this.buildJavaPersistentType();
- this.superPersistentType = this.buildSuperPersistentType();
- this.initializePersistentAttributes();
+ this.superPersistentType = this.buildSuperPersistentType();
+ this.initializeAttributes();
+ this.metamodelSynchronizer = this.buildMetamodelSynchronizer();
}
-
- // ********** OrmPersistentType implementation **********
-
- @Override
- public EntityMappings getParent() {
- return (EntityMappings) super.getParent();
- }
-
- protected EntityMappings getEntityMappings() {
- return this.getParent();
- }
-
- public String getDefaultPackage() {
- return this.getEntityMappings().getDefaultPersistentTypePackage();
+ protected PersistentType2_0.MetamodelSynchronizer buildMetamodelSynchronizer() {
+ return ((JpaFactory2_0) this.getJpaFactory()).buildPersistentTypeMetamodelSynchronizer(this);
}
- public boolean isDefaultMetadataComplete() {
- return this.getEntityMappings().isDefaultPersistentTypeMetadataComplete();
- }
-
- public String getId() {
- return OrmStructureNodes.PERSISTENT_TYPE_ID;
+
+ // ********** update **********
+
+ public void update() {
+ this.setSpecifiedAccess(this.buildSpecifiedAccess());
+ this.setDefaultAccess(this.buildDefaultAccess());
+ this.mapping.update();
+ this.updateJavaPersistentType();
+ this.updateSuperPersistentType();
+ this.updateAttributes();
}
- public boolean isFor(String typeName) {
- String className = this.getName();
- if (className == null) {
- return false;
- }
- if (className.equals(typeName)) {
- return true;
+ @Override
+ public void postUpdate() {
+ super.postUpdate();
+ if (this.javaPersistentType != null) {
+ this.javaPersistentType.postUpdate();
}
- String defaultPackage = this.getDefaultPackage();
- if (defaultPackage == null) {
- return false;
+ this.mapping.postUpdate();
+ for (PersistentAttribute attribute : this.getAttributes()) {
+ attribute.postUpdate();
}
- return (defaultPackage + '.' + className).equals(typeName);
}
- protected OrmTypeMapping buildTypeMapping(XmlTypeMapping resourceMapping) {
- OrmTypeMappingDefinition mappingDefintion =
- getMappingFileDefinition().getOrmTypeMappingDefinition(resourceMapping.getMappingKey());
- return mappingDefintion.buildContextMapping(this, resourceMapping, getXmlContextNodeFactory());
- }
- public OrmTypeMapping getMapping() {
- return this.typeMapping;
+ // ********** name **********
+
+ public String getName() {
+ return this.mapping.getClass_();
}
-
-
- // **************** PersistentType.Owner implementation *****************************
-
- public AccessType getOverridePersistentTypeAccess() {
- if (this.getSpecifiedAccess() != null) {
- return this.getSpecifiedAccess();
- }
- if (this.superPersistentType instanceof OrmPersistentType) {
- AccessType accessType = ((OrmPersistentType) this.superPersistentType).getSpecifiedAccess();
- if (accessType != null) {
- return accessType;
- }
- }
+ public String getShortName(){
+ String className = this.getName();
+ return (className == null) ? null : ClassTools.shortNameForClassNamed(className);
+ }
- if (this.getMapping().isMetadataComplete()) {
- AccessType accessType = this.getOwnerDefaultAccess();
- if (accessType != null) {
- return accessType;
- }
- }
- // no override access type
- return null;
- }
-
- public AccessType getDefaultPersistentTypeAccess() {
- if (this.superPersistentType instanceof OrmPersistentType) {
- AccessType accessType = ((OrmPersistentType) this.superPersistentType).getDefaultAccess();
- if (accessType != null) {
- return accessType;
- }
- }
+ // ********** mapping **********
- return this.getOwnerDefaultAccess();
+ public OrmTypeMapping getMapping() {
+ return this.mapping;
}
- // ********** PersistentType implementation **********
-
public void setMappingKey(String newMappingKey) {
if (this.valuesAreEqual(this.getMappingKey(), newMappingKey)) {
return;
}
- OrmTypeMapping oldMapping = getMapping();
- OrmTypeMappingDefinition mappingDefinition =
- getMappingFileDefinition().getOrmTypeMappingDefinition(newMappingKey);
- XmlTypeMapping resourceTypeMapping =
- mappingDefinition.buildResourceMapping(getResourceNodeFactory());
- this.typeMapping = buildTypeMapping(resourceTypeMapping);
- this.getEntityMappings().changeMapping(this, oldMapping, this.typeMapping);
- firePropertyChanged(MAPPING_PROPERTY, oldMapping, this.typeMapping);
+ OrmTypeMapping oldMapping = this.mapping;
+ OrmTypeMappingDefinition mappingDefinition = this.getMappingFileDefinition().getOrmTypeMappingDefinition(newMappingKey);
+ XmlTypeMapping resourceTypeMapping = mappingDefinition.buildResourceMapping(this.getResourceNodeFactory());
+ this.mapping = this.buildMapping(resourceTypeMapping);
+ this.getEntityMappings().changeMapping(this, oldMapping, this.mapping);
+ this.firePropertyChanged(MAPPING_PROPERTY, oldMapping, this.mapping);
}
- public Iterator<PersistentType> inheritanceHierarchy() {
- return this.inheritanceHierarchyOf(this);
+ protected OrmTypeMapping buildMapping(XmlTypeMapping resourceMapping) {
+ OrmTypeMappingDefinition mappingDefintion = this.getMappingFileDefinition().getOrmTypeMappingDefinition(resourceMapping.getMappingKey());
+ return mappingDefintion.buildContextMapping(this, resourceMapping, this.getXmlContextNodeFactory());
}
- public Iterator<PersistentType> ancestors() {
- return this.inheritanceHierarchyOf(this.superPersistentType);
- }
- protected Iterator<PersistentType> inheritanceHierarchyOf(PersistentType start) {
- // using a chain iterator to traverse up the inheritance tree
- return new ChainIterator<PersistentType>(start) {
- @Override
- protected PersistentType nextLink(PersistentType persistentType) {
- return persistentType.getSuperPersistentType();
- }
- };
- }
+ // ********** access **********
- public PersistentType getSuperPersistentType() {
- return this.superPersistentType;
- }
-
- protected void setSuperPersistentType(PersistentType superPersistentType) {
- PersistentType old = this.superPersistentType;
- this.superPersistentType = superPersistentType;
- this.firePropertyChanged(SUPER_PERSISTENT_TYPE_PROPERTY, old, superPersistentType);
+ public AccessType getAccess() {
+ return (this.specifiedAccess != null) ? this.specifiedAccess : this.defaultAccess;
}
-
+
public AccessType getDefaultAccess() {
return this.defaultAccess;
}
- protected void setDefaultAccess(AccessType newDefaultAccess) {
- AccessType oldDefaultAccess = this.defaultAccess;
- this.defaultAccess = newDefaultAccess;
- firePropertyChanged(DEFAULT_ACCESS_PROPERTY, oldDefaultAccess, newDefaultAccess);
+ protected void setDefaultAccess(AccessType defaultAccess) {
+ AccessType old = this.defaultAccess;
+ this.defaultAccess = defaultAccess;
+ this.firePropertyChanged(DEFAULT_ACCESS_PROPERTY, old, defaultAccess);
}
public AccessType getSpecifiedAccess() {
return this.specifiedAccess;
}
- public void setSpecifiedAccess(AccessType newSpecifiedAccess) {
- AccessType oldSpecifiedAccess = this.specifiedAccess;
- this.specifiedAccess = newSpecifiedAccess;
- this.getResourceTypeMapping().setAccess(AccessType.toOrmResourceModel(newSpecifiedAccess));
- firePropertyChanged(SPECIFIED_ACCESS_PROPERTY, oldSpecifiedAccess, newSpecifiedAccess);
+ public void setSpecifiedAccess(AccessType specifiedAccess) {
+ AccessType old = this.specifiedAccess;
+ this.specifiedAccess = specifiedAccess;
+ this.getResourceTypeMapping().setAccess(AccessType.toOrmResourceModel(specifiedAccess));
+ this.firePropertyChanged(SPECIFIED_ACCESS_PROPERTY, old, specifiedAccess);
}
- public AccessType getAccess() {
- return (this.getSpecifiedAccess() == null) ? this.getDefaultAccess() : this.getSpecifiedAccess();
+ protected AccessType buildDefaultAccess() {
+ if ( ! this.mapping.isMetadataComplete()) {
+ if (this.javaPersistentType != null) {
+ if (this.javaPersistentTypeHasSpecifiedAccess()) {
+ return this.javaPersistentType.getAccess();
+ }
+ if (this.superPersistentType != null) {
+ return this.superPersistentType.getAccess();
+ }
+ }
+ }
+ AccessType access = this.getMappingFileRoot().getAccess();
+ return (access != null) ? access : AccessType.FIELD; //default to FIELD if no specified access found
}
-
+
+ protected boolean javaPersistentTypeHasSpecifiedAccess() {
+ return (this.javaPersistentType.getSpecifiedAccess() != null) ||
+ this.javaPersistentType.hasAnyAnnotatedAttributes();
+ }
+
public AccessType getOwnerOverrideAccess() {
return this.getEntityMappings().getOverridePersistentTypeAccess();
}
@@ -250,123 +225,69 @@ public class GenericOrmPersistentType
return this.getEntityMappings().getDefaultPersistentTypeAccess();
}
- public void changeMapping(OrmPersistentAttribute ormPersistentAttribute, OrmAttributeMapping oldMapping, OrmAttributeMapping newMapping) {
- int sourceIndex = this.specifiedPersistentAttributes.indexOf(ormPersistentAttribute);
- this.specifiedPersistentAttributes.remove(sourceIndex);
- oldMapping.removeFromResourceModel(getResourceAttributes());
- int targetIndex = insertionIndex(ormPersistentAttribute);
- this.specifiedPersistentAttributes.add(targetIndex, ormPersistentAttribute);
- newMapping.addToResourceModel(getResourceAttributes());
- oldMapping.initializeOn(newMapping);
- fireItemMoved(ATTRIBUTES_LIST, targetIndex, sourceIndex);
+ protected AccessType buildSpecifiedAccess() {
+ return AccessType.fromOrmResourceModel(this.getResourceTypeMapping().getAccess());
}
- public void makePersistentAttributeVirtual(OrmPersistentAttribute ormPersistentAttribute) {
- if (ormPersistentAttribute.isVirtual()) {
- throw new IllegalStateException("Attribute is already virtual"); //$NON-NLS-1$
- }
- JavaPersistentAttribute javaPersistentAttribute = ormPersistentAttribute.getJavaPersistentAttribute();
- OrmPersistentAttribute virtualPersistentAttribute = null;
- if (javaPersistentAttribute != null) {
- virtualPersistentAttribute = addVirtualPersistentAttribute(javaPersistentAttribute.getResourcePersistentAttribute());
- }
- this.removeSpecifiedPersistentAttribute(ormPersistentAttribute);
- if (virtualPersistentAttribute != null) {
- fireItemAdded(VIRTUAL_ATTRIBUTES_LIST, virtualAttributesSize() - 1, virtualPersistentAttribute);
- }
- }
-
- public void makePersistentAttributeSpecified(OrmPersistentAttribute ormPersistentAttribute) {
- makePersistentAttributeSpecified(ormPersistentAttribute, ormPersistentAttribute.getMappingKey());
- }
- public void makePersistentAttributeSpecified(OrmPersistentAttribute ormPersistentAttribute, String mappingKey) {
- if (!ormPersistentAttribute.isVirtual()) {
- throw new IllegalStateException("Attribute is already specified"); //$NON-NLS-1$
- }
- if (this.valuesAreEqual(mappingKey, MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY)) {
- throw new IllegalStateException("Use makePersistentAttributeSpecified(OrmPersistentAttribute, String) instead and specify a mapping type"); //$NON-NLS-1$
- }
-
- Attributes resourceAttributes = getResourceAttributes();
- if (resourceAttributes == null) {
- resourceAttributes = createResourceAttributes();
- getMapping().getResourceTypeMapping().setAttributes(resourceAttributes);
- }
-
- OrmAttributeMappingDefinition mappingDefintion =
- getMappingFileDefinition().getOrmAttributeMappingDefinition(mappingKey);
- XmlAttributeMapping resourceMapping =
- mappingDefintion.buildResourceMapping(getResourceNodeFactory());
-
- OrmPersistentAttribute newPersistentAttribute = buildSpecifiedOrmPersistentAttribute(resourceMapping);
- int insertionIndex = insertionIndex(newPersistentAttribute);
- this.specifiedPersistentAttributes.add(insertionIndex, newPersistentAttribute);
- newPersistentAttribute.getMapping().addToResourceModel(resourceAttributes);
-
- int removalIndex = this.virtualPersistentAttributes.indexOf(ormPersistentAttribute);
- this.virtualPersistentAttributes.remove(ormPersistentAttribute);
- newPersistentAttribute.getSpecifiedMapping().setName(ormPersistentAttribute.getName());
- if (ormPersistentAttribute.getJavaPersistentAttribute().getSpecifiedAccess() != null) {
- newPersistentAttribute.setSpecifiedAccess(ormPersistentAttribute.getJavaPersistentAttribute().getSpecifiedAccess());
- }
-
- fireItemAdded(ATTRIBUTES_LIST, insertionIndex, newPersistentAttribute);
- fireItemRemoved(VIRTUAL_ATTRIBUTES_LIST, removalIndex, ormPersistentAttribute);
- }
+ // ********** attributes **********
- protected XmlTypeMapping getResourceTypeMapping() {
- return this.typeMapping.getResourceTypeMapping();
+ @SuppressWarnings("unchecked")
+ public ListIterator<OrmPersistentAttribute> attributes() {
+ return new CompositeListIterator<OrmPersistentAttribute>(this.specifiedAttributes(), this.virtualAttributes());
}
-
- protected Attributes getResourceAttributes() {
- return this.getResourceTypeMapping().getAttributes();
+
+ @SuppressWarnings("unchecked")
+ protected Iterable<OrmPersistentAttribute> getAttributes() {
+ return new CompositeIterable<OrmPersistentAttribute>(this.getSpecifiedAttributes(), this.getVirtualAttributes());
}
-
- protected Attributes createResourceAttributes() {
- return EmfTools.create(
- getResourceNodeFactory(),
- OrmPackage.eINSTANCE.getAttributes(),
- Attributes.class);
+
+ public int attributesSize() {
+ return this.specifiedAttributesSize() + this.virtualAttributesSize();
}
-
+
public Iterator<String> allAttributeNames() {
return this.attributeNames(this.allAttributes());
}
public Iterator<PersistentAttribute> allAttributes() {
- return new CompositeIterator<PersistentAttribute>(new TransformationIterator<PersistentType, Iterator<PersistentAttribute>>(this.inheritanceHierarchy()) {
- @Override
- protected Iterator<PersistentAttribute> transform(PersistentType pt) {
- return pt.attributes();
- }
- });
+ return new CompositeIterator<PersistentAttribute>(
+ new TransformationIterator<PersistentType, Iterator<PersistentAttribute>>(this.inheritanceHierarchy()) {
+ @Override
+ protected Iterator<PersistentAttribute> transform(PersistentType pt) {
+ return pt.attributes();
+ }
+ }
+ );
}
protected Iterator<OrmPersistentAttribute> attributesNamed(final String attributeName) {
- return new FilteringIterator<OrmPersistentAttribute, OrmPersistentAttribute>(attributes()) {
+ return new FilteringIterator<OrmPersistentAttribute, OrmPersistentAttribute>(this.attributes()) {
@Override
protected boolean accept(OrmPersistentAttribute o) {
- if (attributeName == null && o.getName() == null) {
- return true;
- }
- if (attributeName != null && attributeName.equals(o.getName())) {
- return true;
- }
- return false;
+ return Tools.valuesAreEqual(attributeName, o.getName());
}
};
}
public OrmPersistentAttribute getAttributeNamed(String attributeName) {
- Iterator<OrmPersistentAttribute> stream = attributesNamed(attributeName);
+ Iterator<OrmPersistentAttribute> stream = this.attributesNamed(attributeName);
return (stream.hasNext()) ? stream.next() : null;
}
+ public PersistentAttribute resolveAttribute(String attributeName) {
+ Iterator<OrmPersistentAttribute> attributes = this.attributesNamed(attributeName);
+ if (attributes.hasNext()) {
+ OrmPersistentAttribute attribute = attributes.next();
+ return attributes.hasNext() ? null /* more than one */: attribute;
+ }
+ return (this.superPersistentType == null) ? null : this.superPersistentType.resolveAttribute(attributeName);
+ }
+
public Iterator<String> attributeNames() {
return this.attributeNames(this.attributes());
}
-
+
protected Iterator<String> attributeNames(Iterator<? extends PersistentAttribute> attrs) {
return new TransformationIterator<PersistentAttribute, String>(attrs) {
@Override
@@ -375,385 +296,420 @@ public class GenericOrmPersistentType
}
};
}
-
- protected OrmPersistentAttribute getSpecifiedAttributeFor(final JavaResourcePersistentAttribute jrpa) {
- for (OrmPersistentAttribute persistentAttribute : CollectionTools.iterable(specifiedAttributes())) {
- if (persistentAttribute.getJavaPersistentAttribute() == null) {
- continue;
- }
- if ( jrpa.equals(persistentAttribute.getJavaPersistentAttribute().getResourcePersistentAttribute())) {
- return persistentAttribute;
- }
- }
- return null;
- }
- @SuppressWarnings("unchecked")
- public ListIterator<OrmPersistentAttribute> attributes() {
- return new CompositeListIterator<OrmPersistentAttribute>(specifiedAttributes(), virtualAttributes());
+ protected void initializeAttributes() {
+ this.initializeSpecifiedAttributes();
+ this.initializeVirtualAttributes();
}
- public int attributesSize() {
- return specifiedAttributesSize() + virtualAttributesSize();
- }
-
- public ListIterator<OrmPersistentAttribute> specifiedAttributes() {
- return new CloneListIterator<OrmPersistentAttribute>(this.specifiedPersistentAttributes);
- }
-
- public int specifiedAttributesSize() {
- return this.specifiedPersistentAttributes.size();
+ protected void updateAttributes() {
+ this.updateSpecifiedAttributes();
+ this.updateVirtualAttributes();
}
-
- public ListIterator<OrmPersistentAttribute> virtualAttributes() {
- return new CloneListIterator<OrmPersistentAttribute>(this.virtualPersistentAttributes);
+
+ protected Iterator<JavaResourcePersistentAttribute> javaPersistentAttributes() {
+ return (this.javaPersistentType == null) ?
+ EmptyListIterator.<JavaResourcePersistentAttribute>instance() :
+ this.javaPersistentAttributes(this.javaPersistentType.getResourcePersistentType());
}
-
- public int virtualAttributesSize() {
- return this.virtualPersistentAttributes.size();
+
+ protected Iterator<JavaResourcePersistentAttribute> javaPersistentAttributes(JavaResourcePersistentType resourcePersistentType) {
+ AccessType access = this.specifiedAccess;
+ if (access == null && ! this.mapping.isMetadataComplete()) {
+ access = this.getJavaPersistentType().getSpecifiedAccess();
+ }
+ if (access == null) {
+ access = this.defaultAccess;
+ }
+ return resourcePersistentType.persistableAttributes(AccessType.toJavaResourceModel(access));
}
-
- protected void addVirtualPersistentAttribute(OrmPersistentAttribute ormPersistentAttribute) {
- addItemToList(ormPersistentAttribute, this.virtualPersistentAttributes, VIRTUAL_ATTRIBUTES_LIST);
+
+
+ // ********** specified attributes **********
+
+ public ListIterator<OrmPersistentAttribute> specifiedAttributes() {
+ return new CloneListIterator<OrmPersistentAttribute>(this.specifiedAttributes);
}
- protected void removeVirtualPersistentAttribute(OrmPersistentAttribute ormPersistentAttribute) {
- removeItemFromList(ormPersistentAttribute, this.virtualPersistentAttributes, VIRTUAL_ATTRIBUTES_LIST);
+ protected Iterable<OrmPersistentAttribute> getSpecifiedAttributes() {
+ return new LiveCloneIterable<OrmPersistentAttribute>(this.specifiedAttributes);
}
-
- protected void moveVirtualPersistentAttribute_(int index, OrmPersistentAttribute attribute) {
- moveItemInList(index, this.virtualPersistentAttributes.indexOf(attribute), this.virtualPersistentAttributes, VIRTUAL_ATTRIBUTES_LIST);
+
+ public int specifiedAttributesSize() {
+ return this.specifiedAttributes.size();
}
- public boolean containsVirtualPersistentAttribute(OrmPersistentAttribute ormPersistentAttribute) {
- return this.virtualPersistentAttributes.contains(ormPersistentAttribute);
+ protected OrmPersistentAttribute getSpecifiedAttributeFor(final JavaResourcePersistentAttribute jrpa) {
+ for (OrmPersistentAttribute attribute : this.getSpecifiedAttributes()) {
+ JavaPersistentAttribute javaAttribute = attribute.getJavaPersistentAttribute();
+ if ((javaAttribute != null) && (javaAttribute.getResourcePersistentAttribute() == jrpa)) {
+ return attribute;
+ }
+ }
+ return null;
}
-
- public OrmPersistentAttribute addSpecifiedPersistentAttribute(String mappingKey, String attributeName) {
- Attributes resourceAttributes = getResourceAttributes();
+
+ public OrmPersistentAttribute addSpecifiedAttribute(String mappingKey, String attributeName) {
+ Attributes resourceAttributes = this.getResourceAttributes();
if (resourceAttributes == null) {
- resourceAttributes = createResourceAttributes();
- getMapping().getResourceTypeMapping().setAttributes(resourceAttributes);
- }
-
- OrmAttributeMappingDefinition mappingDefintion =
- getMappingFileDefinition().getOrmAttributeMappingDefinition(mappingKey);
- XmlAttributeMapping resourceMapping =
- mappingDefintion.buildResourceMapping(getResourceNodeFactory());
- OrmPersistentAttribute persistentAttribute =
- buildSpecifiedOrmPersistentAttribute(resourceMapping);
- int index = insertionIndex(persistentAttribute);
- this.specifiedPersistentAttributes.add(index, persistentAttribute);
+ resourceAttributes = this.createResourceAttributes();
+ this.mapping.getResourceTypeMapping().setAttributes(resourceAttributes);
+ }
+
+ OrmAttributeMappingDefinition mappingDefintion = this.getMappingFileDefinition().getOrmAttributeMappingDefinition(mappingKey);
+ XmlAttributeMapping resourceMapping = mappingDefintion.buildResourceMapping(getResourceNodeFactory());
+ OrmPersistentAttribute persistentAttribute = this.buildSpecifiedAttribute(resourceMapping);
+ int index = this.getSpecifiedAttributeInsertionIndex(persistentAttribute);
+ this.specifiedAttributes.add(index, persistentAttribute);
persistentAttribute.getMapping().addToResourceModel(resourceAttributes);
-
+
persistentAttribute.getSpecifiedMapping().setName(attributeName);
- fireItemAdded(ATTRIBUTES_LIST, index, persistentAttribute);
+ this.fireItemAdded(ATTRIBUTES_LIST, index, persistentAttribute);
return persistentAttribute;
}
- protected int insertionIndex(OrmPersistentAttribute persistentAttribute) {
- return CollectionTools.insertionIndexOf(this.specifiedPersistentAttributes, persistentAttribute, buildMappingComparator());
+ public void changeMapping(OrmPersistentAttribute ormPersistentAttribute, OrmAttributeMapping oldMapping, OrmAttributeMapping newMapping) {
+ int sourceIndex = this.specifiedAttributes.indexOf(ormPersistentAttribute);
+ this.specifiedAttributes.remove(sourceIndex);
+ oldMapping.removeFromResourceModel(this.getResourceAttributes());
+ int targetIndex = getSpecifiedAttributeInsertionIndex(ormPersistentAttribute);
+ this.specifiedAttributes.add(targetIndex, ormPersistentAttribute);
+ newMapping.addToResourceModel(this.getResourceAttributes());
+ oldMapping.initializeOn(newMapping);
+ this.fireItemMoved(ATTRIBUTES_LIST, targetIndex, sourceIndex);
}
- protected Comparator<OrmPersistentAttribute> buildMappingComparator() {
- return new Comparator<OrmPersistentAttribute>() {
- public int compare(OrmPersistentAttribute o1, OrmPersistentAttribute o2) {
- int o1Sequence = o1.getMapping().getXmlSequence();
- int o2Sequence = o2.getMapping().getXmlSequence();
- if (o1Sequence < o2Sequence) {
- return -1;
- }
- if (o1Sequence == o2Sequence) {
- return 0;
- }
- return 1;
- }
- };
+ public void makeAttributeSpecified(OrmPersistentAttribute ormPersistentAttribute) {
+ this.makeAttributeSpecified(ormPersistentAttribute, ormPersistentAttribute.getMappingKey());
}
- protected void removeSpecifiedPersistentAttribute_(OrmPersistentAttribute ormPersistentAttribute) {
- removeItemFromList(ormPersistentAttribute, this.specifiedPersistentAttributes, ATTRIBUTES_LIST);
- }
-
- protected void moveSpecifiedPersistentAttribute_(int index, OrmPersistentAttribute attribute) {
- moveItemInList(index, this.specifiedPersistentAttributes.indexOf(attribute), this.specifiedPersistentAttributes, ATTRIBUTES_LIST);
- }
+ public void makeAttributeSpecified(OrmPersistentAttribute ormPersistentAttribute, String mappingKey) {
+ if ( ! ormPersistentAttribute.isVirtual()) {
+ throw new IllegalStateException("Attribute is already specified"); //$NON-NLS-1$
+ }
+ if (this.valuesAreEqual(mappingKey, MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY)) {
+ throw new IllegalStateException("Use makePersistentAttributeSpecified(OrmPersistentAttribute, String) instead and specify a mapping type"); //$NON-NLS-1$
+ }
- public void removeSpecifiedPersistentAttribute(OrmPersistentAttribute ormPersistentAttribute) {
- int index = this.specifiedPersistentAttributes.indexOf(ormPersistentAttribute);
- this.specifiedPersistentAttributes.remove(ormPersistentAttribute);
- ormPersistentAttribute.getMapping().removeFromResourceModel(getResourceAttributes());
- if (getResourceAttributes().isUnset()) {
- this.typeMapping.getResourceTypeMapping().setAttributes(null);
+ Attributes resourceAttributes = this.getResourceAttributes();
+ if (resourceAttributes == null) {
+ resourceAttributes = this.createResourceAttributes();
+ this.mapping.getResourceTypeMapping().setAttributes(resourceAttributes);
}
- fireItemRemoved(ATTRIBUTES_LIST, index, ormPersistentAttribute);
- }
- public String getName() {
- return this.getMapping().getClass_();
- }
-
- public String getShortName(){
- String className = this.getName();
- return (className == null) ? null : ClassTools.shortNameForClassNamed(className);
- }
+ OrmAttributeMappingDefinition mappingDefintion = this.getMappingFileDefinition().getOrmAttributeMappingDefinition(mappingKey);
+ XmlAttributeMapping resourceMapping = mappingDefintion.buildResourceMapping(getResourceNodeFactory());
- public void classChanged(String oldClass, String newClass) {
- firePropertyChanged(NAME_PROPERTY, oldClass, newClass);
+ OrmPersistentAttribute newAttribute = this.buildSpecifiedAttribute(resourceMapping);
+ int insertionIndex = this.getSpecifiedAttributeInsertionIndex(newAttribute);
+ this.specifiedAttributes.add(insertionIndex, newAttribute);
+ newAttribute.getMapping().addToResourceModel(resourceAttributes);
+
+ int removalIndex = this.virtualAttributes.indexOf(ormPersistentAttribute);
+ this.virtualAttributes.remove(ormPersistentAttribute);
+ newAttribute.getSpecifiedMapping().setName(ormPersistentAttribute.getName());
+ if (ormPersistentAttribute.getJavaPersistentAttribute().getSpecifiedAccess() != null) {
+ newAttribute.setSpecifiedAccess(ormPersistentAttribute.getJavaPersistentAttribute().getSpecifiedAccess());
+ }
+
+ this.fireItemAdded(ATTRIBUTES_LIST, insertionIndex, newAttribute);
+ this.fireItemRemoved(VIRTUAL_ATTRIBUTES_LIST, removalIndex, ormPersistentAttribute);
}
- public boolean isMapped() {
- return true;
+ protected int getSpecifiedAttributeInsertionIndex(OrmPersistentAttribute specifiedAttribute) {
+ return CollectionTools.insertionIndexOf(this.specifiedAttributes, specifiedAttribute, this.getAttributeComparator());
}
- public String getMappingKey() {
- return getMapping().getKey();
+ protected Comparator<OrmPersistentAttribute> getAttributeComparator() {
+ return ATTRIBUTE_COMPARATOR;
}
-
- public JavaPersistentType getJavaPersistentType() {
- return this.javaPersistentType;
+
+ protected static final Comparator<OrmPersistentAttribute> ATTRIBUTE_COMPARATOR =
+ new Comparator<OrmPersistentAttribute>() {
+ public int compare(OrmPersistentAttribute o1, OrmPersistentAttribute o2) {
+ int o1Sequence = o1.getMapping().getXmlSequence();
+ int o2Sequence = o2.getMapping().getXmlSequence();
+ return (o1Sequence == o2Sequence) ? 0 : (o1Sequence < o2Sequence) ? -1 : 1;
+ }
+ };
+
+ protected Attributes getResourceAttributes() {
+ return this.getResourceTypeMapping().getAttributes();
}
-
- protected void setJavaPersistentType(JavaPersistentType newJavaPersistentType) {
- JavaPersistentType oldJavaPersistentType = this.javaPersistentType;
- this.javaPersistentType = newJavaPersistentType;
- firePropertyChanged(JAVA_PERSISTENT_TYPE_PROPERTY, oldJavaPersistentType, newJavaPersistentType);
+
+ protected Attributes createResourceAttributes() {
+ return EmfTools.create(this.getResourceNodeFactory(), OrmPackage.eINSTANCE.getAttributes(), Attributes.class);
}
- protected AccessType getResourceAccess() {
- return AccessType.fromOrmResourceModel(this.getResourceTypeMapping().getAccess());
+ protected void initializeSpecifiedAttributes() {
+ Attributes attributes = this.getResourceAttributes();
+ if (attributes == null) {
+ return;
+ }
+ for (XmlAttributeMapping resourceMapping : attributes.getAttributeMappings()) {
+ this.addSpecifiedAttribute(resourceMapping);
+ }
}
- protected AccessType buildDefaultAccess() {
- if (! getMapping().isMetadataComplete()) {
- if (this.javaPersistentType != null) {
- if (javaPersistentTypeHasSpecifiedAccess()) {
- return this.javaPersistentType.getAccess();
+ protected void updateSpecifiedAttributes() {
+ Attributes attributes = this.getResourceAttributes();
+ Collection<OrmPersistentAttribute> contextAttributesToRemove = CollectionTools.collection(this.specifiedAttributes());
+ Collection<OrmPersistentAttribute> contextAttributesToUpdate = new ArrayList<OrmPersistentAttribute>();
+ int resourceIndex = 0;
+
+ if (attributes != null) {
+ for (XmlAttributeMapping resourceMapping : attributes.getAttributeMappings()) {
+ boolean contextAttributeFound = false;
+ for (OrmPersistentAttribute contextAttribute : contextAttributesToRemove) {
+ if (contextAttribute.getMapping().getResourceAttributeMapping() == resourceMapping) {
+ this.moveSpecifiedAttribute_(resourceIndex, contextAttribute);
+ contextAttributesToRemove.remove(contextAttribute);
+ contextAttributesToUpdate.add(contextAttribute);
+ contextAttributeFound = true;
+ break;
+ }
}
- if (this.superPersistentType != null) {
- return this.superPersistentType.getAccess();
+ if ( ! contextAttributeFound) {
+ OrmPersistentAttribute ormPersistentAttribute = this.addSpecifiedAttribute(resourceMapping);
+ this.fireItemAdded(ATTRIBUTES_LIST, specifiedAttributesSize(), ormPersistentAttribute);
}
+ resourceIndex++;
}
}
- AccessType access = getMappingFileRoot().getAccess();
- return access != null ? access : AccessType.FIELD; //default to FIELD if no specified access found
+ for (OrmPersistentAttribute contextAttribute : contextAttributesToRemove) {
+ this.removeSpecifiedAttribute_(contextAttribute);
+ }
+ //first handle adding/removing of the persistent attributes, then update the others last,
+ //this causes less churn in the update process
+ for (OrmPersistentAttribute contextAttribute : contextAttributesToUpdate) {
+ contextAttribute.update();
+ }
}
-
- protected boolean javaPersistentTypeHasSpecifiedAccess() {
- return this.javaPersistentType.getSpecifiedAccess() != null ||
- this.javaPersistentType.hasAnyAnnotatedAttributes();
+
+ protected void removeSpecifiedAttribute_(OrmPersistentAttribute ormPersistentAttribute) {
+ this.removeItemFromList(ormPersistentAttribute, this.specifiedAttributes, ATTRIBUTES_LIST);
}
- protected JavaPersistentType buildJavaPersistentType() {
- JavaResourcePersistentType jrpt = this.getJavaResourcePersistentType();
- return (jrpt == null) ? null : this.buildJavaPersistentType(jrpt);
+ //not firing change notification so this can be reused in initialize and update
+ protected OrmPersistentAttribute addSpecifiedAttribute(XmlAttributeMapping resourceMapping) {
+ OrmPersistentAttribute ormPersistentAttribute = this.buildSpecifiedAttribute(resourceMapping);
+ this.specifiedAttributes.add(ormPersistentAttribute);
+ return ormPersistentAttribute;
}
- protected JavaResourcePersistentType getJavaResourcePersistentType() {
- String className = this.getName();
- if (className == null) {
- return null;
- }
- className = className.replace('$', '.');
+ protected void moveSpecifiedAttribute_(int index, OrmPersistentAttribute attribute) {
+ this.moveItemInList(index, this.specifiedAttributes.indexOf(attribute), this.specifiedAttributes, ATTRIBUTES_LIST);
+ }
- // first try to resolve using only the locally specified name...
- JavaResourcePersistentType jrpt = this.getJavaResourcePersistentType(className);
- if (jrpt != null) {
- return jrpt;
+ public void removeSpecifiedAttribute(OrmPersistentAttribute ormPersistentAttribute) {
+ int index = this.specifiedAttributes.indexOf(ormPersistentAttribute);
+ this.specifiedAttributes.remove(ormPersistentAttribute);
+ ormPersistentAttribute.getMapping().removeFromResourceModel(this.getResourceAttributes());
+ if (this.getResourceAttributes().isUnset()) {
+ this.mapping.getResourceTypeMapping().setAttributes(null);
}
+ this.fireItemRemoved(ATTRIBUTES_LIST, index, ormPersistentAttribute);
+ }
- // ...then try to resolve by prepending the global package name
- String defaultPackage = this.getDefaultPackage();
- if (defaultPackage == null) {
- return null;
- }
- return this.getJavaResourcePersistentType(defaultPackage + '.' + className);
+ protected OrmPersistentAttribute buildSpecifiedAttribute(XmlAttributeMapping resourceMapping) {
+ return this.buildOrmPersistentAttribute(this.buildSpecifiedAttributeOwner(), resourceMapping);
}
-
- protected JavaResourcePersistentType getJavaResourcePersistentType(String className) {
- return this.getJpaProject().getJavaResourcePersistentType(className);
+
+ protected OrmPersistentAttribute.Owner buildSpecifiedAttributeOwner() {
+ return new SpecifiedAttributeOwner();
}
-
- protected JavaPersistentType buildJavaPersistentType(JavaResourcePersistentType jrpt) {
- return getJpaFactory().buildJavaPersistentType(this, jrpt);
+
+ protected JavaPersistentAttribute buildJavaPersistentAttribute(JavaResourcePersistentAttribute jrpa) {
+ return this.getJpaFactory().buildJavaPersistentAttribute(this, jrpa);
}
- protected void initializePersistentAttributes() {
- this.initializeSpecifiedPersistentAttributes();
- this.initializeVirtualPersistentAttributes();
+
+ // ********** virtual attributes **********
+
+ public ListIterator<OrmPersistentAttribute> virtualAttributes() {
+ return new CloneListIterator<OrmPersistentAttribute>(this.virtualAttributes);
}
-
- protected OrmPersistentAttribute buildSpecifiedOrmPersistentAttribute(XmlAttributeMapping resourceMapping) {
- return buildOrmPersistentAttribute(buildSpecifiedPersistentAttributeOwner(), resourceMapping);
+
+ protected Iterable<OrmPersistentAttribute> getVirtualAttributes() {
+ return new LiveCloneIterable<OrmPersistentAttribute>(this.virtualAttributes);
}
-
- protected OrmPersistentAttribute.Owner buildSpecifiedPersistentAttributeOwner() {
- return new SpecifiedPersistentAttributeOwner();
+
+ public int virtualAttributesSize() {
+ return this.virtualAttributes.size();
}
- /**
- * All orm.xml persistent types must be able to generate a static metamodel
- * because 1.0 orm.xml files can be referenced from 2.0 persistence.xml files.
- */
- public void synchronizeMetamodel() {
- // if we get here, it's safe to assume the JPA project is 2.0
- if (this.javaPersistentType != null) {
- ((JpaProject2_0) this.getJpaProject()).synchronizeMetamodel(this);
- }
+ protected void addVirtualAttribute(OrmPersistentAttribute virtualAttribute) {
+ this.addItemToList(virtualAttribute, this.virtualAttributes, VIRTUAL_ATTRIBUTES_LIST);
}
- protected class SpecifiedPersistentAttributeOwner implements OrmPersistentAttribute.Owner {
-
- private JavaPersistentAttribute cachedJavaPersistentAttribute;
-
- public JavaPersistentAttribute findJavaPersistentAttribute(OrmPersistentAttribute ormPersistentAttribute) {
- if (GenericOrmPersistentType.this.javaPersistentType == null) {
- return null;
- }
- String ormName = ormPersistentAttribute.getName();
- if (ormName == null) {
- return null;
- }
- AccessType ormAccess = ormPersistentAttribute.getAccess();
+ protected void removeVirtualAttribute(OrmPersistentAttribute virtualAttribute) {
+ this.removeItemFromList(virtualAttribute, this.virtualAttributes, VIRTUAL_ATTRIBUTES_LIST);
+ }
- JavaPersistentAttribute javaPersistentAttribute = this.findExistingJavaPersistentAttribute(ormName);
- if ((javaPersistentAttribute != null) && (javaPersistentAttribute.getAccess() == ormAccess)) {
- this.cachedJavaPersistentAttribute = null; // we only want to cache the persistent attribute if we build it
- return javaPersistentAttribute;
- }
+ protected void moveVirtualAttribute_(int index, OrmPersistentAttribute virtualAttribute) {
+ this.moveItemInList(index, this.virtualAttributes.indexOf(virtualAttribute), this.virtualAttributes, VIRTUAL_ATTRIBUTES_LIST);
+ }
- // if 'javaPersistentAttribute' is null, it might exist in a superclass that is not persistent, we need to build it ourselves.
- // if access is different, we won't be able to find the corresponding java persistent attribute, it won't exist so we build it ourselves
- return this.buildJavaPersistentAttribute(ormName, ormAccess);
+ public boolean containsVirtualAttribute(OrmPersistentAttribute ormPersistentAttribute) {
+ return this.virtualAttributes.contains(ormPersistentAttribute);
+ }
+
+ public void makeAttributeVirtual(OrmPersistentAttribute ormPersistentAttribute) {
+ if (ormPersistentAttribute.isVirtual()) {
+ throw new IllegalStateException("Attribute is already virtual"); //$NON-NLS-1$
}
-
- protected JavaPersistentAttribute findExistingJavaPersistentAttribute(String attributeName) {
- return GenericOrmPersistentType.this.javaPersistentType.getAttributeNamed(attributeName);
+ JavaPersistentAttribute javaPersistentAttribute = ormPersistentAttribute.getJavaPersistentAttribute();
+ OrmPersistentAttribute virtualAttribute = null;
+ if (javaPersistentAttribute != null) {
+ virtualAttribute = this.addVirtualAttribute(javaPersistentAttribute.getResourcePersistentAttribute());
}
+ this.removeSpecifiedAttribute(ormPersistentAttribute);
+ if (virtualAttribute != null) {
+ this.fireItemAdded(VIRTUAL_ATTRIBUTES_LIST, virtualAttributesSize() - 1, virtualAttribute);
+ }
+ }
- protected JavaPersistentAttribute buildJavaPersistentAttribute(String ormName, AccessType ormAccess) {
- JavaResourcePersistentAttribute jrpa = this.getJavaResourcePersistentAttribute(this.getJavaResourcePersistentType(), ormName, ormAccess);
- if (this.cachedJavaPersistentAttribute != null &&
- this.cachedJavaPersistentAttribute.getResourcePersistentAttribute() == jrpa) {
- return this.cachedJavaPersistentAttribute;
+ protected void initializeVirtualAttributes() {
+ for (Iterator<JavaResourcePersistentAttribute> stream = this.javaPersistentAttributes(); stream.hasNext(); ) {
+ JavaResourcePersistentAttribute javaResourceAttribute = stream.next();
+ if (this.getSpecifiedAttributeFor(javaResourceAttribute) == null) {
+ this.addVirtualAttribute(javaResourceAttribute);
}
- return this.cachedJavaPersistentAttribute = (jrpa == null) ? null : GenericOrmPersistentType.this.buildJavaPersistentAttribute(jrpa);
}
+ }
- protected JavaResourcePersistentType getJavaResourcePersistentType() {
- return GenericOrmPersistentType.this.javaPersistentType.getResourcePersistentType();
- }
+ protected void updateVirtualAttributes() {
+ Collection<OrmPersistentAttribute> contextAttributesToRemove = CollectionTools.collection(this.virtualAttributes());
+ Collection<OrmPersistentAttribute> contextAttributesToUpdate = new ArrayList<OrmPersistentAttribute>();
+ int resourceIndex = 0;
- protected JavaResourcePersistentAttribute getJavaResourcePersistentAttribute(JavaResourcePersistentType javaResourcePersistentType, String ormName, AccessType ormAccess) {
- for (Iterator<JavaResourcePersistentAttribute> stream = this.attributes(javaResourcePersistentType, ormAccess); stream.hasNext(); ) {
- JavaResourcePersistentAttribute jrpa = stream.next();
- if (jrpa.getName().equals(ormName)) {
- return jrpa;
+ for (Iterator<JavaResourcePersistentAttribute> stream = this.javaPersistentAttributes(); stream.hasNext(); ) {
+ JavaResourcePersistentAttribute javaResourceAttribute = stream.next();
+ OrmPersistentAttribute specifiedAttribute = this.getSpecifiedAttributeFor(javaResourceAttribute);
+ if (specifiedAttribute == null) {
+ JavaPersistentAttribute javaAttribute = this.getJpaFactory().buildJavaPersistentAttribute(this, javaResourceAttribute);
+ JavaAttributeMapping javaAttributeMapping = javaAttribute.getMapping();
+ if (this.mapping.isMetadataComplete()) {
+ javaAttributeMapping = javaAttribute.getDefaultMapping();
}
+ boolean contextAttributeFound = false;
+ for (OrmPersistentAttribute contextAttribute : contextAttributesToRemove) {
+ JavaPersistentAttribute javaPersistentAttribute = contextAttribute.getJavaPersistentAttribute();
+ if (javaPersistentAttribute.getResourcePersistentAttribute() == javaResourceAttribute) {
+ if (this.valuesAreEqual(contextAttribute.getMappingKey(), javaAttributeMapping.getKey())) {
+ //the mapping key would change if metaDataComplete flag changes, rebuild the orm attribute
+ this.moveVirtualAttribute_(resourceIndex, contextAttribute);
+ contextAttributesToRemove.remove(contextAttribute);
+ contextAttributesToUpdate.add(contextAttribute);
+ contextAttributeFound = true;
+ break;
+ }
+ }
+ }
+ if ( ! contextAttributeFound) {
+ OrmPersistentAttribute virtualAttribute = this.addVirtualAttribute(javaAttributeMapping);
+ this.fireItemAdded(VIRTUAL_ATTRIBUTES_LIST, virtualAttributesSize() - 1, virtualAttribute);
+ }
+ resourceIndex++;
}
- // climb up inheritance hierarchy
- String superclassName = javaResourcePersistentType.getSuperclassQualifiedName();
- if (superclassName == null) {
- return null;
- }
- JavaResourcePersistentType superclass = GenericOrmPersistentType.this.getJavaResourcePersistentType(superclassName);
- if (superclass == null) {
- return null;
- }
- // recurse
- return this.getJavaResourcePersistentAttribute(superclass, ormName, ormAccess);
}
- protected Iterator<JavaResourcePersistentAttribute> attributes(JavaResourcePersistentType javaResourcePersistentType, AccessType ormAccess) {
- return (ormAccess == AccessType.PROPERTY) ? javaResourcePersistentType.persistableProperties() : javaResourcePersistentType.persistableFields();
+ for (OrmPersistentAttribute contextAttribute : contextAttributesToRemove) {
+ this.removeVirtualAttribute(contextAttribute);
+ }
+ //first handle adding/removing of the persistent attributes, then update the others last,
+ //this causes less churn in the update process
+ for (OrmPersistentAttribute contextAttribute : contextAttributesToUpdate) {
+ contextAttribute.update();
}
+ }
- public void updateJavaPersistentAttribute() {
- if (this.cachedJavaPersistentAttribute != null) {
- this.cachedJavaPersistentAttribute.update();
- }
- //else {
- //don't update, we don't own the java persistent attribute,
- //it will be updated through the java context model
- //}
+ protected OrmPersistentAttribute addVirtualAttribute(JavaResourcePersistentAttribute resourceAttribute) {
+ JavaPersistentAttribute javaAttribute = this.getJpaFactory().buildJavaPersistentAttribute(this, resourceAttribute);
+ JavaAttributeMapping javaAttributeMapping = javaAttribute.getMapping();
+ if (this.mapping.isMetadataComplete()) {
+ javaAttributeMapping = javaAttribute.getDefaultMapping();
}
+ return this.addVirtualAttribute(javaAttributeMapping);
}
-
- protected JavaPersistentAttribute buildJavaPersistentAttribute(JavaResourcePersistentAttribute jrpa) {
- return this.getJpaFactory().buildJavaPersistentAttribute(this, jrpa);
+
+ //not firing change notification so this can be reused in initialize and update
+ protected OrmPersistentAttribute addVirtualAttribute(JavaAttributeMapping javaAttributeMapping) {
+ OrmAttributeMappingDefinition mappingDefintion = this.getMappingFileDefinition().getOrmAttributeMappingDefinition(javaAttributeMapping.getKey());
+ XmlAttributeMapping resourceMapping = mappingDefintion.buildVirtualResourceMapping(this.mapping, javaAttributeMapping, this.getXmlContextNodeFactory());
+ OrmPersistentAttribute virtualAttribute = this.buildVirtualOrmPersistentAttribute(javaAttributeMapping, resourceMapping);
+ this.virtualAttributes.add(virtualAttribute);
+ return virtualAttribute;
}
-
+
protected OrmPersistentAttribute buildVirtualOrmPersistentAttribute(JavaAttributeMapping javaAttributeMapping, XmlAttributeMapping resourceMapping) {
- return buildOrmPersistentAttribute(buildVirtualPersistentAttributeOwner(javaAttributeMapping.getPersistentAttribute()), resourceMapping);
+ return this.buildOrmPersistentAttribute(this.buildVirtualAttributeOwner(javaAttributeMapping.getPersistentAttribute()), resourceMapping);
}
protected OrmPersistentAttribute buildOrmPersistentAttribute(OrmPersistentAttribute.Owner owner, XmlAttributeMapping resourceMapping) {
- return getXmlContextNodeFactory().buildOrmPersistentAttribute(this, owner, resourceMapping);
+ return this.getXmlContextNodeFactory().buildOrmPersistentAttribute(this, owner, resourceMapping);
}
-
- protected OrmPersistentAttribute.Owner buildVirtualPersistentAttributeOwner(final JavaPersistentAttribute javaPersistentAttribute) {
+
+ protected OrmPersistentAttribute.Owner buildVirtualAttributeOwner(final JavaPersistentAttribute javaPersistentAttribute) {
return new OrmPersistentAttribute.Owner() {
public JavaPersistentAttribute findJavaPersistentAttribute(OrmPersistentAttribute ormPersistentAttribute) {
return javaPersistentAttribute;
}
-
+
public void updateJavaPersistentAttribute() {
//update the attribute, since we own it and it will not get updated otherwise
javaPersistentAttribute.update();
- }
+ }
};
}
-
- protected void initializeSpecifiedPersistentAttributes() {
- Attributes attributes = this.getResourceAttributes();
- if (attributes == null) {
- return;
- }
- for (XmlAttributeMapping resourceMapping : attributes.getAttributeMappings()) {
- addSpecifiedPersistentAttribute(resourceMapping);
- }
+
+
+ // ********** Java persistent type **********
+
+ public JavaPersistentType getJavaPersistentType() {
+ return this.javaPersistentType;
}
- protected void initializeVirtualPersistentAttributes() {
- Iterator<JavaResourcePersistentAttribute> javaResourceAttributes = javaPersistentAttributes();
-
- while (javaResourceAttributes.hasNext()) {
- JavaResourcePersistentAttribute javaResourceAttribute = javaResourceAttributes.next();
- if (getSpecifiedAttributeFor(javaResourceAttribute) == null) {
- addVirtualPersistentAttribute(javaResourceAttribute);
- }
- }
+ protected void setJavaPersistentType(JavaPersistentType javaPersistentType) {
+ JavaPersistentType old = this.javaPersistentType;
+ this.javaPersistentType = javaPersistentType;
+ this.firePropertyChanged(JAVA_PERSISTENT_TYPE_PROPERTY, old, javaPersistentType);
}
-
- protected Iterator<JavaResourcePersistentAttribute> javaPersistentAttributes() {
- return (this.javaPersistentType == null) ? EmptyListIterator.<JavaResourcePersistentAttribute>instance() :
- this.javaPersistentAttributes(this.javaPersistentType.getResourcePersistentType());
+
+ protected JavaPersistentType buildJavaPersistentType() {
+ JavaResourcePersistentType jrpt = this.getJavaResourcePersistentType();
+ return (jrpt == null) ? null : this.buildJavaPersistentType(jrpt);
}
- protected Iterator<JavaResourcePersistentAttribute> javaPersistentAttributes(JavaResourcePersistentType resourcePersistentType) {
- AccessType access = getSpecifiedAccess();
- if (access == null && !getMapping().isMetadataComplete()) {
- access = getJavaPersistentType().getSpecifiedAccess();
+ protected JavaResourcePersistentType getJavaResourcePersistentType() {
+ String className = this.getName();
+ if (className == null) {
+ return null;
}
- if (access == null) {
- access = this.getDefaultAccess();
+ className = className.replace('$', '.');
+
+ // first try to resolve using only the locally specified name...
+ JavaResourcePersistentType jrpt = this.getJavaResourcePersistentType(className);
+ if (jrpt != null) {
+ return jrpt;
}
- return resourcePersistentType.persistableAttributes(AccessType.toJavaResourceModel(access));
+
+ // ...then try to resolve by prepending the global package name
+ String defaultPackage = this.getDefaultPackage();
+ if (defaultPackage == null) {
+ return null;
+ }
+ return this.getJavaResourcePersistentType(defaultPackage + '.' + className);
}
- protected PersistentType buildSuperPersistentType() {
- return (this.javaPersistentType == null) ? null : this.javaPersistentType.getSuperPersistentType();
+ protected JavaResourcePersistentType getJavaResourcePersistentType(String className) {
+ return this.getJpaProject().getJavaResourcePersistentType(className);
}
- public void update() {
- this.setSpecifiedAccess(this.getResourceAccess());
- this.setDefaultAccess(this.buildDefaultAccess());
- this.getMapping().update();
- this.updateJavaPersistentType();
- this.updateSuperPersistentType();
- this.updatePersistentAttributes();
+ protected JavaPersistentType buildJavaPersistentType(JavaResourcePersistentType jrpt) {
+ return getJpaFactory().buildJavaPersistentType(this, jrpt);
}
-
+
protected void updateJavaPersistentType() {
JavaResourcePersistentType jrpt = this.getJavaResourcePersistentType();
if (jrpt == null) {
@@ -764,9 +720,22 @@ public class GenericOrmPersistentType
} else {
this.javaPersistentType.update(jrpt);
}
- }
+ }
+ }
+
+
+ // ********** super persistent type **********
+
+ public PersistentType getSuperPersistentType() {
+ return this.superPersistentType;
+ }
+
+ protected void setSuperPersistentType(PersistentType superPersistentType) {
+ PersistentType old = this.superPersistentType;
+ this.superPersistentType = superPersistentType;
+ this.firePropertyChanged(SUPER_PERSISTENT_TYPE_PROPERTY, old, superPersistentType);
}
-
+
protected void updateSuperPersistentType() {
PersistentType spt = this.buildSuperPersistentType();
// check for circular inheritance
@@ -776,161 +745,123 @@ public class GenericOrmPersistentType
this.setSuperPersistentType(spt);
}
}
-
- protected void updatePersistentAttributes() {
- this.updateSpecifiedPersistentAttributes();
- this.updateVirtualPersistentAttributes();
+
+ protected PersistentType buildSuperPersistentType() {
+ return (this.javaPersistentType == null) ? null : this.javaPersistentType.getSuperPersistentType();
}
- protected void updateSpecifiedPersistentAttributes() {
- Attributes attributes = this.getResourceAttributes();
- Collection<OrmPersistentAttribute> contextAttributesToRemove = CollectionTools.collection(specifiedAttributes());
- Collection<OrmPersistentAttribute> contextAttributesToUpdate = new ArrayList<OrmPersistentAttribute>();
- int resourceIndex = 0;
-
- if (attributes != null) {
- for (XmlAttributeMapping resourceMapping : attributes.getAttributeMappings()) {
- boolean contextAttributeFound = false;
- for (OrmPersistentAttribute contextAttribute : contextAttributesToRemove) {
- if (contextAttribute.getMapping().getResourceAttributeMapping() == resourceMapping) {
- moveSpecifiedPersistentAttribute_(resourceIndex, contextAttribute);
- contextAttributesToRemove.remove(contextAttribute);
- contextAttributesToUpdate.add(contextAttribute);
- contextAttributeFound = true;
- break;
- }
- }
- if (!contextAttributeFound) {
- OrmPersistentAttribute ormPersistentAttribute = addSpecifiedPersistentAttribute(resourceMapping);
- fireItemAdded(ATTRIBUTES_LIST, specifiedAttributesSize(), ormPersistentAttribute);
- }
- resourceIndex++;
- }
- }
- for (OrmPersistentAttribute contextAttribute : contextAttributesToRemove) {
- removeSpecifiedPersistentAttribute_(contextAttribute);
- }
- //first handle adding/removing of the persistent attributes, then update the others last,
- //this causes less churn in the update process
- for (OrmPersistentAttribute contextAttribute : contextAttributesToUpdate) {
- contextAttribute.update();
- }
+
+ // ********** inheritance **********
+
+ public Iterator<PersistentType> inheritanceHierarchy() {
+ return this.inheritanceHierarchyOf(this);
}
-
- //not firing change notification so this can be reused in initialize and update
- protected OrmPersistentAttribute addSpecifiedPersistentAttribute(XmlAttributeMapping resourceMapping) {
- OrmPersistentAttribute ormPersistentAttribute = buildSpecifiedOrmPersistentAttribute(resourceMapping);
- this.specifiedPersistentAttributes.add(ormPersistentAttribute);
- return ormPersistentAttribute;
+
+ public Iterator<PersistentType> ancestors() {
+ return this.inheritanceHierarchyOf(this.superPersistentType);
}
-
- protected void updateVirtualPersistentAttributes() {
- Collection<OrmPersistentAttribute> contextAttributesToRemove = CollectionTools.collection(virtualAttributes());
- Collection<OrmPersistentAttribute> contextAttributesToUpdate = new ArrayList<OrmPersistentAttribute>();
- int resourceIndex = 0;
-
- Iterator<JavaResourcePersistentAttribute> javaResourceAttributes = this.javaPersistentAttributes();
- for (JavaResourcePersistentAttribute javaResourceAttribute : CollectionTools.iterable(javaResourceAttributes)) {
- OrmPersistentAttribute specifiedAttribute = getSpecifiedAttributeFor(javaResourceAttribute);
- if (specifiedAttribute == null) {
- JavaPersistentAttribute javaAttribute = getJpaFactory().buildJavaPersistentAttribute(this, javaResourceAttribute);
- JavaAttributeMapping javaAttributeMapping = javaAttribute.getMapping();
- if (getMapping().isMetadataComplete()) {
- javaAttributeMapping = javaAttribute.getDefaultMapping();
- }
- boolean contextAttributeFound = false;
- for (OrmPersistentAttribute contextAttribute : contextAttributesToRemove) {
- JavaPersistentAttribute javaPersistentAttribute = contextAttribute.getJavaPersistentAttribute();
- if (javaPersistentAttribute.getResourcePersistentAttribute() == javaResourceAttribute) {
- if (this.valuesAreEqual(contextAttribute.getMappingKey(), javaAttributeMapping.getKey())) {
- //the mapping key would change if metaDataComplete flag changes, rebuild the orm attribute
- moveVirtualPersistentAttribute_(resourceIndex, contextAttribute);
- contextAttributesToRemove.remove(contextAttribute);
- contextAttributesToUpdate.add(contextAttribute);
- contextAttributeFound = true;
- break;
- }
- }
- }
- if (!contextAttributeFound) {
- OrmPersistentAttribute virtualPersistentAttribute = addVirtualPersistentAttribute(javaAttributeMapping);
- fireItemAdded(VIRTUAL_ATTRIBUTES_LIST, virtualAttributesSize() - 1, virtualPersistentAttribute);
- }
- resourceIndex++;
+
+ protected Iterator<PersistentType> inheritanceHierarchyOf(PersistentType start) {
+ // using a chain iterator to traverse up the inheritance tree
+ return new ChainIterator<PersistentType>(start) {
+ @Override
+ protected PersistentType nextLink(PersistentType persistentType) {
+ return persistentType.getSuperPersistentType();
}
- }
-
- for (OrmPersistentAttribute contextAttribute : contextAttributesToRemove) {
- removeVirtualPersistentAttribute(contextAttribute);
- }
- //first handle adding/removing of the persistent attributes, then update the others last,
- //this causes less churn in the update process
- for (OrmPersistentAttribute contextAttribute : contextAttributesToUpdate) {
- contextAttribute.update();
- }
+ };
}
- protected OrmPersistentAttribute addVirtualPersistentAttribute(JavaResourcePersistentAttribute resourceAttribute) {
- JavaPersistentAttribute javaAttribute = getJpaFactory().buildJavaPersistentAttribute(this, resourceAttribute);
-
- JavaAttributeMapping javaAttributeMapping = javaAttribute.getMapping();
- if (getMapping().isMetadataComplete()) {
- javaAttributeMapping = javaAttribute.getDefaultMapping();
- }
- return addVirtualPersistentAttribute(javaAttributeMapping);
+
+ // ********** metamodel **********
+
+ public IFile getMetamodelFile() {
+ return (this.javaPersistentType == null) ? null : this.metamodelSynchronizer.getFile();
}
- //not firing change notification so this can be reused in initialize and update
- protected OrmPersistentAttribute addVirtualPersistentAttribute(JavaAttributeMapping javaAttributeMapping) {
- OrmAttributeMappingDefinition mappingDefintion =
- getMappingFileDefinition().getOrmAttributeMappingDefinition(javaAttributeMapping.getKey());
- XmlAttributeMapping resourceMapping =
- mappingDefintion.buildVirtualResourceMapping(getMapping(), javaAttributeMapping, getXmlContextNodeFactory());
- OrmPersistentAttribute virtualPersistentAttribute = buildVirtualOrmPersistentAttribute(javaAttributeMapping, resourceMapping);
- this.virtualPersistentAttributes.add(virtualPersistentAttribute);
- return virtualPersistentAttribute;
- }
-
- public PersistentAttribute resolveAttribute(String attributeName) {
- Iterator<OrmPersistentAttribute> attributes = attributesNamed(attributeName);
- if (attributes.hasNext()) {
- OrmPersistentAttribute attribute = attributes.next();
- return attributes.hasNext() ? null /* more than one */: attribute;
- }
- return (this.superPersistentType == null) ? null : this.superPersistentType.resolveAttribute(attributeName);
+ public void initializeMetamodel() {
+ // do nothing - probably shouldn't be called...
}
- @Override
- public void postUpdate() {
- super.postUpdate();
+ /**
+ * All orm.xml persistent types must be able to generate a static metamodel
+ * because 1.0 orm.xml files can be referenced from 2.0 persistence.xml files.
+ */
+ public void synchronizeMetamodel() {
if (this.javaPersistentType != null) {
- this.javaPersistentType.postUpdate();
- }
- getMapping().postUpdate();
- for (PersistentAttribute attribute : CollectionTools.iterable(attributes())) {
- attribute.postUpdate();
+ this.metamodelSynchronizer.synchronize();
}
}
+ public void disposeMetamodel() {
+ // do nothing - probably shouldn't be called...
+ }
+
+
+ // ********** JpaStructureNode implementation **********
+
+ public String getId() {
+ return OrmStructureNodes.PERSISTENT_TYPE_ID;
+ }
+
public JpaStructureNode getStructureNode(int textOffset) {
- for (OrmPersistentAttribute attribute : CollectionTools.iterable(specifiedAttributes())) {
+ for (OrmPersistentAttribute attribute : this.getSpecifiedAttributes()) {
if (attribute.contains(textOffset)) {
return attribute;
}
}
return this;
}
-
- public boolean contains(int textOffset) {
- return this.typeMapping.containsOffset(textOffset);
- }
-
+
public TextRange getSelectionTextRange() {
- return this.typeMapping.getSelectionTextRange();
+ return this.mapping.getSelectionTextRange();
+ }
+
+ public void dispose() {
+ if (this.javaPersistentType != null) {
+ this.javaPersistentType.dispose();
+ }
}
-
- //******************** validation **********************
-
+
+
+ // ********** PersistentType.Owner implementation **********
+
+ public AccessType getOverridePersistentTypeAccess() {
+ if (this.specifiedAccess != null) {
+ return this.specifiedAccess;
+ }
+
+ if (this.superPersistentType instanceof OrmPersistentType) {
+ AccessType accessType = ((OrmPersistentType) this.superPersistentType).getSpecifiedAccess();
+ if (accessType != null) {
+ return accessType;
+ }
+ }
+
+ if (this.mapping.isMetadataComplete()) {
+ AccessType accessType = this.getOwnerDefaultAccess();
+ if (accessType != null) {
+ return accessType;
+ }
+ }
+
+ // no override access type
+ return null;
+ }
+
+ public AccessType getDefaultPersistentTypeAccess() {
+ if (this.superPersistentType instanceof OrmPersistentType) {
+ AccessType accessType = ((OrmPersistentType) this.superPersistentType).getDefaultAccess();
+ if (accessType != null) {
+ return accessType;
+ }
+ }
+
+ return this.getOwnerDefaultAccess();
+ }
+
+
+ // ********** validation **********
+
@Override
public void validate(List<IMessage> messages, IReporter reporter) {
super.validate(messages, reporter);
@@ -938,7 +869,7 @@ public class GenericOrmPersistentType
this.validateMapping(messages, reporter);
this.validateAttributes(messages, reporter);
}
-
+
protected void validateClass(List<IMessage> messages) {
if (this.javaPersistentType == null) {
messages.add(
@@ -947,7 +878,7 @@ public class GenericOrmPersistentType
JpaValidationMessages.PERSISTENT_TYPE_UNRESOLVED_CLASS,
new String[] {this.getName()},
this,
- this.getMapping().getClassTextRange()
+ this.mapping.getClassTextRange()
)
);
}
@@ -955,18 +886,18 @@ public class GenericOrmPersistentType
protected void validateMapping(List<IMessage> messages, IReporter reporter) {
try {
- this.typeMapping.validate(messages, reporter);
+ this.mapping.validate(messages, reporter);
} catch(Throwable t) {
JptCorePlugin.log(t);
}
}
-
+
protected void validateAttributes(List<IMessage> messages, IReporter reporter) {
for (Iterator<OrmPersistentAttribute> stream = this.attributes(); stream.hasNext(); ) {
this.validateAttribute(stream.next(), messages, reporter);
}
}
-
+
protected void validateAttribute(OrmPersistentAttribute attribute, List<IMessage> messages, IReporter reporter) {
try {
attribute.validate(messages, reporter);
@@ -974,15 +905,64 @@ public class GenericOrmPersistentType
JptCorePlugin.log(t);
}
}
-
+
public TextRange getValidationTextRange() {
- return this.typeMapping.getValidationTextRange();
+ return this.mapping.getValidationTextRange();
}
-
- public void dispose() {
- if (this.javaPersistentType != null) {
- this.javaPersistentType.dispose();
+
+
+ // ********** misc **********
+
+ @Override
+ public EntityMappings getParent() {
+ return (EntityMappings) super.getParent();
+ }
+
+ public String getDefaultPackage() {
+ return this.getEntityMappings().getDefaultPersistentTypePackage();
+ }
+
+ public boolean isDefaultMetadataComplete() {
+ return this.getEntityMappings().isDefaultPersistentTypeMetadataComplete();
+ }
+
+ public boolean isFor(String typeName) {
+ String className = this.getName();
+ if (className == null) {
+ return false;
+ }
+ if (className.equals(typeName)) {
+ return true;
+ }
+ String defaultPackage = this.getDefaultPackage();
+ if (defaultPackage == null) {
+ return false;
}
+ return (defaultPackage + '.' + className).equals(typeName);
+ }
+
+ public boolean contains(int textOffset) {
+ return this.mapping.containsOffset(textOffset);
+ }
+
+ public void classChanged(String oldClass, String newClass) {
+ this.firePropertyChanged(NAME_PROPERTY, oldClass, newClass);
+ }
+
+ public boolean isMapped() {
+ return true;
+ }
+
+ public String getMappingKey() {
+ return this.mapping.getKey();
+ }
+
+ protected EntityMappings getEntityMappings() {
+ return this.getParent();
+ }
+
+ protected XmlTypeMapping getResourceTypeMapping() {
+ return this.mapping.getResourceTypeMapping();
}
@Override
@@ -990,4 +970,89 @@ public class GenericOrmPersistentType
sb.append(this.getName());
}
+
+ // ********** specified persistent attribute owner **********
+
+ protected class SpecifiedAttributeOwner
+ implements OrmPersistentAttribute.Owner
+ {
+ private JavaPersistentAttribute cachedJavaPersistentAttribute;
+
+ public SpecifiedAttributeOwner() {
+ super();
+ }
+
+ public JavaPersistentAttribute findJavaPersistentAttribute(OrmPersistentAttribute ormPersistentAttribute) {
+ if (GenericOrmPersistentType.this.javaPersistentType == null) {
+ return null;
+ }
+ String ormName = ormPersistentAttribute.getName();
+ if (ormName == null) {
+ return null;
+ }
+ AccessType ormAccess = ormPersistentAttribute.getAccess();
+
+ JavaPersistentAttribute javaPersistentAttribute = this.findExistingJavaPersistentAttribute(ormName);
+ if ((javaPersistentAttribute != null) && (javaPersistentAttribute.getAccess() == ormAccess)) {
+ this.cachedJavaPersistentAttribute = null; // we only want to cache the persistent attribute if we build it
+ return javaPersistentAttribute;
+ }
+
+ // if 'javaPersistentAttribute' is null, it might exist in a superclass that is not persistent, we need to build it ourselves.
+ // if access is different, we won't be able to find the corresponding java persistent attribute, it won't exist so we build it ourselves
+ return this.buildJavaPersistentAttribute(ormName, ormAccess);
+ }
+
+ protected JavaPersistentAttribute findExistingJavaPersistentAttribute(String attributeName) {
+ return GenericOrmPersistentType.this.javaPersistentType.getAttributeNamed(attributeName);
+ }
+
+ protected JavaPersistentAttribute buildJavaPersistentAttribute(String ormName, AccessType ormAccess) {
+ JavaResourcePersistentAttribute jrpa = this.getJavaResourcePersistentAttribute(this.getJavaResourcePersistentType(), ormName, ormAccess);
+ if (this.cachedJavaPersistentAttribute != null &&
+ this.cachedJavaPersistentAttribute.getResourcePersistentAttribute() == jrpa) {
+ return this.cachedJavaPersistentAttribute;
+ }
+ return this.cachedJavaPersistentAttribute = (jrpa == null) ? null : GenericOrmPersistentType.this.buildJavaPersistentAttribute(jrpa);
+ }
+
+ protected JavaResourcePersistentType getJavaResourcePersistentType() {
+ return GenericOrmPersistentType.this.javaPersistentType.getResourcePersistentType();
+ }
+
+ protected JavaResourcePersistentAttribute getJavaResourcePersistentAttribute(JavaResourcePersistentType javaResourcePersistentType, String ormName, AccessType ormAccess) {
+ for (Iterator<JavaResourcePersistentAttribute> stream = this.attributes(javaResourcePersistentType, ormAccess); stream.hasNext(); ) {
+ JavaResourcePersistentAttribute jrpa = stream.next();
+ if (jrpa.getName().equals(ormName)) {
+ return jrpa;
+ }
+ }
+ // climb up inheritance hierarchy
+ String superclassName = javaResourcePersistentType.getSuperclassQualifiedName();
+ if (superclassName == null) {
+ return null;
+ }
+ JavaResourcePersistentType superclass = GenericOrmPersistentType.this.getJavaResourcePersistentType(superclassName);
+ if (superclass == null) {
+ return null;
+ }
+ // recurse
+ return this.getJavaResourcePersistentAttribute(superclass, ormName, ormAccess);
+ }
+
+ protected Iterator<JavaResourcePersistentAttribute> attributes(JavaResourcePersistentType javaResourcePersistentType, AccessType ormAccess) {
+ return (ormAccess == AccessType.PROPERTY) ? javaResourcePersistentType.persistableProperties() : javaResourcePersistentType.persistableFields();
+ }
+
+ public void updateJavaPersistentAttribute() {
+ if (this.cachedJavaPersistentAttribute != null) {
+ this.cachedJavaPersistentAttribute.update();
+ }
+ //else {
+ //don't update, we don't own the java persistent attribute,
+ //it will be updated through the java context model
+ //}
+ }
+ }
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistence.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistence.java
index 3956937faa..b0acb96a34 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistence.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistence.java
@@ -9,23 +9,25 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.jpa1.context.persistence;
-import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
+
import org.eclipse.jpt.core.JpaStructureNode;
import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.persistence.Persistence;
import org.eclipse.jpt.core.context.persistence.PersistenceStructureNodes;
import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.core.context.persistence.PersistenceXml;
import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceXmlContextNode;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.core.jpa2.context.persistence.Persistence2_0;
+import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceUnit2_0;
import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.core.resource.persistence.XmlPersistence;
import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
import org.eclipse.jpt.core.utility.TextRange;
-import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
+import org.eclipse.jpt.utility.internal.iterables.SingleElementIterable;
import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
import org.eclipse.jpt.utility.internal.iterators.SingleElementListIterator;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -33,12 +35,12 @@ import org.eclipse.wst.validation.internal.provisional.core.IReporter;
public class GenericPersistence
extends AbstractPersistenceXmlContextNode
- implements Persistence
+ implements Persistence2_0
{
protected XmlPersistence xmlPersistence;
- // the implementation here is a single persistence unit, although the API
- // is for a list. we will want to support multiple persistence units soon.
+ // The implementation here is a single persistence unit, although the API
+ // is for a list. We want to support multiple persistence units someday....
protected PersistenceUnit persistenceUnit;
public GenericPersistence(PersistenceXml parent, XmlPersistence xmlPersistence) {
@@ -69,6 +71,14 @@ public class GenericPersistence
protected ListIterator<PersistenceUnit> persistenceUnits_() {
return new SingleElementListIterator<PersistenceUnit>(this.persistenceUnit);
}
+
+ protected Iterable<PersistenceUnit> getPersistenceUnits() {
+ return (this.persistenceUnit == null) ? EmptyIterable.<PersistenceUnit>instance() : this.getPersistenceUnits_();
+ }
+
+ protected Iterable<PersistenceUnit> getPersistenceUnits_() {
+ return new SingleElementIterable<PersistenceUnit>(this.persistenceUnit);
+ }
public int persistenceUnitsSize() {
return (this.persistenceUnit == null) ? 0 : 1;
@@ -118,14 +128,28 @@ public class GenericPersistence
fireItemRemoved(PERSISTENCE_UNITS_LIST, 0, oldPersistenceUnit);
}
+
// **************** metamodel **********************************
+ public void initializeMetamodel() {
+ for (PersistenceUnit pu : this.getPersistenceUnits()) {
+ ((PersistenceUnit2_0) pu).initializeMetamodel();
+ }
+ }
+
public void synchronizeMetamodel() {
- for (Iterator<PersistenceUnit> stream = this.persistenceUnits(); stream.hasNext(); ) {
- stream.next().synchronizeMetamodel();
+ for (PersistenceUnit pu : this.getPersistenceUnits()) {
+ ((PersistenceUnit2_0) pu).synchronizeMetamodel();
+ }
+ }
+
+ public void disposeMetamodel() {
+ for (PersistenceUnit pu : this.getPersistenceUnits()) {
+ ((PersistenceUnit2_0) pu).disposeMetamodel();
}
}
+
// **************** updating ***********************************************
protected void initializePersistenceUnits() {
@@ -178,7 +202,7 @@ public class GenericPersistence
}
public JpaStructureNode getStructureNode(int textOffset) {
- for (PersistenceUnit pu : CollectionTools.iterable(persistenceUnits())) {
+ for (PersistenceUnit pu : this.getPersistenceUnits()) {
if (pu.containsOffset(textOffset)) {
return pu.getStructureNode(textOffset);
}
@@ -199,7 +223,7 @@ public class GenericPersistence
}
public void dispose() {
- for (PersistenceUnit pu : CollectionTools.iterable(persistenceUnits())) {
+ for (PersistenceUnit pu : this.getPersistenceUnits()) {
pu.dispose();
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceXml.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceXml.java
index 6dfadbfdc6..e116d31f3e 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceXml.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceXml.java
@@ -18,10 +18,11 @@ import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.context.JpaRootContextNode;
import org.eclipse.jpt.core.context.persistence.Persistence;
import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceXml;
import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceXmlContextNode;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.core.jpa2.context.persistence.Persistence2_0;
+import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceXml2_0;
import org.eclipse.jpt.core.resource.persistence.XmlPersistence;
import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
import org.eclipse.jpt.core.utility.TextRange;
@@ -30,7 +31,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IReporter;
public class GenericPersistenceXml
extends AbstractPersistenceXmlContextNode
- implements PersistenceXml
+ implements PersistenceXml2_0
{
protected JpaXmlResource persistenceXmlResource;
@@ -89,13 +90,26 @@ public class GenericPersistenceXml
// **************** metamodel ********************
-
+
+ public void initializeMetamodel() {
+ if (this.persistence != null) {
+ ((Persistence2_0) this.persistence).initializeMetamodel();
+ }
+ }
+
public void synchronizeMetamodel() {
if (this.persistence != null) {
- this.persistence.synchronizeMetamodel();
+ ((Persistence2_0) this.persistence).synchronizeMetamodel();
}
}
-
+
+ public void disposeMetamodel() {
+ if (this.persistence != null) {
+ ((Persistence2_0) this.persistence).disposeMetamodel();
+ }
+ }
+
+
// **************** updating ***********************************************
//TODO I haven't yet figured out if we do not need the resource object passed in now.
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericJpaFactory2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericJpaFactory2_0.java
index 874eb7f1fb..e6fee8da8a 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericJpaFactory2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericJpaFactory2_0.java
@@ -35,9 +35,7 @@ import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaPersistentAttr
import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaPersistentType2_0;
import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaSequenceGenerator2_0;
import org.eclipse.jpt.core.internal.jpa2.context.java.VirtualAssociationOverride2_0Annotation;
-import org.eclipse.jpt.core.jpa2.JpaProject2_0;
-import org.eclipse.jpt.core.jpa2.MetamodelSynchronizer;
-import org.eclipse.jpt.core.jpa2.PersistentTypeMetamodelSynchronizer;
+import org.eclipse.jpt.core.jpa2.context.PersistentType2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaCacheable2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaCacheableHolder2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaDerivedId2_0;
@@ -68,13 +66,8 @@ public class GenericJpaFactory2_0
// ********** Core Model **********
@Override
- public MetamodelSynchronizer buildMetamodelSynchronizer(JpaProject2_0 jpaProject) {
- return new GenericMetamodelSynchronizer(jpaProject);
- }
-
- @Override
- public PersistentTypeMetamodelSynchronizer buildPersistentTypeMetamodelSynchronizer(PersistentTypeMetamodelSynchronizer.Owner owner, PersistentType persistentType) {
- return new GenericPersistentTypeMetamodelSynchronizer(owner, persistentType);
+ public PersistentType2_0.MetamodelSynchronizer buildPersistentTypeMetamodelSynchronizer(PersistentType2_0 persistentType) {
+ return new GenericPersistentTypeMetamodelSynchronizer(persistentType);
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericMetamodelSynchronizer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericMetamodelSynchronizer.java
deleted file mode 100644
index b9c186e645..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericMetamodelSynchronizer.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2;
-
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
-import org.eclipse.jpt.core.jpa2.JpaProject2_0;
-import org.eclipse.jpt.core.jpa2.PersistentTypeMetamodelSynchronizer;
-import org.eclipse.jpt.core.jpa2.MetamodelSynchronizer;
-
-/**
- *
- */
-public class GenericMetamodelSynchronizer
- implements MetamodelSynchronizer, PersistentTypeMetamodelSynchronizer.Owner
-{
- protected final JpaProject2_0 jpaProject;
-
- public GenericMetamodelSynchronizer(JpaProject2_0 jpaProject) {
- super();
- this.jpaProject = jpaProject;
- }
-
- protected JpaFactory2_0 getJpaFactory() {
- return (JpaFactory2_0) this.jpaProject.getJpaPlatform().getJpaFactory();
- }
-
- public void synchronize(PersistentType persistentType) {
- this.buildPersistentTypeMetamodelSynchronizer(persistentType).synchronize();
- }
-
- protected PersistentTypeMetamodelSynchronizer buildPersistentTypeMetamodelSynchronizer(PersistentType persistentType) {
- return this.getJpaFactory().buildPersistentTypeMetamodelSynchronizer(this, persistentType);
- }
-
- public IPackageFragmentRoot getSourceFolder() {
- return this.jpaProject.getMetamodelPackageFragmentRoot();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericPersistentTypeMetamodelSynchronizer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericPersistentTypeMetamodelSynchronizer.java
index 0a15a514e3..a0253c63cf 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericPersistentTypeMetamodelSynchronizer.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericPersistentTypeMetamodelSynchronizer.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.core.internal.jpa2;
import java.io.PrintWriter;
+import java.io.Serializable;
import java.io.StringWriter;
import java.util.Comparator;
import java.util.Date;
@@ -19,17 +20,21 @@ import java.util.Map;
import java.util.TreeSet;
import java.util.Map.Entry;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.ISourceReference;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.context.AttributeMapping;
import org.eclipse.jpt.core.context.PersistentAttribute;
import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.jpa2.PersistentTypeMetamodelSynchronizer;
+import org.eclipse.jpt.core.jpa2.JpaProject2_0;
import org.eclipse.jpt.core.jpa2.context.AttributeMapping2_0;
import org.eclipse.jpt.core.jpa2.context.MetamodelField;
+import org.eclipse.jpt.core.jpa2.context.PersistentType2_0;
import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.utility.Filter;
import org.eclipse.jpt.utility.internal.ClassTools;
import org.eclipse.jpt.utility.internal.CollectionTools;
@@ -41,98 +46,141 @@ import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
import com.ibm.icu.text.Collator;
import com.ibm.icu.text.DateFormat;
+import com.ibm.icu.text.SimpleDateFormat;
/**
- *
+ * For now, the "synchronization" is simple brute-force: we generate the source
+ * code and then compare it with what is already present in the file.
+ * If the new source is different, we replace the file contents; otherwise, we
+ * leave the file unchanged.
*/
@SuppressWarnings("nls")
public class GenericPersistentTypeMetamodelSynchronizer
- implements PersistentTypeMetamodelSynchronizer
+ implements PersistentType2_0.MetamodelSynchronizer
{
- protected final Owner owner;
- protected final PersistentType persistentType;
- protected final String metamodelClassName;
+ protected final PersistentType2_0 persistentType;
- public GenericPersistentTypeMetamodelSynchronizer(Owner owner, PersistentType persistentType) {
+ public GenericPersistentTypeMetamodelSynchronizer(PersistentType2_0 persistentType) {
super();
- this.owner = owner;
this.persistentType = persistentType;
- this.metamodelClassName = this.buildMetamodelClassName();
}
- // TODO
- protected String buildMetamodelClassName() {
- return this.buildMetamodelClassName(this.persistentType.getName());
+ public IFile getFile() {
+ return (IFile) this.getPackageFragment().getCompilationUnit(this.getFileName()).getResource();
}
- protected String buildMetamodelClassName(String className) {
- return className + '_';
- }
- // TODO
- protected String getPackageName() {
- return ClassTools.packageNameForClassNamed(this.metamodelClassName);
- }
-
- protected IPackageFragment buildPackageFragment() {
- IPackageFragmentRoot sourceFolder = this.owner.getSourceFolder();
- String pkgName = this.getPackageName();
- IPackageFragment packageFragment = sourceFolder.getPackageFragment(pkgName);
- if (packageFragment.exists()) {
- return packageFragment;
- }
- try {
- return sourceFolder.createPackageFragment(pkgName, true, null);
- } catch (JavaModelException ex) {
- throw new RuntimeException(ex);
- }
- }
+ // ********** synchronize **********
public void synchronize() {
try {
this.synchronize_();
} catch (JavaModelException ex) {
- throw new RuntimeException(ex);
+ JptCorePlugin.log(ex);
}
}
protected void synchronize_() throws JavaModelException {
- IPackageFragment pkg = this.buildPackageFragment();
- String fileName = ClassTools.shortNameForClassNamed(this.metamodelClassName) + ".java";
-
- ISourceReference oldSourceRef = pkg.getCompilationUnit(fileName);
- String oldSource = oldSourceRef.exists() ? oldSourceRef.getSource() : null;
-
- if (oldSource == null) { // write a new file
+ IPackageFragment pkg = this.getPackageFragment();
+ String fileName = this.getFileName();
+
+ ICompilationUnit compilationUnit = pkg.getCompilationUnit(fileName);
+ if (compilationUnit.exists()) {
+ // overwrite existing file if it has changed (ignoring the timestamp)
+ String newSource = this.buildSource(compilationUnit.getSource());
+ if (newSource != null) {
+ pkg.createCompilationUnit(fileName, newSource, true, null); // true=force
+ }
+ } else {
+ // write a new file, creating the package folders if necessary
+ if ( ! pkg.exists()) {
+ this.getSourceFolder().createPackageFragment(pkg.getElementName(), true, null); // true=force
+ }
pkg.createCompilationUnit(fileName, this.buildSource(), false, null); // false=no force
- return;
}
+ }
+
+ /**
+ * return null if the old source should not be replaced
+ */
+ protected String buildSource(String oldSource) {
+ int oldLength = oldSource.length();
- int oldBegin = oldSource.indexOf(DALI_TAG);
- if (oldBegin == -1) {
- return;
+ int oldDateBegin = oldSource.indexOf(DATE_TAG);
+ if (oldDateBegin == -1) {
+ return null; // hmmm...
}
- oldBegin += DALI_TAG_LENGTH;
+ oldDateBegin += DATE_TAG_LENGTH;
- int oldEnd = oldSource.indexOf('"', oldBegin);
- if (oldEnd == -1) {
- return;
+ int oldDateEnd = oldSource.indexOf('"', oldDateBegin);
+ if (oldDateEnd == -1) {
+ return null; // hmmm...
}
- String oldSource2 = oldSource.replace(oldSource.substring(oldBegin, oldEnd), "");
String newSource = this.buildSource();
- int newBegin = newSource.indexOf(DALI_TAG) + DALI_TAG_LENGTH;
- int newEnd = newSource.indexOf('"', newBegin);
- String newSource2 = newSource.replace(newSource.substring(newBegin, newEnd), "");
+ int newLength = newSource.length();
+ if (newLength != oldLength) {
+ return newSource;
+ }
+
+ int newDateBegin = newSource.indexOf(DATE_TAG) + DATE_TAG_LENGTH;
+ if (newDateBegin != oldDateBegin) {
+ return newSource;
+ }
- if ( ! newSource2.equals(oldSource2)) { // replace the old file
- pkg.createCompilationUnit(fileName, newSource, true, null);
+ int newDateEnd = newSource.indexOf('"', newDateBegin);
+ if (newDateEnd != oldDateEnd) {
+ return newSource;
}
+
+ if (newSource.regionMatches(0, oldSource, 0, oldDateBegin) &&
+ newSource.regionMatches(oldDateEnd, oldSource, oldDateEnd, oldLength - oldDateEnd)) {
+ return null;
+ }
+ return newSource;
+ }
+
+ protected static final String DATE_TAG = "date=\"";
+ protected static final int DATE_TAG_LENGTH = DATE_TAG.length();
+
+
+ // ********** package/file **********
+
+ protected IPackageFragment getPackageFragment() {
+ return this.getSourceFolder().getPackageFragment(this.getPackageName());
}
- protected static final String DALI_TAG = "@Generated(\"Dali";
- protected static final int DALI_TAG_LENGTH = DALI_TAG.length();
+ protected IPackageFragmentRoot getSourceFolder() {
+ return this.getJpaProject().getMetamodelPackageFragmentRoot();
+ }
+
+ protected JpaProject2_0 getJpaProject() {
+ return (JpaProject2_0) this.persistentType.getJpaProject();
+ }
+
+ // TODO
+ protected String getPackageName() {
+ // the default is to store the metamodel in the same package as the model
+ return ClassTools.packageNameForClassNamed(this.getMetamodelClassName());
+ }
+
+ protected String getFileName() {
+ return ClassTools.shortNameForClassNamed(this.getMetamodelClassName()) + ".java";
+ }
+
+ // TODO
+ protected String getMetamodelClassName() {
+ return this.buildMetamodelClassName(this.persistentType.getName());
+ }
+
+ protected String buildMetamodelClassName(String className) {
+ // the default is to simply append an underscore to the model class name
+ return className + '_';
+ }
+
+
+ // ********** source code **********
/**
* build the "body" source first; then build the "package" and "imports" source
@@ -150,7 +198,7 @@ public class GenericPersistentTypeMetamodelSynchronizer
}
protected BodySourceWriter buildBodySourceWriter() {
- BodySourceWriter pw = new BodySourceWriter(this.getPackageName(), this.metamodelClassName);
+ BodySourceWriter pw = new BodySourceWriter(this.getPackageName(), this.getMetamodelClassName());
this.printBodySourceOn(pw);
return pw;
}
@@ -176,7 +224,7 @@ public class GenericPersistentTypeMetamodelSynchronizer
this.printStaticMetamodelAnnotationOn(pw);
pw.print("public class ");
- pw.printTypeDeclaration(this.metamodelClassName);
+ pw.printTypeDeclaration(this.getMetamodelClassName());
PersistentType superPersistentType = this.persistentType.getSuperPersistentType();
if (superPersistentType != null) {
pw.print(" extends ");
@@ -193,15 +241,30 @@ public class GenericPersistentTypeMetamodelSynchronizer
pw.println();
}
- // TODO - comment?
protected void printGeneratedAnnotationOn(BodySourceWriter pw) {
pw.printAnnotation("javax.annotation.Generated");
pw.print('(');
- pw.printStringLiteral("Dali" + ' ' + DateFormat.getDateTimeInstance().format(new Date()));
+ pw.print("value=");
+ pw.printStringLiteral(JavaResourcePersistentType.METAMODEL_GENERATED_ANNOTATION_VALUE);
+ pw.print(", ");
+ pw.print("date=");
+ pw.printStringLiteral(format(new Date()));
pw.print(')');
pw.println();
}
+ /**
+ * {@link SimpleDateFormat} is not thread-safe.
+ */
+ protected static synchronized String format(Date date) {
+ return DATE_FORMAT.format(date);
+ }
+ /**
+ * Recommended date format is ISO 8601.
+ * @see javax.annotation.Generated
+ */
+ private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
+
// ********** attributes **********
@@ -466,7 +529,7 @@ public class GenericPersistentTypeMetamodelSynchronizer
protected static final Comparator<Map.Entry<String, ImportPackage>> IMPORT_ENTRIES_COMPARATOR = new ImportEntriesComparator();
protected static class ImportEntriesComparator
- implements Comparator<Map.Entry<String, ImportPackage>>
+ implements Comparator<Map.Entry<String, ImportPackage>>, Serializable
{
public int compare(Map.Entry<String, ImportPackage> e1, Map.Entry<String, ImportPackage> e2) {
Collator collator = Collator.getInstance();
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/NullMetamodelSynchronizer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/NullMetamodelSynchronizer.java
deleted file mode 100644
index c05847a5da..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/NullMetamodelSynchronizer.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2;
-
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.jpa2.MetamodelSynchronizer;
-
-/**
- *
- */
-public class NullMetamodelSynchronizer
- implements MetamodelSynchronizer
-{
- // singleton
- private static final NullMetamodelSynchronizer INSTANCE = new NullMetamodelSynchronizer();
-
- /**
- * Return the singleton.
- */
- public static MetamodelSynchronizer instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private NullMetamodelSynchronizer() {
- super();
- }
-
- public void synchronize(PersistentType persistentType) {
- // NOP
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/NullPersistentTypeMetamodelSynchronizer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/NullPersistentTypeMetamodelSynchronizer.java
deleted file mode 100644
index 4029e293fc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/NullPersistentTypeMetamodelSynchronizer.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2;
-
-import org.eclipse.jpt.core.jpa2.PersistentTypeMetamodelSynchronizer;
-
-/**
- *
- */
-public class NullPersistentTypeMetamodelSynchronizer
- implements PersistentTypeMetamodelSynchronizer
-{
-
-
- public NullPersistentTypeMetamodelSynchronizer() {
- super();
- }
-
- public void synchronize() {
- //no-op
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java
index 5353afb931..a7af52ccb4 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java
@@ -9,6 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.jpa2.context.java;
+import java.util.Vector;
+
import org.eclipse.jpt.core.context.FetchType;
import org.eclipse.jpt.core.context.Fetchable;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
@@ -17,7 +19,6 @@ import org.eclipse.jpt.core.jpa2.MappingKeys2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaElementCollectionMapping2_0;
import org.eclipse.jpt.core.jpa2.resource.java.ElementCollection2_0Annotation;
import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.utility.internal.ArrayTools;
public class GenericJavaElementCollectionMapping2_0
@@ -53,28 +54,26 @@ public class GenericJavaElementCollectionMapping2_0
}
@Override
- protected String[] buildSupportingAnnotationNames() {
- return ArrayTools.addAll(
- super.buildSupportingAnnotationNames(),
- JPA.ASSOCIATION_OVERRIDE,
- JPA.ASSOCIATION_OVERRIDES,
- JPA.ATTRIBUTE_OVERRIDE,
- JPA.ATTRIBUTE_OVERRIDES,
- //JPA2_0.COLLECTION_TABLE,
- JPA.COLUMN,
- JPA.ENUMERATED,
- JPA.LOB,
- JPA.MAP_KEY,
- //JPA2_0.MAP_KEY_CLASS,
- //JPA2_0.MAP_KEY_COLUMN,
- //JPA2_0.MAP_KEY_ENUMERATED,
- //JPA2_0.MAP_KEY_JOIN_COLUMN,
- //JPA2_0.MAP_KEY_JOIN_COLUMNS,
- //JPA2_0.MAP_KEY_TEMPORAL,
- JPA.ORDER_BY,
- //JPA2_0.ORDER_COLUMN,
- JPA.TEMPORAL
- );
+ protected void addSupportingAnnotationNamesTo(Vector<String> names) {
+ super.addSupportingAnnotationNamesTo(names);
+ names.add(JPA.ASSOCIATION_OVERRIDE);
+ names.add(JPA.ASSOCIATION_OVERRIDES);
+ names.add(JPA.ATTRIBUTE_OVERRIDE);
+ names.add(JPA.ATTRIBUTE_OVERRIDES);
+// names.add(JPA2_0.COLLECTION_TABLE);
+ names.add(JPA.COLUMN);
+ names.add(JPA.ENUMERATED);
+ names.add(JPA.LOB);
+ names.add(JPA.MAP_KEY);
+// names.add(JPA2_0.MAP_KEY_CLASS);
+// names.add(JPA2_0.MAP_KEY_COLUMN);
+// names.add(JPA2_0.MAP_KEY_ENUMERATED);
+// names.add(JPA2_0.MAP_KEY_JOIN_COLUMN);
+// names.add(JPA2_0.MAP_KEY_JOIN_COLUMNS);
+// names.add(JPA2_0.MAP_KEY_TEMPORAL);
+ names.add(JPA.ORDER_BY);
+// names.add(JPA2_0.ORDER_COLUMN);
+ names.add(JPA.TEMPORAL);
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java
index 9fb85d3e20..62848905c9 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java
@@ -11,32 +11,41 @@ package org.eclipse.jpt.core.internal.jpa2.context.java;
import java.util.Iterator;
+import org.eclipse.core.resources.IFile;
import org.eclipse.jpt.core.context.AccessType;
import org.eclipse.jpt.core.context.PersistentType;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaPersistentType;
-import org.eclipse.jpt.core.jpa2.JpaProject2_0;
+import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
+import org.eclipse.jpt.core.jpa2.context.PersistentType2_0;
+import org.eclipse.jpt.core.jpa2.context.java.JavaPersistentType2_0;
import org.eclipse.jpt.core.jpa2.resource.java.Access2_0Annotation;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+/**
+ * JPA 2.0 Java persistent type.
+ * Support for specified access and metamodel generation.
+ */
public class GenericJavaPersistentType2_0
extends AbstractJavaPersistentType
+ implements JavaPersistentType2_0
{
+ protected final PersistentType2_0.MetamodelSynchronizer metamodelSynchronizer;
+
public GenericJavaPersistentType2_0(PersistentType.Owner parent, JavaResourcePersistentType jrpt) {
super(parent, jrpt);
+ this.metamodelSynchronizer = this.buildMetamodelSynchronizer();
}
-
- /**
- * covariant override
- */
- @Override
- public JpaProject2_0 getJpaProject() {
- return (JpaProject2_0) super.getJpaProject();
+
+ protected PersistentType2_0.MetamodelSynchronizer buildMetamodelSynchronizer() {
+ return ((JpaFactory2_0) this.getJpaFactory()).buildPersistentTypeMetamodelSynchronizer(this);
}
-
+
+
+ // ********** access **********
+
protected Access2_0Annotation getAccessAnnotation() {
- return (Access2_0Annotation) this.resourcePersistentType.
- getNonNullAnnotation(getAccessAnnotationName());
+ return (Access2_0Annotation) this.resourcePersistentType.getNonNullAnnotation(this.getAccessAnnotationName());
}
protected String getAccessAnnotationName() {
@@ -45,7 +54,7 @@ public class GenericJavaPersistentType2_0
@Override
protected AccessType buildSpecifiedAccess() {
- return this.getResourceAccess();
+ return AccessType.fromJavaResourceModel(this.getAccessAnnotation().getValue());
}
public void setSpecifiedAccess(AccessType specifiedAccess) {
@@ -63,19 +72,34 @@ public class GenericJavaPersistentType2_0
@Override
protected Iterator<JavaResourcePersistentAttribute> resourceAttributes() {
- return (this.specifiedAccess == null)
- ? super.resourceAttributes()
- : this.resourcePersistentType.persistableAttributes(AccessType.toJavaResourceModel(this.specifiedAccess));
+ return (this.specifiedAccess == null) ?
+ super.resourceAttributes() :
+ this.resourcePersistentType.persistableAttributes(AccessType.toJavaResourceModel(this.specifiedAccess));
}
@Override
public void updateAccess() {
super.updateAccess();
- this.setSpecifiedAccess_(this.getResourceAccess());
+ this.setSpecifiedAccess_(this.buildSpecifiedAccess());
}
- protected AccessType getResourceAccess() {
- return AccessType.fromJavaResourceModel(this.getAccessAnnotation().getValue());
+
+ // ********** metamodel **********
+
+ public IFile getMetamodelFile() {
+ return this.metamodelSynchronizer.getFile();
+ }
+
+ public void initializeMetamodel() {
+ // do nothing - probably shouldn't be called...
+ }
+
+ public void synchronizeMetamodel() {
+ this.metamodelSynchronizer.synchronize();
+ }
+
+ public void disposeMetamodel() {
+ // do nothing - probably shouldn't be called...
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java
new file mode 100644
index 0000000000..42a60a11a5
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryGeneratedAnnotation;
+import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceGeneratedAnnotation;
+import org.eclipse.jpt.core.jpa2.resource.java.GeneratedAnnotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.core.utility.jdt.Type;
+
+/**
+ * javax.annotation.Generated
+ * <p>
+ * This annotation definition is not really required; it's just here for a bit
+ * of consistency....
+ */
+public final class GeneratedAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final GeneratedAnnotationDefinition INSTANCE = new GeneratedAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static GeneratedAnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private GeneratedAnnotationDefinition() {
+ super();
+ }
+
+ public GeneratedAnnotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
+ return new SourceGeneratedAnnotation((JavaResourcePersistentType) parent, (Type) member);
+ }
+
+ public GeneratedAnnotation buildNullAnnotation(JavaResourcePersistentMember parent) {
+ return null;
+ }
+
+ public GeneratedAnnotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ return new BinaryGeneratedAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return GeneratedAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java
new file mode 100644
index 0000000000..76686e5815
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.core.internal.jpa2.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryStaticMetamodelAnnotation;
+import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceStaticMetamodelAnnotation;
+import org.eclipse.jpt.core.jpa2.resource.java.StaticMetamodelAnnotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.core.utility.jdt.Type;
+
+/**
+ * javax.persistence.metamodel.StaticMetamodel
+ * <p>
+ * This annotation definition is not really required; it's just here for a bit
+ * of consistency....
+ */
+public final class StaticMetamodelAnnotationDefinition
+ implements AnnotationDefinition
+{
+ // singleton
+ private static final StaticMetamodelAnnotationDefinition INSTANCE = new StaticMetamodelAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static StaticMetamodelAnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private StaticMetamodelAnnotationDefinition() {
+ super();
+ }
+
+ public StaticMetamodelAnnotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
+ return new SourceStaticMetamodelAnnotation((JavaResourcePersistentType) parent, (Type) member);
+ }
+
+ public StaticMetamodelAnnotation buildNullAnnotation(JavaResourcePersistentMember parent) {
+ return null;
+ }
+
+ public StaticMetamodelAnnotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ return new BinaryStaticMetamodelAnnotation((JavaResourcePersistentType) parent, jdtAnnotation);
+ }
+
+ public String getAnnotationName() {
+ return StaticMetamodelAnnotation.ANNOTATION_NAME;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java
new file mode 100644
index 0000000000..7454a7336a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
+
+import java.util.ListIterator;
+import java.util.Vector;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.jpa2.resource.java.GeneratedAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+
+/**
+ * javax.annotation.Generated
+ */
+public final class BinaryGeneratedAnnotation
+ extends BinaryAnnotation
+ implements GeneratedAnnotation
+{
+ private final Vector<String> values;
+ private String date;
+ private String comments;
+
+
+ public BinaryGeneratedAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.values = this.buildValues();
+ this.date = this.buildDate();
+ this.comments = this.buildComments();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.updateValues();
+ this.setDate_(this.buildDate());
+ this.setComments_(this.buildComments());
+ }
+
+ // TODO
+ private void updateValues() {
+ throw new UnsupportedOperationException();
+ }
+
+
+ // ********** GeneratedAnnotation implementation **********
+
+ // ***** values
+ public ListIterator<String> values() {
+ return new CloneListIterator<String>(this.values);
+ }
+
+ public int valuesSize() {
+ return this.values.size();
+ }
+
+ private Vector<String> buildValues() {
+ Object[] jdtValues = this.getJdtMemberValues(VALUE_ELEMENT_NAME);
+ Vector<String> result = new Vector<String>(jdtValues.length);
+ for (Object value : jdtValues) {
+ result.add((String) value);
+ }
+ return result;
+ }
+
+ public void addValue(String value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void addValue(int index, String value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void moveValue(int targetIndex, int sourceIndex) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeValue(String value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void removeValue(int index) {
+ throw new UnsupportedOperationException();
+ }
+
+ // ***** date
+ public String getDate() {
+ return this.date;
+ }
+
+ public void setDate(String date) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setDate_(String date) {
+ String old = this.date;
+ this.date = date;
+ this.firePropertyChanged(DATE_PROPERTY, old, date);
+ }
+
+ private String buildDate() {
+ return (String) this.getJdtMemberValue(DATE_ELEMENT_NAME);
+ }
+
+ // ***** comments
+ public String getComments() {
+ return this.comments;
+ }
+
+ public void setComments(String comments) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setComments_(String comments) {
+ String old = this.comments;
+ this.comments = comments;
+ this.firePropertyChanged(COMMENTS_PROPERTY, old, comments);
+ }
+
+ private String buildComments() {
+ return (String) this.getJdtMemberValue(COMMENTS_ELEMENT_NAME);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java
new file mode 100644
index 0000000000..caa427c79b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
+import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.core.jpa2.resource.java.StaticMetamodelAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+
+/**
+ * javax.persistence.metamodel.StaticMetamodel
+ */
+public final class BinaryStaticMetamodelAnnotation
+ extends BinaryAnnotation
+ implements StaticMetamodelAnnotation
+{
+ private String value;
+
+
+ public BinaryStaticMetamodelAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
+ super(parent, jdtAnnotation);
+ this.value = this.buildValue();
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ @Override
+ public void update() {
+ super.update();
+ this.setValue_(this.buildValue());
+ }
+
+
+ // ********** StaticMetamodelAnnotation implementation **********
+
+ // ***** value
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ throw new UnsupportedOperationException();
+ }
+
+ private void setValue_(String value) {
+ String old = this.value;
+ this.value = value;
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ this.firePropertyChanged(FULLY_QUALIFIED_CLASS_NAME_PROPERTY, old, value);
+ }
+
+ private String buildValue() {
+ return (String) this.getJdtMemberValue(JPA2_0.STATIC_METAMODEL__VALUE);
+ }
+
+ // ***** fully-qualified class name
+ /**
+ * binary is already fully-qualified
+ */
+ public String getFullyQualifiedClassName() {
+ return this.value;
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java
new file mode 100644
index 0000000000..1bd2b22915
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java
@@ -0,0 +1,206 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
+
+import java.util.Arrays;
+import java.util.ListIterator;
+import java.util.Vector;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.AnnotationStringArrayExpressionConverter;
+import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitArrayAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.jpa2.resource.java.GeneratedAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.ExpressionConverter;
+import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.Type;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+
+/**
+ * javax.annotation.Generated
+ */
+public final class SourceGeneratedAnnotation
+ extends SourceAnnotation<Type>
+ implements GeneratedAnnotation
+{
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter<String[]> VALUE_ADAPTER = buildValueAdapter();
+ private final AnnotationElementAdapter<String[]> valueAdapter;
+ private final Vector<String> values = new Vector<String>();
+
+ private static final DeclarationAnnotationElementAdapter<String> DATE_ADAPTER = buildAdapter(DATE_ELEMENT_NAME);
+ private final AnnotationElementAdapter<String> dateAdapter;
+ private String date;
+
+ private static final DeclarationAnnotationElementAdapter<String> COMMENTS_ADAPTER = buildAdapter(COMMENTS_ELEMENT_NAME);
+ private final AnnotationElementAdapter<String> commentsAdapter;
+ private String comments;
+
+
+ public SourceGeneratedAnnotation(JavaResourcePersistentType parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = this.buildAnnotationElementAdapter(VALUE_ADAPTER);
+ this.dateAdapter = this.buildAdapter(DATE_ADAPTER);
+ this.commentsAdapter = this.buildAdapter(COMMENTS_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ private AnnotationElementAdapter<String[]> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String[]> daea) {
+ return new ShortCircuitArrayAnnotationElementAdapter<String>(this.member, daea);
+ }
+
+ private AnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationElementAdapter<String> daea) {
+ return new ShortCircuitAnnotationElementAdapter<String>(this.member, daea);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.initializeValues(astRoot);
+ this.date = this.buildDate(astRoot);
+ this.comments = this.buildComments(astRoot);
+ }
+
+ public void update(CompilationUnit astRoot) {
+ this.updateValues(astRoot);
+ }
+
+ public IndexedAnnotationAdapter getIndexedAnnotationAdapter() {
+ return (IndexedAnnotationAdapter) this.annotationAdapter;
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.values);
+ }
+
+
+ // ********** GeneratedAnnotation implementation **********
+
+ // ***** values
+ public ListIterator<String> values() {
+ return new CloneListIterator<String>(this.values);
+ }
+
+ public int valuesSize() {
+ return this.values.size();
+ }
+
+ public void addValue(String value) {
+ this.addValue(this.values.size(), value);
+ }
+
+ public void addValue(int index, String value) {
+ this.addValue_(index, value);
+ this.valueAdapter.setValue(this.values.toArray(new String[this.values.size()]));
+ }
+
+ private void addValue_(int index, String value) {
+ this.addItemToList(index, value, this.values, VALUES_LIST);
+ }
+
+ public void moveValue(int targetIndex, int sourceIndex) {
+ this.moveItemInList(targetIndex, sourceIndex, this.values, VALUES_LIST);
+ this.valueAdapter.setValue(this.values.toArray(new String[this.values.size()]));
+ }
+
+ public void removeValue(String value) {
+ this.removeItemFromList(value, this.values, VALUES_LIST);
+ this.valueAdapter.setValue(this.values.toArray(new String[this.values.size()]));
+ }
+
+ public void removeValue(int index) {
+ this.removeItemFromList(index, this.values, VALUES_LIST);
+ this.valueAdapter.setValue(this.values.toArray(new String[this.values.size()]));
+ }
+
+ private void initializeValues(CompilationUnit astRoot) {
+ String[] javaValues = this.valueAdapter.getValue(astRoot);
+ for (int i = 0; i < javaValues.length; i++) {
+ this.values.add(javaValues[i]);
+ }
+ }
+
+ private void updateValues(CompilationUnit astRoot) {
+ String[] javaValues = this.valueAdapter.getValue(astRoot);
+ this.synchronizeList(Arrays.asList(javaValues), this.values, VALUES_LIST);
+ }
+
+ // ***** date
+ public String getDate() {
+ return this.date;
+ }
+
+ public void setDate(String date) {
+ if (this.attributeValueHasNotChanged(this.date, date)) {
+ return;
+ }
+ String old = this.date;
+ this.date = date;
+ this.dateAdapter.setValue(date);
+ this.firePropertyChanged(DATE_PROPERTY, old, date);
+ }
+
+ private String buildDate(CompilationUnit astRoot) {
+ return this.dateAdapter.getValue(astRoot);
+ }
+
+ // ***** comments
+ public String getComments() {
+ return this.comments;
+ }
+
+ public void setComments(String comments) {
+ if (this.attributeValueHasNotChanged(this.comments, comments)) {
+ return;
+ }
+ String old = this.date;
+ this.comments = comments;
+ this.commentsAdapter.setValue(comments);
+ this.firePropertyChanged(COMMENTS_PROPERTY, old, comments);
+ }
+
+ private String buildComments(CompilationUnit astRoot) {
+ return this.commentsAdapter.getValue(astRoot);
+ }
+
+
+ // ********** static methods **********
+
+ protected static DeclarationAnnotationElementAdapter<String[]> buildValueAdapter() {
+ return buildArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, VALUE_ELEMENT_NAME);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String[]> buildArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ return buildArrayAnnotationElementAdapter(annotationAdapter, elementName, AnnotationStringArrayExpressionConverter.forStrings());
+ }
+
+ private static DeclarationAnnotationElementAdapter<String[]> buildArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String[]> converter) {
+ return new ConversionDeclarationAnnotationElementAdapter<String[]>(annotationAdapter, elementName, false, converter);
+ }
+
+ protected static DeclarationAnnotationElementAdapter<String> buildAdapter(String elementName) {
+ return buildAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName);
+ }
+
+ static DeclarationAnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(annotationAdapter, elementName);
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java
new file mode 100644
index 0000000000..bab8473fef
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.JDTTools;
+import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
+import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
+import org.eclipse.jpt.core.jpa2.resource.java.StaticMetamodelAnnotation;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.Type;
+
+/**
+ * javax.persistence.metamodel.StaticMetamodel
+ */
+public final class SourceStaticMetamodelAnnotation
+ extends SourceAnnotation<Type>
+ implements StaticMetamodelAnnotation
+{
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter();
+ private final AnnotationElementAdapter<String> valueAdapter;
+ private String value;
+
+ private String fullyQualifiedClassName;
+
+
+ public SourceStaticMetamodelAnnotation(JavaResourcePersistentType parent, Type type) {
+ super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = new ShortCircuitAnnotationElementAdapter<String>(type, VALUE_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.value = this.buildValue(astRoot);
+ this.fullyQualifiedClassName = this.buildFullyQualifiedClassName(astRoot);
+ }
+
+ public void update(CompilationUnit astRoot) {
+ this.setValue(this.buildValue(astRoot));
+ this.setFullyQualifiedClassName(this.buildFullyQualifiedClassName(astRoot));
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.value);
+ }
+
+
+ // ********** StaticMetamodelAnnotation implementation **********
+
+ // ***** value
+ public String getValue() {
+ return this.value;
+ }
+
+ public void setValue(String value) {
+ if (this.attributeValueHasNotChanged(this.value, value)) {
+ return;
+ }
+ String old = this.value;
+ this.value = value;
+ this.valueAdapter.setValue(value);
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ private String buildValue(CompilationUnit astRoot) {
+ return this.valueAdapter.getValue(astRoot);
+ }
+
+ // ***** fully-qualified class name
+ public String getFullyQualifiedClassName() {
+ return this.fullyQualifiedClassName;
+ }
+
+ private void setFullyQualifiedClassName(String fullyQualifiedClassName) {
+ String old = this.fullyQualifiedClassName;
+ this.fullyQualifiedClassName = fullyQualifiedClassName;
+ this.firePropertyChanged(FULLY_QUALIFIED_CLASS_NAME_PROPERTY, old, fullyQualifiedClassName);
+ }
+
+ private String buildFullyQualifiedClassName(CompilationUnit astRoot) {
+ return (this.value == null) ? null : JDTTools.resolveFullyQualifiedName(this.valueAdapter.getExpression(astRoot));
+ }
+
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() {
+ return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.STATIC_METAMODEL__VALUE, SimpleTypeStringExpressionConverter.instance());
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentMember.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentMember.java
index c8676f67c6..41892b9c4f 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentMember.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentMember.java
@@ -264,8 +264,7 @@ abstract class BinaryPersistentMember
throw new UnsupportedOperationException();
}
- public Annotation setPrimaryAnnotation(
- String primaryAnnotationName, String[] supportingAnnotationNames) {
+ public Annotation setPrimaryAnnotation(String primaryAnnotationName, Iterable<String> supportingAnnotationNames) {
throw new UnsupportedOperationException();
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentType.java
index 0ad5c16718..b0aeffd4d4 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentType.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentType.java
@@ -16,6 +16,7 @@ import org.eclipse.jdt.core.Flags;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jpt.core.JptCorePlugin;
@@ -540,4 +541,12 @@ final class BinaryPersistentType
throw new UnsupportedOperationException();
}
+ public boolean isGeneratedMetamodel(IPackageFragmentRoot sourceFolder) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isGeneratedMetamodel() {
+ throw new UnsupportedOperationException();
+ }
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentAttribute.java
index 2b75bc6e99..fead1ebddb 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentAttribute.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentAttribute.java
@@ -157,13 +157,11 @@ final class SourcePersistentAttribute
@Override
Annotation buildAnnotation(String annotationName) {
- return this.getAnnotationProvider().
- buildAttributeAnnotation(this, this.member, annotationName);
+ return this.getAnnotationProvider().buildAttributeAnnotation(this, this.member, annotationName);
}
Annotation buildNullAnnotation_(String annotationName) {
- return this.getAnnotationProvider().
- buildNullAttributeAnnotation(this, annotationName);
+ return this.getAnnotationProvider().buildNullAttributeAnnotation(this, annotationName);
}
public boolean isFor(MethodSignature signature, int occurrence) {
@@ -191,11 +189,14 @@ final class SourcePersistentAttribute
}
public AccessType getSpecifiedAccess() {
- Access2_0Annotation accessAnnotation =
- (Access2_0Annotation) getAnnotation(Access2_0Annotation.ANNOTATION_NAME);
+ Access2_0Annotation accessAnnotation = this.getAccessAnnotation();
return (accessAnnotation == null) ? null : accessAnnotation.getValue();
}
+ private Access2_0Annotation getAccessAnnotation() {
+ return (Access2_0Annotation) this.getAnnotation(Access2_0Annotation.ANNOTATION_NAME);
+ }
+
public boolean typeIsSubTypeOf(String tn) {
if (this.typeName == null) {
return false;
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentMember.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentMember.java
index a0ea958697..6fc6b5b38c 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentMember.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentMember.java
@@ -9,7 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.resource.java.source;
-import java.util.Collections;
+import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
@@ -31,7 +31,6 @@ import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
import org.eclipse.jpt.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.core.utility.jdt.Member;
-import org.eclipse.jpt.utility.internal.ArrayTools;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
@@ -72,13 +71,19 @@ abstract class SourcePersistentMember<E extends Member>
}
/**
- * called from InitialAnnotationVisitor
+ * called from {@link InitialAnnotationVisitor}
*/
- void addInitialAnnotation(org.eclipse.jdt.core.dom.Annotation node, CompilationUnit astRoot) {
+ /* private */ void addInitialAnnotation(org.eclipse.jdt.core.dom.Annotation node, CompilationUnit astRoot) {
String jdtAnnotationName = JDTTools.resolveAnnotation(node);
- if (jdtAnnotationName == null) {
- return;
+ if (jdtAnnotationName != null) {
+ this.addInitialAnnotation(jdtAnnotationName, astRoot);
}
+ }
+
+ /**
+ * pre-condition: jdtAnnotationName is not null
+ */
+ void addInitialAnnotation(String jdtAnnotationName, CompilationUnit astRoot) {
if (this.annotationIsValid(jdtAnnotationName)) {
if (this.selectAnnotationNamed(this.annotations, jdtAnnotationName) == null) { // ignore duplicates
Annotation annotation = this.buildAnnotation(jdtAnnotationName);
@@ -95,7 +100,7 @@ abstract class SourcePersistentMember<E extends Member>
return this.getAnnotations().iterator();
}
- private Iterable<Annotation> getAnnotations() {
+ Iterable<Annotation> getAnnotations() {
return new LiveCloneIterable<Annotation>(this.annotations);
}
@@ -112,15 +117,12 @@ abstract class SourcePersistentMember<E extends Member>
return (annotation != null) ? annotation : this.buildNullAnnotation(annotationName);
}
- public Iterator<NestableAnnotation> annotations(
- String nestableAnnotationName, String containerAnnotationName) {
- ContainerAnnotation<NestableAnnotation> containerAnnotation =
- this.getContainerAnnotation(containerAnnotationName);
+ public Iterator<NestableAnnotation> annotations(String nestableAnnotationName, String containerAnnotationName) {
+ ContainerAnnotation<NestableAnnotation> containerAnnotation = this.getContainerAnnotation(containerAnnotationName);
if (containerAnnotation != null) {
return containerAnnotation.nestedAnnotations();
}
- NestableAnnotation nestableAnnotation =
- getNestableAnnotation(nestableAnnotationName);
+ NestableAnnotation nestableAnnotation = this.getNestableAnnotation(nestableAnnotationName);
if (nestableAnnotation != null) {
return new SingleElementIterator<NestableAnnotation>(nestableAnnotation);
}
@@ -130,7 +132,7 @@ abstract class SourcePersistentMember<E extends Member>
// minimize scope of suppressed warnings
@SuppressWarnings("unchecked")
private ContainerAnnotation<NestableAnnotation> getContainerAnnotation(String annotationName) {
- return (ContainerAnnotation<NestableAnnotation>) getAnnotation(annotationName);
+ return (ContainerAnnotation<NestableAnnotation>) this.getAnnotation(annotationName);
}
private NestableAnnotation getNestableAnnotation(String annotationName) {
@@ -164,16 +166,13 @@ abstract class SourcePersistentMember<E extends Member>
* add a container annotation and move the stand-alone nested annotation to it
* and add a new nested annotation to it also
*/
- public NestableAnnotation addAnnotation(
- int index, String nestableAnnotationName, String containerAnnotationName) {
- ContainerAnnotation<NestableAnnotation> containerAnnotation =
- getContainerAnnotation(containerAnnotationName);
+ public NestableAnnotation addAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) {
+ ContainerAnnotation<NestableAnnotation> containerAnnotation = this.getContainerAnnotation(containerAnnotationName);
if (containerAnnotation != null) {
// ignore any stand-alone nestable annotations and just add to the container annotation
return AnnotationContainerTools.addNestedAnnotation(index, containerAnnotation);
}
- NestableAnnotation standAloneAnnotation =
- getNestableAnnotation(nestableAnnotationName);
+ NestableAnnotation standAloneAnnotation = this.getNestableAnnotation(nestableAnnotationName);
if (standAloneAnnotation == null) {
// add a stand-alone nestable annotation since neither the nestable nor the container exist
return (NestableAnnotation) this.addAnnotation(nestableAnnotationName);
@@ -191,10 +190,8 @@ abstract class SourcePersistentMember<E extends Member>
* place when the context model gets an "update" and looks at the resource
* model to determine what has changed
*/
- private NestableAnnotation addSecondNestedAnnotation(
- int index, String containerAnnotationName, NestableAnnotation standAloneAnnotation) {
- ContainerAnnotation<NestableAnnotation> containerAnnotation =
- buildContainerAnnotation(containerAnnotationName);
+ private NestableAnnotation addSecondNestedAnnotation(int index, String containerAnnotationName, NestableAnnotation standAloneAnnotation) {
+ ContainerAnnotation<NestableAnnotation> containerAnnotation = this.buildContainerAnnotation(containerAnnotationName);
this.annotations.add(containerAnnotation);
containerAnnotation.newAnnotation();
@@ -216,19 +213,16 @@ abstract class SourcePersistentMember<E extends Member>
return (index == 0) ? nestedAnnotation0 : nestedAnnotation1;
}
- public void moveAnnotation(
- int targetIndex, int sourceIndex, String containerAnnotationName) {
- moveAnnotation(targetIndex, sourceIndex, getContainerAnnotation(containerAnnotationName));
+ public void moveAnnotation(int targetIndex, int sourceIndex, String containerAnnotationName) {
+ this.moveAnnotation(targetIndex, sourceIndex, this.getContainerAnnotation(containerAnnotationName));
}
- private void moveAnnotation(
- int targetIndex, int sourceIndex,
- ContainerAnnotation<NestableAnnotation> containerAnnotation) {
+ private void moveAnnotation(int targetIndex, int sourceIndex, ContainerAnnotation<NestableAnnotation> containerAnnotation) {
AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, containerAnnotation);
}
public void removeAnnotation(String annotationName) {
- Annotation annotation = getAnnotation(annotationName);
+ Annotation annotation = this.getAnnotation(annotationName);
if (annotation != null) {
this.removeAnnotation(annotation);
}
@@ -240,15 +234,12 @@ abstract class SourcePersistentMember<E extends Member>
this.fireItemRemoved(ANNOTATIONS_COLLECTION, annotation);
}
- public void removeAnnotation(
- int index, String nestableAnnotationName, String containerAnnotationName) {
- ContainerAnnotation<NestableAnnotation> containerAnnotation =
- getContainerAnnotation(containerAnnotationName);
+ public void removeAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) {
+ ContainerAnnotation<NestableAnnotation> containerAnnotation = this.getContainerAnnotation(containerAnnotationName);
if (containerAnnotation == null) { // assume the index is 0
- removeAnnotation(getAnnotation(nestableAnnotationName));
- }
- else {
- removeAnnotation(index, containerAnnotation);
+ this.removeAnnotation(this.getAnnotation(nestableAnnotationName));
+ } else {
+ this.removeAnnotation(index, containerAnnotation);
}
}
@@ -257,8 +248,7 @@ abstract class SourcePersistentMember<E extends Member>
* either remove the container (if it is empty) or convert the last nested
* annotation to a stand-alone annotation
*/
- private void removeAnnotation(
- int index, ContainerAnnotation<NestableAnnotation> containerAnnotation) {
+ private void removeAnnotation(int index, ContainerAnnotation<NestableAnnotation> containerAnnotation) {
AnnotationContainerTools.removeNestedAnnotation(index, containerAnnotation);
switch (containerAnnotation.nestedAnnotationsSize()) {
case 0:
@@ -281,14 +271,12 @@ abstract class SourcePersistentMember<E extends Member>
* place when the context model gets an "update" and looks at the resource
* model to determine what has changed
*/
- private void convertLastNestedAnnotation(
- ContainerAnnotation<NestableAnnotation> containerAnnotation) {
+ private void convertLastNestedAnnotation(ContainerAnnotation<NestableAnnotation> containerAnnotation) {
NestableAnnotation lastNestedAnnotation = containerAnnotation.nestedAnnotations().next();
annotations.remove(containerAnnotation);
containerAnnotation.removeAnnotation();
- NestableAnnotation standAloneAnnotation =
- buildNestableAnnotation(lastNestedAnnotation.getAnnotationName());
+ NestableAnnotation standAloneAnnotation = this.buildNestableAnnotation(lastNestedAnnotation.getAnnotationName());
this.annotations.add(standAloneAnnotation);
standAloneAnnotation.newAnnotation();
this.fireItemRemoved(ANNOTATIONS_COLLECTION, containerAnnotation);
@@ -296,26 +284,26 @@ abstract class SourcePersistentMember<E extends Member>
standAloneAnnotation.initializeFrom(lastNestedAnnotation);
}
- public Annotation setPrimaryAnnotation(
- String primaryAnnotationName, String[] supportingAnnotationNames) {
- Annotation newPrimaryAnnotation = null;
- String[] annotationNamesToKeep = supportingAnnotationNames;
+ public Annotation setPrimaryAnnotation(String primaryAnnotationName, Iterable<String> supportingAnnotationNames) {
+ ArrayList<String> annotationNames = new ArrayList<String>();
+ CollectionTools.addAll(annotationNames, supportingAnnotationNames);
if (primaryAnnotationName != null) {
- annotationNamesToKeep = ArrayTools.add(supportingAnnotationNames, primaryAnnotationName);
+ annotationNames.add(primaryAnnotationName);
}
- for (Annotation existingAnnotation : getAnnotations()) {
- if (! ArrayTools.contains(annotationNamesToKeep, existingAnnotation.getAnnotationName())) {
- this.annotations.remove(existingAnnotation);
- existingAnnotation.removeAnnotation();
+ for (Annotation annotation : this.getAnnotations()) {
+ if ( ! CollectionTools.contains(annotationNames, annotation.getAnnotationName())) {
+ this.annotations.remove(annotation);
+ annotation.removeAnnotation();
}
}
- if (primaryAnnotationName != null && getAnnotation(primaryAnnotationName) == null) {
- newPrimaryAnnotation = buildAnnotation(primaryAnnotationName);
+ Annotation newPrimaryAnnotation = null;
+ if ((primaryAnnotationName != null) && (this.getAnnotation(primaryAnnotationName) == null)) {
+ newPrimaryAnnotation = this.buildAnnotation(primaryAnnotationName);
this.annotations.add(newPrimaryAnnotation);
newPrimaryAnnotation.newAnnotation();
}
// fire collection change event after all annotation changes are done
- fireCollectionChanged(ANNOTATIONS_COLLECTION, Collections.unmodifiableCollection(this.annotations));
+ this.fireCollectionChanged(ANNOTATIONS_COLLECTION, this.annotations);
return newPrimaryAnnotation;
}
@@ -332,12 +320,11 @@ abstract class SourcePersistentMember<E extends Member>
// minimize scope of suppressed warnings
@SuppressWarnings("unchecked")
private ContainerAnnotation<NestableAnnotation> buildContainerAnnotation(String annotationName) {
- return (ContainerAnnotation<NestableAnnotation>) buildAnnotation(annotationName);
+ return (ContainerAnnotation<NestableAnnotation>) this.buildAnnotation(annotationName);
}
- @SuppressWarnings("unchecked")
private NestableAnnotation buildNestableAnnotation(String annotationName) {
- return (NestableAnnotation) buildAnnotation(annotationName);
+ return (NestableAnnotation) this.buildAnnotation(annotationName);
}
@@ -386,45 +373,47 @@ abstract class SourcePersistentMember<E extends Member>
}
private void updateAnnotations(CompilationUnit astRoot) {
- HashSet<Annotation> annotationsToRemove =
- new HashSet<Annotation>(this.annotations);
+ HashSet<Annotation> annotationsToRemove = new HashSet<Annotation>(this.annotations);
- this.member.getBodyDeclaration(astRoot).accept(
- this.buildUpdateAnnotationVisitor(astRoot, annotationsToRemove));
+ this.member.getBodyDeclaration(astRoot).accept(this.buildUpdateAnnotationVisitor(astRoot, annotationsToRemove));
for (Annotation annotation : annotationsToRemove) {
this.removeItemFromCollection(annotation, this.annotations, ANNOTATIONS_COLLECTION);
}
}
- private ASTVisitor buildUpdateAnnotationVisitor(
- CompilationUnit astRoot, Set<Annotation> annotationsToRemove) {
- return new UpdateAnnotationVisitor(
- astRoot, this.member.getBodyDeclaration(astRoot), annotationsToRemove);
+ private ASTVisitor buildUpdateAnnotationVisitor(CompilationUnit astRoot, Set<Annotation> annotationsToRemove) {
+ return new UpdateAnnotationVisitor(astRoot, this.member.getBodyDeclaration(astRoot), annotationsToRemove);
}
- void addOrUpdateAnnotation(
- org.eclipse.jdt.core.dom.Annotation node, CompilationUnit astRoot,
- Set<Annotation> annotationsToRemove) {
+ /**
+ * called from {@link UpdateAnnotationVisitor}
+ */
+ /* private */ void addOrUpdateAnnotation(org.eclipse.jdt.core.dom.Annotation node, CompilationUnit astRoot, Set<Annotation> annotationsToRemove) {
String jdtAnnotationName = JDTTools.resolveAnnotation(node);
- if (jdtAnnotationName == null) {
- return;
+ if (jdtAnnotationName != null) {
+ this.addOrUpdateAnnotation(jdtAnnotationName, astRoot, annotationsToRemove);
}
+ }
+
+ /**
+ * pre-condition: jdtAnnotationName is not null
+ */
+ void addOrUpdateAnnotation(String jdtAnnotationName, CompilationUnit astRoot, Set<Annotation> annotationsToRemove) {
if (this.annotationIsValid(jdtAnnotationName)) {
- this.addOrUpdateAnnotation(jdtAnnotationName, astRoot, annotationsToRemove);
- return;
+ this.addOrUpdateAnnotation_(jdtAnnotationName, astRoot, annotationsToRemove);
}
}
- private void addOrUpdateAnnotation(
- String jdtAnnotationName, CompilationUnit astRoot,
- Set<Annotation> annotationsToRemove) {
+ /**
+ * pre-condition: jdtAnnotationName is valid
+ */
+ private void addOrUpdateAnnotation_(String jdtAnnotationName, CompilationUnit astRoot, Set<Annotation> annotationsToRemove) {
Annotation annotation = this.selectAnnotationNamed(annotationsToRemove, jdtAnnotationName);
if (annotation != null) {
annotation.update(astRoot);
annotationsToRemove.remove(annotation);
- }
- else {
+ } else {
annotation = this.buildAnnotation(jdtAnnotationName);
annotation.initialize(astRoot);
this.addItemToCollection(annotation, this.annotations, ANNOTATIONS_COLLECTION);
@@ -438,8 +427,8 @@ abstract class SourcePersistentMember<E extends Member>
this.setPersistable(this.buildPersistable(astRoot));
}
- private Annotation selectAnnotationNamed(Iterable<Annotation> annotations, String annotationName) {
- for (Annotation annotation : annotations) {
+ private Annotation selectAnnotationNamed(Iterable<Annotation> list, String annotationName) {
+ for (Annotation annotation : list) {
if (annotation.getAnnotationName().equals(annotationName)) {
return annotation;
}
@@ -533,17 +522,14 @@ abstract class SourcePersistentMember<E extends Member>
{
protected final Set<Annotation> annotationsToRemove;
- protected UpdateAnnotationVisitor(
- CompilationUnit astRoot, BodyDeclaration bodyDeclaration,
- Set<Annotation> annotationsToRemove) {
+ protected UpdateAnnotationVisitor(CompilationUnit astRoot, BodyDeclaration bodyDeclaration, Set<Annotation> annotationsToRemove) {
super(astRoot, bodyDeclaration);
this.annotationsToRemove = annotationsToRemove;
}
@Override
protected void visitChildAnnotation(org.eclipse.jdt.core.dom.Annotation node) {
- SourcePersistentMember.this.addOrUpdateAnnotation(
- node, this.astRoot, this.annotationsToRemove);
+ SourcePersistentMember.this.addOrUpdateAnnotation(node, this.astRoot, this.annotationsToRemove);
}
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentType.java
index f6b399fc95..468917f2ba 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentType.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentType.java
@@ -14,7 +14,11 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Set;
import java.util.Vector;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.FieldDeclaration;
import org.eclipse.jdt.core.dom.ITypeBinding;
@@ -22,9 +26,13 @@ import org.eclipse.jdt.core.dom.MethodDeclaration;
import org.eclipse.jdt.core.dom.Modifier;
import org.eclipse.jdt.core.dom.TypeDeclaration;
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
+import org.eclipse.jpt.core.internal.jpa2.resource.java.GeneratedAnnotationDefinition;
+import org.eclipse.jpt.core.internal.jpa2.resource.java.StaticMetamodelAnnotationDefinition;
import org.eclipse.jpt.core.internal.utility.jdt.JDTTools;
import org.eclipse.jpt.core.internal.utility.jdt.JDTType;
import org.eclipse.jpt.core.internal.utility.jdt.JPTTools;
+import org.eclipse.jpt.core.jpa2.resource.java.GeneratedAnnotation;
+import org.eclipse.jpt.core.jpa2.resource.java.StaticMetamodelAnnotation;
import org.eclipse.jpt.core.resource.java.AccessType;
import org.eclipse.jpt.core.resource.java.Annotation;
import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
@@ -62,6 +70,14 @@ final class SourcePersistentType
private AccessType access;
+ private StaticMetamodelAnnotation staticMetamodelAnnotation;
+
+ private GeneratedAnnotation generatedAnnotation;
+
+
+ private static final StaticMetamodelAnnotationDefinition STATIC_METAMODEL_ANNOTATION_DEFINITION = StaticMetamodelAnnotationDefinition.instance();
+ private static final GeneratedAnnotationDefinition GENERATED_ANNOTATION_DEFINITION = GeneratedAnnotationDefinition.instance();
+
// ********** construction/initialization **********
@@ -124,40 +140,63 @@ final class SourcePersistentType
this.access = this.buildAccess();
}
- private void initializeTypes(CompilationUnit astRoot) {
- TypeDeclaration[] typeDeclarations = this.member.getTypes(astRoot);
- CounterMap counters = new CounterMap(typeDeclarations.length);
- for (TypeDeclaration td : typeDeclarations) {
- String tdName = td.getName().getFullyQualifiedName();
- int occurrence = counters.increment(tdName);
- this.types.add(this.buildType(td, occurrence, astRoot));
+ @Override
+ void addInitialAnnotation(String jdtAnnotationName, CompilationUnit astRoot) {
+ if (jdtAnnotationName.equals(STATIC_METAMODEL_ANNOTATION_DEFINITION.getAnnotationName())) {
+ if (this.staticMetamodelAnnotation == null) { // ignore duplicates
+ this.staticMetamodelAnnotation = STATIC_METAMODEL_ANNOTATION_DEFINITION.buildAnnotation(this, this.member);
+ this.staticMetamodelAnnotation.initialize(astRoot);
+ }
+ } else if (jdtAnnotationName.equals(GENERATED_ANNOTATION_DEFINITION.getAnnotationName())) {
+ if (this.generatedAnnotation == null) { // ignore duplicates
+ this.generatedAnnotation = GENERATED_ANNOTATION_DEFINITION.buildAnnotation(this, this.member);
+ this.generatedAnnotation.initialize(astRoot);
+ }
+ } else {
+ super.addInitialAnnotation(jdtAnnotationName, astRoot);
}
}
- private void initializeFields(CompilationUnit astRoot) {
- FieldDeclaration[] fieldDeclarations = this.member.getFields(astRoot);
- CounterMap counters = new CounterMap(fieldDeclarations.length);
- for (FieldDeclaration fieldDeclaration : fieldDeclarations) {
- for (VariableDeclarationFragment fragment : fragments(fieldDeclaration)) {
- String fieldName = fragment.getName().getFullyQualifiedName();
- int occurrence = counters.increment(fieldName);
- this.fields.add(this.buildField(fieldName, occurrence, astRoot));
- }
- }
+
+ // ********** update **********
+
+ @Override
+ public void update(CompilationUnit astRoot) {
+ super.update(astRoot);
+ this.setName(this.buildName(astRoot));
+ this.setQualifiedName(this.buildQualifiedName(astRoot));
+ this.setSuperclassQualifiedName(this.buildSuperclassQualifiedName(astRoot));
+ this.setAbstract(this.buildAbstract(astRoot));
+ this.updateTypes(astRoot);
+ this.updateFields(astRoot);
+ this.updateMethods(astRoot);
+ // need to wait until everything is built to calculate 'access'
+ this.setAccess(this.buildAccess());
}
- private void initializeMethods(CompilationUnit astRoot) {
- MethodDeclaration[] methodDeclarations = this.member.getMethods(astRoot);
- CounterMap counters = new CounterMap(methodDeclarations.length);
- for (MethodDeclaration methodDeclaration : methodDeclarations) {
- MethodSignature signature = JDTTools.buildMethodSignature(methodDeclaration);
- int occurrence = counters.increment(signature);
- this.methods.add(this.buildMethod(signature, occurrence, astRoot));
+ @Override
+ void addOrUpdateAnnotation(String jdtAnnotationName, CompilationUnit astRoot, Set<Annotation> annotationsToRemove) {
+ if (jdtAnnotationName.equals(STATIC_METAMODEL_ANNOTATION_DEFINITION.getAnnotationName())) {
+ if (this.staticMetamodelAnnotation != null) {
+ this.staticMetamodelAnnotation.update(astRoot);
+ } else {
+ this.staticMetamodelAnnotation = STATIC_METAMODEL_ANNOTATION_DEFINITION.buildAnnotation(this, this.member);
+ this.staticMetamodelAnnotation.initialize(astRoot);
+ }
+ } else if (jdtAnnotationName.equals(GENERATED_ANNOTATION_DEFINITION.getAnnotationName())) {
+ if (this.generatedAnnotation != null) {
+ this.generatedAnnotation.update(astRoot);
+ } else {
+ this.generatedAnnotation = GENERATED_ANNOTATION_DEFINITION.buildAnnotation(this, this.member);
+ this.generatedAnnotation.initialize(astRoot);
+ }
+ } else {
+ super.addOrUpdateAnnotation(jdtAnnotationName, astRoot, annotationsToRemove);
}
}
- // ********** AbstractJavaResourcePersistentMember implementation **********
+ // ********** SourcePersistentMember implementation **********
@Override
Iterator<String> validAnnotationNames() {
@@ -166,14 +205,12 @@ final class SourcePersistentType
@Override
Annotation buildAnnotation(String mappingAnnotationName) {
- return this.getAnnotationProvider().
- buildTypeAnnotation(this, this.member, mappingAnnotationName);
+ return this.getAnnotationProvider().buildTypeAnnotation(this, this.member, mappingAnnotationName);
}
@Override
Annotation buildNullAnnotation(String annotationName) {
- return this.getAnnotationProvider().
- buildNullTypeAnnotation(this, annotationName);
+ return this.getAnnotationProvider().buildNullTypeAnnotation(this, annotationName);
}
@Override
@@ -299,22 +336,27 @@ final class SourcePersistentType
}
public boolean isMapped() {
- for (Annotation each : CollectionTools.iterable(annotations())) {
- if (CollectionTools.contains(
- getAnnotationProvider().typeMappingAnnotationNames(),
- each.getAnnotationName())) {
+ for (Annotation each : this.getAnnotations()) {
+ if (this.annotationIsMappingAnnotation(each)) {
return true;
}
}
return false;
}
+
+ private boolean annotationIsMappingAnnotation(Annotation annotation) {
+ return CollectionTools.contains(this.mappingAnnotationNames(), annotation.getAnnotationName());
+ }
+
+ private Iterator<String> mappingAnnotationNames() {
+ return this.getAnnotationProvider().typeMappingAnnotationNames();
+ }
/**
* check only persistable attributes
*/
public boolean hasAnyAnnotatedAttributes() {
- for (Iterator<JavaResourcePersistentAttribute> stream =
- this.persistableAttributes(); stream.hasNext(); ) {
+ for (Iterator<JavaResourcePersistentAttribute> stream = this.persistableAttributes(); stream.hasNext(); ) {
if (stream.next().isAnnotated()) {
return true;
}
@@ -363,6 +405,39 @@ final class SourcePersistentType
this.removeItemsFromCollection(remove, this.types, TYPES_COLLECTION);
}
+ private void initializeTypes(CompilationUnit astRoot) {
+ TypeDeclaration[] typeDeclarations = this.member.getTypes(astRoot);
+ CounterMap counters = new CounterMap(typeDeclarations.length);
+ for (TypeDeclaration td : typeDeclarations) {
+ String tdName = td.getName().getFullyQualifiedName();
+ int occurrence = counters.increment(tdName);
+ this.types.add(this.buildType(td, occurrence, astRoot));
+ }
+ }
+
+ private void updateTypes(CompilationUnit astRoot) {
+ TypeDeclaration[] typeDeclarations = this.member.getTypes(astRoot);
+ CounterMap counters = new CounterMap(typeDeclarations.length);
+ HashSet<JavaResourcePersistentType> typesToRemove = new HashSet<JavaResourcePersistentType>(this.types);
+ for (TypeDeclaration typeDeclaration : typeDeclarations) {
+ String tdName = typeDeclaration.getName().getFullyQualifiedName();
+ int occurrence = counters.increment(tdName);
+
+ JavaResourcePersistentType type = this.getType(tdName, occurrence);
+ if (type == null) {
+ this.addType(this.buildType(typeDeclaration, occurrence, astRoot));
+ } else {
+ typesToRemove.remove(type);
+ type.update(astRoot);
+ }
+ }
+ this.removeTypes(typesToRemove);
+ }
+
+ private JavaResourcePersistentType buildType(TypeDeclaration nestedTypeDeclaration, int occurrence, CompilationUnit astRoot) {
+ return newInstance(this.getJavaResourceCompilationUnit(), this.member, nestedTypeDeclaration, occurrence, astRoot);
+ }
+
// ********** fields **********
@@ -404,6 +479,43 @@ final class SourcePersistentType
this.removeItemsFromCollection(remove, this.fields, FIELDS_COLLECTION);
}
+ private void initializeFields(CompilationUnit astRoot) {
+ FieldDeclaration[] fieldDeclarations = this.member.getFields(astRoot);
+ CounterMap counters = new CounterMap(fieldDeclarations.length);
+ for (FieldDeclaration fieldDeclaration : fieldDeclarations) {
+ for (VariableDeclarationFragment fragment : fragments(fieldDeclaration)) {
+ String fieldName = fragment.getName().getFullyQualifiedName();
+ int occurrence = counters.increment(fieldName);
+ this.fields.add(this.buildField(fieldName, occurrence, astRoot));
+ }
+ }
+ }
+
+ private void updateFields(CompilationUnit astRoot) {
+ FieldDeclaration[] fieldDeclarations = this.member.getFields(astRoot);
+ CounterMap counters = new CounterMap(fieldDeclarations.length);
+ HashSet<JavaResourcePersistentAttribute> fieldsToRemove = new HashSet<JavaResourcePersistentAttribute>(this.fields);
+ for (FieldDeclaration fieldDeclaration : fieldDeclarations) {
+ for (VariableDeclarationFragment fragment : fragments(fieldDeclaration)) {
+ String fieldName = fragment.getName().getFullyQualifiedName();
+ int occurrence = counters.increment(fieldName);
+
+ JavaResourcePersistentAttribute field = this.getField(fieldName, occurrence);
+ if (field == null) {
+ this.addField(this.buildField(fieldName, occurrence, astRoot));
+ } else {
+ fieldsToRemove.remove(field);
+ field.update(astRoot);
+ }
+ }
+ }
+ this.removeFields(fieldsToRemove);
+ }
+
+ private JavaResourcePersistentAttribute buildField(String fieldName, int occurrence, CompilationUnit astRoot) {
+ return SourcePersistentAttribute.newInstance(this, this.member, fieldName, occurrence, this.getJavaResourceCompilationUnit(), astRoot);
+ }
+
// ********** methods **********
@@ -445,6 +557,39 @@ final class SourcePersistentType
this.removeItemsFromCollection(remove, this.methods, METHODS_COLLECTION);
}
+ private void initializeMethods(CompilationUnit astRoot) {
+ MethodDeclaration[] methodDeclarations = this.member.getMethods(astRoot);
+ CounterMap counters = new CounterMap(methodDeclarations.length);
+ for (MethodDeclaration methodDeclaration : methodDeclarations) {
+ MethodSignature signature = JDTTools.buildMethodSignature(methodDeclaration);
+ int occurrence = counters.increment(signature);
+ this.methods.add(this.buildMethod(signature, occurrence, astRoot));
+ }
+ }
+
+ private void updateMethods(CompilationUnit astRoot) {
+ MethodDeclaration[] methodDeclarations = this.member.getMethods(astRoot);
+ CounterMap counters = new CounterMap(methodDeclarations.length);
+ HashSet<JavaResourcePersistentAttribute> methodsToRemove = new HashSet<JavaResourcePersistentAttribute>(this.methods);
+ for (MethodDeclaration methodDeclaration : methodDeclarations) {
+ MethodSignature signature = JDTTools.buildMethodSignature(methodDeclaration);
+ int occurrence = counters.increment(signature);
+
+ JavaResourcePersistentAttribute method = this.getMethod(signature, occurrence);
+ if (method == null) {
+ this.addMethod(this.buildMethod(signature, occurrence, astRoot));
+ } else {
+ methodsToRemove.remove(method);
+ method.update(astRoot);
+ }
+ }
+ this.removeMethods(methodsToRemove);
+ }
+
+ private JavaResourcePersistentAttribute buildMethod(MethodSignature signature, int occurrence, CompilationUnit astRoot) {
+ return SourcePersistentAttribute.newInstance(this, this.member, signature, occurrence, this.getJavaResourceCompilationUnit(), astRoot);
+ }
+
// ********** attributes **********
@@ -482,96 +627,47 @@ final class SourcePersistentType
}
- // ********** update from Java **********
-
- @Override
- public void update(CompilationUnit astRoot) {
- super.update(astRoot);
- this.setName(this.buildName(astRoot));
- this.setQualifiedName(this.buildQualifiedName(astRoot));
- this.setSuperclassQualifiedName(this.buildSuperclassQualifiedName(astRoot));
- this.setAbstract(this.buildAbstract(astRoot));
- this.updateTypes(astRoot);
- this.updateFields(astRoot);
- this.updateMethods(astRoot);
- // need to wait until everything is built to calculate 'access'
- this.setAccess(this.buildAccess());
- }
-
- private void updateTypes(CompilationUnit astRoot) {
- TypeDeclaration[] typeDeclarations = this.member.getTypes(astRoot);
- CounterMap counters = new CounterMap(typeDeclarations.length);
- HashSet<JavaResourcePersistentType> typesToRemove = new HashSet<JavaResourcePersistentType>(this.types);
- for (TypeDeclaration typeDeclaration : typeDeclarations) {
- String tdName = typeDeclaration.getName().getFullyQualifiedName();
- int occurrence = counters.increment(tdName);
+ // ********** misc **********
- JavaResourcePersistentType type = this.getType(tdName, occurrence);
- if (type == null) {
- this.addType(this.buildType(typeDeclaration, occurrence, astRoot));
- } else {
- typesToRemove.remove(type);
- type.update(astRoot);
- }
+ /**
+ * The type must be:<ul>
+ * <li>in the specified source folder
+ * <li>annotated with <code>&#64;javax.persistence.metamodel.StaticMetamodel</code>
+ * <li>annotated with <code>&#64;javax.annotation.Generated</code> with the appropriate
+ * <code>value</code>
+ * </ul>
+ */
+ public boolean isGeneratedMetamodel(IPackageFragmentRoot sourceFolder) {
+ if ( ! this.getSourceFolder().equals(sourceFolder)) {
+ return false;
}
- this.removeTypes(typesToRemove);
+ return this.isGeneratedMetamodel();
}
- private JavaResourcePersistentType buildType(TypeDeclaration nestedTypeDeclaration, int occurrence, CompilationUnit astRoot) {
- return newInstance(this.getJavaResourceCompilationUnit(), this.member, nestedTypeDeclaration, occurrence, astRoot);
- }
-
- private void updateFields(CompilationUnit astRoot) {
- FieldDeclaration[] fieldDeclarations = this.member.getFields(astRoot);
- CounterMap counters = new CounterMap(fieldDeclarations.length);
- HashSet<JavaResourcePersistentAttribute> fieldsToRemove = new HashSet<JavaResourcePersistentAttribute>(this.fields);
- for (FieldDeclaration fieldDeclaration : fieldDeclarations) {
- for (VariableDeclarationFragment fragment : fragments(fieldDeclaration)) {
- String fieldName = fragment.getName().getFullyQualifiedName();
- int occurrence = counters.increment(fieldName);
-
- JavaResourcePersistentAttribute field = this.getField(fieldName, occurrence);
- if (field == null) {
- this.addField(this.buildField(fieldName, occurrence, astRoot));
- } else {
- fieldsToRemove.remove(field);
- field.update(astRoot);
- }
- }
+ /**
+ * The type must be:<ul>
+ * <li>annotated with <code>&#64;javax.persistence.metamodel.StaticMetamodel</code>
+ * <li>annotated with <code>&#64;javax.annotation.Generated</code> with the appropriate
+ * <code>value</code>
+ * </ul>
+ */
+ public boolean isGeneratedMetamodel() {
+ if (this.staticMetamodelAnnotation == null) {
+ return false;
}
- this.removeFields(fieldsToRemove);
- }
-
- private JavaResourcePersistentAttribute buildField(String fieldName, int occurrence, CompilationUnit astRoot) {
- return SourcePersistentAttribute.newInstance(this, this.member, fieldName, occurrence, this.getJavaResourceCompilationUnit(), astRoot);
- }
-
- private void updateMethods(CompilationUnit astRoot) {
- MethodDeclaration[] methodDeclarations = this.member.getMethods(astRoot);
- CounterMap counters = new CounterMap(methodDeclarations.length);
- HashSet<JavaResourcePersistentAttribute> methodsToRemove = new HashSet<JavaResourcePersistentAttribute>(this.methods);
- for (MethodDeclaration methodDeclaration : methodDeclarations) {
- MethodSignature signature = JDTTools.buildMethodSignature(methodDeclaration);
- int occurrence = counters.increment(signature);
-
- JavaResourcePersistentAttribute method = this.getMethod(signature, occurrence);
- if (method == null) {
- this.addMethod(this.buildMethod(signature, occurrence, astRoot));
- } else {
- methodsToRemove.remove(method);
- method.update(astRoot);
- }
+ if (this.generatedAnnotation == null) {
+ return false;
}
- this.removeMethods(methodsToRemove);
+ if (this.generatedAnnotation.valuesSize() == 0) {
+ return false;
+ }
+ return this.generatedAnnotation.values().next().equals(METAMODEL_GENERATED_ANNOTATION_VALUE);
}
- private JavaResourcePersistentAttribute buildMethod(MethodSignature signature, int occurrence, CompilationUnit astRoot) {
- return SourcePersistentAttribute.newInstance(this, this.member, signature, occurrence, this.getJavaResourceCompilationUnit(), astRoot);
+ private IPackageFragmentRoot getSourceFolder() {
+ return (IPackageFragmentRoot) this.getJavaResourceCompilationUnit().getCompilationUnit().getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
}
-
- // ********** static methods **********
-
// minimize scope of suppressed warnings
@SuppressWarnings("unchecked")
private static List<VariableDeclarationFragment> fragments(FieldDeclaration fd) {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java
index 334eb0b608..6240b36fa4 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java
@@ -41,7 +41,7 @@ public final class SourceUniqueConstraintAnnotation
extends SourceAnnotation<Member>
implements NestableUniqueConstraintAnnotation
{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.UNIQUE_CONSTRAINT);
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
private final DeclarationAnnotationElementAdapter<String[]> columnNamesDeclarationAdapter;
private final AnnotationElementAdapter<String[]> columnNamesAdapter;
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/JpaFactory2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/JpaFactory2_0.java
index 0cd9c0cac3..3f5b218ced 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/JpaFactory2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/JpaFactory2_0.java
@@ -11,10 +11,10 @@ package org.eclipse.jpt.core.jpa2;
import org.eclipse.jpt.core.JpaFactory;
import org.eclipse.jpt.core.context.AssociationOverrideContainer;
-import org.eclipse.jpt.core.context.PersistentType;
import org.eclipse.jpt.core.context.java.JavaAssociationOverrideContainer;
import org.eclipse.jpt.core.context.java.JavaNamedColumn;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.core.jpa2.context.PersistentType2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaCacheable2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaCacheableHolder2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaDerivedId2_0;
@@ -44,9 +44,7 @@ public interface JpaFactory2_0
// ********** Core Model **********
- MetamodelSynchronizer buildMetamodelSynchronizer(JpaProject2_0 jpaProject);
-
- PersistentTypeMetamodelSynchronizer buildPersistentTypeMetamodelSynchronizer(PersistentTypeMetamodelSynchronizer.Owner owner, PersistentType persistentType);
+ PersistentType2_0.MetamodelSynchronizer buildPersistentTypeMetamodelSynchronizer(PersistentType2_0 persistentType);
// ********** Java Context Model **********
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/JpaProject2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/JpaProject2_0.java
index b013c76a24..37e2d7bafc 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/JpaProject2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/JpaProject2_0.java
@@ -11,7 +11,7 @@ package org.eclipse.jpt.core.jpa2;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.context.PersistentType;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
/**
* JPA 2.0 project.
@@ -23,7 +23,7 @@ import org.eclipse.jpt.core.context.PersistentType;
* will almost certainly be broken (repeatedly) as the API evolves.
*/
public interface JpaProject2_0
- extends JpaProject, MetamodelGenerator
+ extends JpaProject, MetamodelSynchronizer
{
// ********** Canonical Metamodel **********
@@ -53,16 +53,17 @@ public interface JpaProject2_0
IPackageFragmentRoot getMetamodelPackageFragmentRoot();
/**
- * Synchronize the source for the metamodel class corresponding to the
- * specified persistent type.
+ * Return a list of the names of the Java source folders. (These
+ * can be used to hold the generated Canonical Metamodel.)
*/
- void synchronizeMetamodel(PersistentType persistentType);
+ Iterable<String> getJavaSourceFolderNames();
/**
- * Return a list of the names of the Java source folders (that
- * can be used to hold the generated Canonical Metamodel).
+ * Return the JPA project's generated metamodel Java resource persistent
+ * types.
+ * @see org.eclipse.jpt.core.internal.resource.java.source.SourcePersistentType#isGeneratedMetamodel(IPackageFragmentRoot)
*/
- Iterable<String> getSourceFolderNames();
+ Iterable<JavaResourcePersistentType> getGeneratedMetamodelTypes();
// ********** construction config **********
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/MetamodelSynchronizer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/MetamodelSynchronizer.java
index cd7ac1be7e..9983a5f9ee 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/MetamodelSynchronizer.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/MetamodelSynchronizer.java
@@ -9,10 +9,35 @@
******************************************************************************/
package org.eclipse.jpt.core.jpa2;
-import org.eclipse.jpt.core.context.PersistentType;
+import java.io.Serializable;
/**
- * JPA 2.0 Canonical Metamodel.
+ * JPA 2.0 Canonical Metamodel synchronizer.
+ * <p>
+ * Notes:
+ * <ul><li>
+ * When a JPA project is first created (e.g. when the user adds the JPA
+ * Facet to a Faceted project or when a workspace containing a JPA project is
+ * opened), if it is configured to generate the
+ * Canonical Metamodel (i.e. its metamodel source folder is non-null), it will
+ * first discover what metamodel classes are already present in the metamodel
+ * source folder. Any class appropriately annotated with
+ * <code>javax.persistence.metamodel.StaticMetamodel</code>
+ * and <code>javax.annotation.Generated</code>
+ * will be added to the Canonical Metamodel
+ * (see {@link org.eclipse.jpt.core.internal.resource.java.source.SourcePersistentType#isGeneratedMetamodel()}).
+ * Once the JPA project's context model is constructed, a new Canonical
+ * Metamodel is generated and merged with the classes already present in the
+ * metamodel source folder.
+ * </li><li>
+ * When a JPA project's metamodel source folder setting is cleared, the Canonical
+ * Metamodel is cleared from the context model, but the generated source files are
+ * left in place.
+ * </li><li>
+ * When a JPA project's metamodel source folder is set to a non-null value,
+ * like when a JPA project is first created, the resulting Canonical Metamodel
+ * will be merged with whatever is already present in the folder.
+ * </li></ul>
* <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -22,6 +47,44 @@ import org.eclipse.jpt.core.context.PersistentType;
*/
public interface MetamodelSynchronizer {
- void synchronize(PersistentType persistentType);
+ void initializeMetamodel();
+
+ void synchronizeMetamodel();
+
+ void disposeMetamodel();
+
+
+ /**
+ * Singleton implemetation of the metamodel synchronizer interface that
+ * does nothing. (Not sure we need this....)
+ */
+ final class Null implements MetamodelSynchronizer, Serializable {
+ public static final MetamodelSynchronizer INSTANCE = new Null();
+ public static MetamodelSynchronizer instance() {
+ return INSTANCE;
+ }
+ // ensure single instance
+ private Null() {
+ super();
+ }
+ public void initializeMetamodel() {
+ // do nothing
+ }
+ public void synchronizeMetamodel() {
+ // do nothing
+ }
+ public void disposeMetamodel() {
+ // do nothing
+ }
+ @Override
+ public String toString() {
+ return "MetamodelSynchronizer.Null"; //$NON-NLS-1$
+ }
+ private static final long serialVersionUID = 1L;
+ private Object readResolve() {
+ // replace this object with the singleton
+ return INSTANCE;
+ }
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/PersistentTypeMetamodelSynchronizer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/JpaRootContextNode2_0.java
index d8e2d9c21d..cc5306e633 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/PersistentTypeMetamodelSynchronizer.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/JpaRootContextNode2_0.java
@@ -7,12 +7,13 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.jpa2;
+package org.eclipse.jpt.core.jpa2.context;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jpt.core.context.JpaRootContextNode;
+import org.eclipse.jpt.core.jpa2.MetamodelSynchronizer;
/**
- * JPA 2.0 Canonical Metamodel.
+ * Root of the Dali JPA 2.0 context model.
* <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -20,12 +21,8 @@ import org.eclipse.jdt.core.IPackageFragmentRoot;
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*/
-public interface PersistentTypeMetamodelSynchronizer {
-
- void synchronize();
-
- interface Owner {
- IPackageFragmentRoot getSourceFolder();
- }
-
+public interface JpaRootContextNode2_0
+ extends JpaRootContextNode, MetamodelSynchronizer
+{
+ // nothing yet...
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/PersistentType2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/PersistentType2_0.java
new file mode 100644
index 0000000000..334a108131
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/PersistentType2_0.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.core.jpa2.context;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jpt.core.context.PersistentType;
+import org.eclipse.jpt.core.jpa2.MetamodelSynchronizer;
+
+/**
+ * JPA 2.0 context persistent type.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface PersistentType2_0
+ extends PersistentType, MetamodelSynchronizer
+{
+ /**
+ * Return the file generated as a result of the metamodel synchronization.
+ */
+ IFile getMetamodelFile();
+
+ /**
+ * This interface is used by the persistent type to synchonize the metamodel
+ * as required by changes to the context model.
+ */
+ interface MetamodelSynchronizer {
+ /**
+ * Return the file generated as a result of the metamodel synchronization.
+ */
+ IFile getFile();
+
+ /**
+ * Synchronize the metamodel with the current state of the persistent
+ * type.
+ */
+ void synchronize();
+ }
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/MetamodelGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaPersistentType2_0.java
index af062a4cfa..9cfe612271 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/MetamodelGenerator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/java/JavaPersistentType2_0.java
@@ -7,10 +7,13 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.core.jpa2;
+package org.eclipse.jpt.core.jpa2.context.java;
+
+import org.eclipse.jpt.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.core.jpa2.context.PersistentType2_0;
/**
- * JPA 2.0 Canonical Metamodel Generator.
+ * JPA 2.0 context Java persistent type.
* <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
@@ -18,11 +21,8 @@ package org.eclipse.jpt.core.jpa2;
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*/
-public interface MetamodelGenerator {
-
- /**
- * Synchronize the JPA "Canonical Metamodel Classes" with the context model.
- */
- void synchronizeMetamodel();
-
+public interface JavaPersistentType2_0
+ extends JavaPersistentType, PersistentType2_0
+{
+ // nothing yet...
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmPersistentType2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmPersistentType2_0.java
new file mode 100644
index 0000000000..876075111b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/orm/OrmPersistentType2_0.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.core.jpa2.context.orm;
+
+import org.eclipse.jpt.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.core.jpa2.context.PersistentType2_0;
+
+/**
+ * JPA 2.0 context <code>orm.xml</code> persistent type.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface OrmPersistentType2_0
+ extends OrmPersistentType, PersistentType2_0
+{
+ // nothing yet
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/persistence/Persistence2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/persistence/Persistence2_0.java
new file mode 100644
index 0000000000..e41efdc4bb
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/persistence/Persistence2_0.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.core.jpa2.context.persistence;
+
+import org.eclipse.jpt.core.context.persistence.Persistence;
+import org.eclipse.jpt.core.jpa2.MetamodelSynchronizer;
+
+/**
+ * The <code>persistence</code> element in the JPA 2.0 <code>persistence.xml</code> file.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface Persistence2_0
+ extends Persistence, MetamodelSynchronizer
+{
+ // nothing yet...
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/persistence/PersistenceUnit2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/persistence/PersistenceUnit2_0.java
index 620b9a36d4..e58bb6771e 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/persistence/PersistenceUnit2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/persistence/PersistenceUnit2_0.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.core.jpa2.context.persistence;
import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.core.jpa2.MetamodelSynchronizer;
import org.eclipse.jpt.core.context.persistence.PersistenceUnitProperties;
import org.eclipse.jpt.core.jpa2.context.persistence.options.SharedCacheMode;
import org.eclipse.jpt.core.jpa2.context.persistence.options.ValidationMode;
@@ -24,7 +25,7 @@ import org.eclipse.jpt.core.jpa2.context.persistence.options.ValidationMode;
* will almost certainly be broken (repeatedly) as the API evolves.
*/
public interface PersistenceUnit2_0
- extends PersistenceUnit
+ extends PersistenceUnit, MetamodelSynchronizer
{
// ********** shared cache mode **********
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/persistence/PersistenceXml2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/persistence/PersistenceXml2_0.java
new file mode 100644
index 0000000000..4445b48c7f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/context/persistence/PersistenceXml2_0.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.core.jpa2.context.persistence;
+
+import org.eclipse.jpt.core.context.persistence.PersistenceXml;
+import org.eclipse.jpt.core.jpa2.MetamodelSynchronizer;
+
+/**
+ * JPA 2.0 <code>persistence.xml</code> file.
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ */
+public interface PersistenceXml2_0
+ extends PersistenceXml, MetamodelSynchronizer
+{
+ // nothing yet...
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/GeneratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/GeneratedAnnotation.java
new file mode 100644
index 0000000000..2746c539ff
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/GeneratedAnnotation.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.core.jpa2.resource.java;
+
+import java.util.ListIterator;
+
+import org.eclipse.jpt.core.resource.java.Annotation;
+
+/**
+ * Corresponds to the Java 6 annotation
+ * <code>javax.annotation.Generated</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface GeneratedAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = "javax.annotation.Generated"; // requires JRE 1.6 //$NON-NLS-1$
+ String VALUE_ELEMENT_NAME = "value"; //$NON-NLS-1$
+ String DATE_ELEMENT_NAME = "date"; //$NON-NLS-1$
+ String COMMENTS_ELEMENT_NAME = "comments"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the <code>value<code> element of the <code>Generated</code>
+ * annotation.
+ * Return <code>null</code> if the element does not exist in the annotation.
+ */
+ ListIterator<String> values();
+ String VALUES_LIST = "values"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the <code>value<code> element of the <code>Generated</code>
+ * annotation.
+ */
+ int valuesSize();
+
+ /**
+ * Corresponds to the <code>value<code> element of the <code>Generated</code>
+ * annotation.
+ */
+ void addValue(String value);
+
+ /**
+ * Corresponds to the <code>value<code> element of the <code>Generated</code>
+ * annotation.
+ */
+ void addValue(int index, String value);
+
+ /**
+ * Corresponds to the <code>value<code> element of the <code>Generated</code>
+ * annotation.
+ */
+ void moveValue(int targetIndex, int sourceIndex);
+
+ /**
+ * Corresponds to the <code>value<code> element of the <code>Generated</code>
+ * annotation.
+ */
+ void removeValue(String value);
+
+ /**
+ * Corresponds to the <code>value<code> element of the <code>Generated</code>
+ * annotation.
+ */
+ void removeValue(int index);
+
+ /**
+ * Corresponds to the <code>date</code> element of the <code>Generated</code>
+ * annotation.
+ * Return <code>null</code> if the element does not exist in the annotation.
+ */
+ String getDate();
+ String DATE_PROPERTY = "date"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the <code>date</code> element of the <code>Generated</code>
+ * annotation.
+ * Set to <code>null</code> to remove the element.
+ */
+ void setDate(String date);
+
+ /**
+ * Corresponds to the <code>comments</code> element of the <code>Generated</code>
+ * annotation.
+ * Return <code>null</code> if the element does not exist in the annotation.
+ */
+ String getComments();
+ String COMMENTS_PROPERTY = "comments"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the <code>comments</code> element of the <code>Generated</code>
+ * annotation.
+ * Set to <code>null</code> to remove the element.
+ */
+ void setComments(String comments);
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/StaticMetamodelAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/StaticMetamodelAnnotation.java
new file mode 100644
index 0000000000..086cc67a7a
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/jpa2/resource/java/StaticMetamodelAnnotation.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.
+ *
+ * Contributors:
+ * Oracle - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jpt.core.jpa2.resource.java;
+
+import org.eclipse.jpt.core.resource.java.Annotation;
+
+/**
+ * Corresponds to the JPA 2.0 annotation
+ * <code>javax.persistence.metamodel.StaticMetamodel</code>
+ * <p>
+ * Provisional API: This interface is part of an interim API that is still
+ * under development and expected to change significantly before reaching
+ * stability. It is available at this early stage to solicit feedback from
+ * pioneering adopters on the understanding that any code that uses this API
+ * will almost certainly be broken (repeatedly) as the API evolves.
+ *
+ * @version 3.0
+ * @since 3.0
+ */
+public interface StaticMetamodelAnnotation
+ extends Annotation
+{
+ String ANNOTATION_NAME = JPA2_0.STATIC_METAMODEL;
+
+ /**
+ * Corresponds to the <code>value</code> element of the <code>StaticMetamodel</code> annotation.
+ * Return <code>null</code> if the element does not exist in Java.
+ * Return the portion of the value preceding <code>".class"</code>.
+ * <pre>
+ * &#64;StaticMetamodel(value=Employee.class)
+ * </pre>
+ * will return <code>"Employee"</code>.
+ */
+ String getValue();
+ String VALUE_PROPERTY = "value"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the <code>value</code> element of the <code>StaticMetamodel</code> annotation.
+ * Set to <code>null</code> to remove the element.
+ */
+ void setValue(String value);
+
+ /**
+ * Return the <code>StaticMetamodel</code>'s fully-qualified class name as resolved by
+ * the AST's bindings.
+ * <pre>
+ * &#64;StaticMetamodel(Employee.class)
+ * </pre>
+ * will return <code>"model.Employee"</code> if there is an import for <code>model.Employee</code>.
+ */
+ String getFullyQualifiedClassName();
+ String FULLY_QUALIFIED_CLASS_NAME_PROPERTY = "fullyQualifiedClassName"; //$NON-NLS-1$
+
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/java/JavaResourcePersistentMember.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/java/JavaResourcePersistentMember.java
index d4a00cf74b..7640a01dda 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/java/JavaResourcePersistentMember.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/java/JavaResourcePersistentMember.java
@@ -15,7 +15,7 @@ import org.eclipse.jpt.core.utility.TextRange;
/**
* Java source code or binary persistent member.
- *
+ * <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
* stability. It is available at this early stage to solicit feedback from
@@ -67,8 +67,7 @@ public interface JavaResourcePersistentMember
*/
// TODO tie the singular and plural annotations together so we can generate
// a validation error when both are specified
- Iterator<NestableAnnotation> annotations(
- String nestableAnnotationName, String containerAnnotationName);
+ Iterator<NestableAnnotation> annotations(String nestableAnnotationName, String containerAnnotationName);
/**
* Add an annotation with the specified name.
@@ -108,15 +107,13 @@ public interface JavaResourcePersistentMember
* the new one. If neither annotation exists, then create a new nestable
* annotation.
*/
- NestableAnnotation addAnnotation(
- int index, String nestableAnnotationName, String containerAnnotationName);
+ NestableAnnotation addAnnotation(int index, String nestableAnnotationName, String containerAnnotationName);
/**
* Move the nestable annotation found in the specified container
* annotation at the specified source index to the specified target index.
*/
- void moveAnnotation(
- int targetIndex, int sourceIndex, String containerAnnotationName);
+ void moveAnnotation(int targetIndex, int sourceIndex, String containerAnnotationName);
/**
* Remove the specified annotation.
@@ -129,16 +126,14 @@ public interface JavaResourcePersistentMember
* If there is no container, assume the index is zero and this does the same as
* {@link #removeAnnotation(String)}
*/
- void removeAnnotation(
- int index, String nestableAnnotationName, String containerAnnotationName);
+ void removeAnnotation(int index, String nestableAnnotationName, String containerAnnotationName);
/**
* Sets the specified primary annotation as the first annotation, and removes all known
* annotations (i.e. does not remove non-persistence annotations) which are not included
* in the supporting annotations.
*/
- Annotation setPrimaryAnnotation(
- String primaryAnnotationName, String[] supportingAnnotationNames);
+ Annotation setPrimaryAnnotation(String primaryAnnotationName, Iterable<String> supportingAnnotationNames);
// ********** queries **********
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/java/JavaResourcePersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/java/JavaResourcePersistentType.java
index dda2245c86..58b53c14fb 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/java/JavaResourcePersistentType.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/resource/java/JavaResourcePersistentType.java
@@ -11,9 +11,11 @@ package org.eclipse.jpt.core.resource.java;
import java.util.Iterator;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+
/**
* Java source code or binary persistent type.
- *
+ * <p>
* Provisional API: This interface is part of an interim API that is still
* under development and expected to change significantly before reaching
* stability. It is available at this early stage to solicit feedback from
@@ -60,11 +62,30 @@ public interface JavaResourcePersistentType
boolean isMapped();
/**
- * Return whether the type has any attributes that have
- * JPA annotations on them.
+ * Return whether the type has any attributes that have JPA annotations
+ * on them (which can be used to infer the type's access type).
*/
boolean hasAnyAnnotatedAttributes();
+ /**
+ * Return whether the type is a metamodel type generated in the specified
+ * source folder.
+ */
+ boolean isGeneratedMetamodel(IPackageFragmentRoot sourceFolder);
+
+ /**
+ * Return whether the type is a generated metamodel type.
+ */
+ boolean isGeneratedMetamodel();
+
+ /**
+ * The value used to tag a generated type:
+ * <pre>
+ * &#64;javax.annotation.Generated(value="Dali", date="2009-11-23T13:56:06.171-0500")
+ * </pre>
+ */
+ String METAMODEL_GENERATED_ANNOTATION_VALUE = "Dali"; //$NON-NLS-1$
+
// ********** types **********
@@ -135,7 +156,7 @@ public interface JavaResourcePersistentType
Iterator<JavaResourcePersistentAttribute> persistableAttributes();
/**
- * Return the persitable properties and/or fields given the non-null specified access type
+ * Return the persistable properties and/or fields given the non-null specified access type
*/
Iterator<JavaResourcePersistentAttribute> persistableAttributes(AccessType specifiedAccess);
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapping.java
index fd21d60fa6..a055d6a65f 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapping.java
@@ -11,17 +11,18 @@ package org.eclipse.jpt.eclipselink.core.internal.context.java;
import java.util.Iterator;
import java.util.List;
+import java.util.Vector;
+
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.context.java.JavaConverter;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaBasicMapping;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConvert;
import org.eclipse.jpt.eclipselink.core.context.EclipseLinkBasicMapping;
+import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConvert;
import org.eclipse.jpt.eclipselink.core.context.EclipseLinkMutable;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkConvertAnnotation;
import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLink;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkConvertAnnotation;
import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.ArrayTools;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -40,12 +41,11 @@ public class JavaEclipseLinkBasicMapping
//************** JavaAttributeMapping implementation ***************
@Override
- protected String[] buildSupportingAnnotationNames() {
- return ArrayTools.addAll(
- super.buildSupportingAnnotationNames(),
- EclipseLink.MUTABLE,
- EclipseLink.CONVERT);
- }
+ protected void addSupportingAnnotationNamesTo(Vector<String> names) {
+ super.addSupportingAnnotationNamesTo(names);
+ names.add(EclipseLink.MUTABLE);
+ names.add(EclipseLink.CONVERT);
+ }
//************** AbstractJavaBasicMapping implementation ***************
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkIdMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkIdMapping.java
index 401ef8ddd0..ab75c4740a 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkIdMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkIdMapping.java
@@ -11,6 +11,8 @@ package org.eclipse.jpt.eclipselink.core.internal.context.java;
import java.util.Iterator;
import java.util.List;
+import java.util.Vector;
+
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.context.java.JavaConverter;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
@@ -18,10 +20,9 @@ import org.eclipse.jpt.core.internal.context.java.AbstractJavaIdMapping;
import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConvert;
import org.eclipse.jpt.eclipselink.core.context.EclipseLinkIdMapping;
import org.eclipse.jpt.eclipselink.core.context.EclipseLinkMutable;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkConvertAnnotation;
import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLink;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkConvertAnnotation;
import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.ArrayTools;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -39,12 +40,11 @@ public class JavaEclipseLinkIdMapping
//************** JavaAttributeMapping implementation ***************
@Override
- protected String[] buildSupportingAnnotationNames() {
- return ArrayTools.addAll(
- super.buildSupportingAnnotationNames(),
- EclipseLink.MUTABLE,
- EclipseLink.CONVERT);
- }
+ protected void addSupportingAnnotationNamesTo(Vector<String> names) {
+ super.addSupportingAnnotationNamesTo(names);
+ names.add(EclipseLink.MUTABLE);
+ names.add(EclipseLink.CONVERT);
+ }
//************** AbstractJavaIdMapping overrides ***************
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkManyToManyMapping.java
index 10cbaa76a5..7c01655ec7 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkManyToManyMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkManyToManyMapping.java
@@ -9,16 +9,15 @@
******************************************************************************/
package org.eclipse.jpt.eclipselink.core.internal.context.java;
-import java.util.Iterator;
import java.util.List;
+import java.util.Vector;
+
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaManyToManyMapping;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping;
import org.eclipse.jpt.eclipselink.core.context.EclipseLinkJoinFetch;
+import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping;
import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLink;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -35,11 +34,10 @@ public class JavaEclipseLinkManyToManyMapping
}
@Override
- protected String[] buildSupportingAnnotationNames() {
- return ArrayTools.addAll(
- super.buildSupportingAnnotationNames(),
- EclipseLink.JOIN_FETCH);
- }
+ protected void addSupportingAnnotationNamesTo(Vector<String> names) {
+ super.addSupportingAnnotationNamesTo(names);
+ names.add(EclipseLink.JOIN_FETCH);
+ }
public EclipseLinkJoinFetch getJoinFetch() {
return this.joinFetch;
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkManyToOneMapping.java
index 7db3661239..6fa415c9a6 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkManyToOneMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkManyToOneMapping.java
@@ -10,13 +10,14 @@
package org.eclipse.jpt.eclipselink.core.internal.context.java;
import java.util.List;
+import java.util.Vector;
+
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaManyToOneMapping;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping;
import org.eclipse.jpt.eclipselink.core.context.EclipseLinkJoinFetch;
+import org.eclipse.jpt.eclipselink.core.context.EclipseLinkRelationshipMapping;
import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLink;
-import org.eclipse.jpt.utility.internal.ArrayTools;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -33,10 +34,9 @@ public class JavaEclipseLinkManyToOneMapping
}
@Override
- protected String[] buildSupportingAnnotationNames() {
- return ArrayTools.addAll(
- super.buildSupportingAnnotationNames(),
- EclipseLink.JOIN_FETCH);
+ protected void addSupportingAnnotationNamesTo(Vector<String> names) {
+ super.addSupportingAnnotationNamesTo(names);
+ names.add(EclipseLink.JOIN_FETCH);
}
public EclipseLinkJoinFetch getJoinFetch() {
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMapping.java
index 84031ccbfe..cedddf6552 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMapping.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.eclipselink.core.internal.context.java;
import java.util.List;
+import java.util.Vector;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
@@ -21,7 +22,6 @@ import org.eclipse.jpt.eclipselink.core.context.EclipseLinkPrivateOwned;
import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLink;
import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkPrivateOwnedAnnotation;
import org.eclipse.jpt.eclipselink.core.v2_0.context.EclipseLinkOneToManyMapping2_0;
-import org.eclipse.jpt.utility.internal.ArrayTools;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -46,12 +46,11 @@ public class JavaEclipseLinkOneToManyMapping
}
@Override
- protected String[] buildSupportingAnnotationNames() {
- return ArrayTools.addAll(
- super.buildSupportingAnnotationNames(),
- EclipseLink.JOIN_FETCH,
- EclipseLink.PRIVATE_OWNED);
- }
+ protected void addSupportingAnnotationNamesTo(Vector<String> names) {
+ super.addSupportingAnnotationNamesTo(names);
+ names.add(EclipseLink.JOIN_FETCH);
+ names.add(EclipseLink.PRIVATE_OWNED);
+ }
@Override
public JavaEclipseLinkOneToManyRelationshipReference getRelationshipReference() {
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToOneMapping.java
index e790e8fe26..1e1c0db5c3 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToOneMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkOneToOneMapping.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.eclipselink.core.internal.context.java;
import java.util.List;
+import java.util.Vector;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
@@ -18,7 +19,6 @@ import org.eclipse.jpt.eclipselink.core.context.EclipseLinkJoinFetch;
import org.eclipse.jpt.eclipselink.core.context.EclipseLinkPrivateOwned;
import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLink;
import org.eclipse.jpt.eclipselink.core.v2_0.context.EclipseLinkOneToOneMapping2_0;
-import org.eclipse.jpt.utility.internal.ArrayTools;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -38,11 +38,10 @@ public class JavaEclipseLinkOneToOneMapping
}
@Override
- protected String[] buildSupportingAnnotationNames() {
- return ArrayTools.addAll(
- super.buildSupportingAnnotationNames(),
- EclipseLink.JOIN_FETCH,
- EclipseLink.PRIVATE_OWNED);
+ protected void addSupportingAnnotationNamesTo(Vector<String> names) {
+ super.addSupportingAnnotationNamesTo(names);
+ names.add(EclipseLink.JOIN_FETCH);
+ names.add(EclipseLink.PRIVATE_OWNED);
}
public EclipseLinkJoinFetch getJoinFetch() {
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkVersionMapping.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkVersionMapping.java
index 5f5e793c58..b7e913c385 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkVersionMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkVersionMapping.java
@@ -11,17 +11,18 @@ package org.eclipse.jpt.eclipselink.core.internal.context.java;
import java.util.Iterator;
import java.util.List;
+import java.util.Vector;
+
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.context.java.JavaConverter;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaVersionMapping;
import org.eclipse.jpt.eclipselink.core.context.EclipseLinkConvert;
-import org.eclipse.jpt.eclipselink.core.context.EclipseLinkVersionMapping;
import org.eclipse.jpt.eclipselink.core.context.EclipseLinkMutable;
-import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkConvertAnnotation;
+import org.eclipse.jpt.eclipselink.core.context.EclipseLinkVersionMapping;
import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLink;
+import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLinkConvertAnnotation;
import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.ArrayTools;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -39,12 +40,11 @@ public class JavaEclipseLinkVersionMapping
//************** JavaAttributeMapping implementation ***************
@Override
- protected String[] buildSupportingAnnotationNames() {
- return ArrayTools.addAll(
- super.buildSupportingAnnotationNames(),
- EclipseLink.MUTABLE,
- EclipseLink.CONVERT);
- }
+ protected void addSupportingAnnotationNamesTo(Vector<String> names) {
+ super.addSupportingAnnotationNamesTo(names);
+ names.add(EclipseLink.MUTABLE);
+ names.add(EclipseLink.CONVERT);
+ }
//************** EclipseLinkVersionMapping overrides ***************
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v2_0/EclipseLink2_0JpaFactory.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v2_0/EclipseLink2_0JpaFactory.java
index 64f7e3da20..a00fbcae23 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v2_0/EclipseLink2_0JpaFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v2_0/EclipseLink2_0JpaFactory.java
@@ -21,7 +21,6 @@ import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.core.context.java.JavaPersistentType;
import org.eclipse.jpt.core.context.java.JavaSequenceGenerator;
import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaAssociationOverrideContainer;
-import org.eclipse.jpt.core.internal.jpa2.GenericMetamodelSynchronizer;
import org.eclipse.jpt.core.internal.jpa2.GenericPersistentTypeMetamodelSynchronizer;
import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaAssociationOverrideRelationshipReference2_0;
import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaCacheable2_0;
@@ -33,9 +32,7 @@ import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaOrphanRemoval2
import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaPersistentType2_0;
import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaSequenceGenerator2_0;
import org.eclipse.jpt.core.internal.jpa2.context.java.VirtualAssociationOverride2_0Annotation;
-import org.eclipse.jpt.core.jpa2.JpaProject2_0;
-import org.eclipse.jpt.core.jpa2.MetamodelSynchronizer;
-import org.eclipse.jpt.core.jpa2.PersistentTypeMetamodelSynchronizer;
+import org.eclipse.jpt.core.jpa2.context.PersistentType2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaCacheable2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaCacheableHolder2_0;
import org.eclipse.jpt.core.jpa2.context.java.JavaDerivedId2_0;
@@ -63,13 +60,8 @@ public class EclipseLink2_0JpaFactory
// ********** Core Model **********
@Override
- public MetamodelSynchronizer buildMetamodelSynchronizer(JpaProject2_0 jpaProject) {
- return new GenericMetamodelSynchronizer(jpaProject);
- }
-
- @Override
- public PersistentTypeMetamodelSynchronizer buildPersistentTypeMetamodelSynchronizer(PersistentTypeMetamodelSynchronizer.Owner owner, PersistentType persistentType) {
- return new GenericPersistentTypeMetamodelSynchronizer(owner, persistentType);
+ public PersistentType2_0.MetamodelSynchronizer buildPersistentTypeMetamodelSynchronizer(PersistentType2_0 persistentType) {
+ return new GenericPersistentTypeMetamodelSynchronizer(persistentType);
}
// ********** Java Context Model **********
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/properties/JpaProjectPropertiesPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/properties/JpaProjectPropertiesPage.java
index 8af064efd7..e4771bd914 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/properties/JpaProjectPropertiesPage.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/properties/JpaProjectPropertiesPage.java
@@ -1386,7 +1386,7 @@ public class JpaProjectPropertiesPage
@Override
protected Iterable<String> getIterable() {
return this.jpaProjectIsJpa2_0() ?
- ((JpaProject2_0) this.subject).getSourceFolderNames() :
+ ((JpaProject2_0) this.subject).getJavaSourceFolderNames() :
EmptyIterable.<String>instance();
}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/entity/data/operation/NewEntityClassOperation.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/entity/data/operation/NewEntityClassOperation.java
index 549abe96de..96005c08f9 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/entity/data/operation/NewEntityClassOperation.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/wizards/entity/data/operation/NewEntityClassOperation.java
@@ -406,7 +406,7 @@ public class NewEntityClassOperation extends AbstractDataModelOperation {
entity.setIdClass(model.getIdClassName());
}
for (String fieldName : model.getPKFields()) {
- persistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, fieldName);
+ persistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, fieldName);
}
persistentType.setSpecifiedAccess(getModelAccessType(model));
@@ -451,7 +451,7 @@ public class NewEntityClassOperation extends AbstractDataModelOperation {
}
for (String fieldName : model.getPKFields()) {
- persistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, fieldName);
+ persistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, fieldName);
}
persistentType.setSpecifiedAccess(getModelAccessType(model));
diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestTypeMapping.java b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestTypeMapping.java
index a5413be9a9..ad0f8c8086 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestTypeMapping.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/JavaTestTypeMapping.java
@@ -9,10 +9,9 @@
******************************************************************************/
package org.eclipse.jpt.core.tests.extension.resource;
-import java.util.Iterator;
import org.eclipse.jpt.core.context.java.JavaPersistentType;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaTypeMapping;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
+import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
public class JavaTestTypeMapping extends AbstractJavaTypeMapping
{
@@ -32,8 +31,8 @@ public class JavaTestTypeMapping extends AbstractJavaTypeMapping
return TEST_TYPE_MAPPING_KEY;
}
- public Iterator<String> supportingAnnotationNames() {
- return EmptyIterator.instance();
+ public Iterable<String> getSupportingAnnotationNames() {
+ return EmptyIterable.<String>instance();
}
public boolean isMapped() {
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentAttributeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentAttributeTests.java
index 1eb04af10c..a729eebd40 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentAttributeTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentAttributeTests.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.core.tests.internal.context.java;
import java.util.Iterator;
+
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.AccessType;
@@ -24,6 +25,7 @@ import org.eclipse.jpt.core.resource.java.JPA;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
@SuppressWarnings("nls")
@@ -193,7 +195,7 @@ public class GenericJavaPersistentAttributeTests extends ContextModelTestCase
JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.setPrimaryAnnotation(EmbeddedAnnotation.ANNOTATION_NAME, new String[0]);
+ attributeResource.setPrimaryAnnotation(EmbeddedAnnotation.ANNOTATION_NAME, EmptyIterable.<String>instance());
assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMappingKey());
}
@@ -207,7 +209,7 @@ public class GenericJavaPersistentAttributeTests extends ContextModelTestCase
JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.setPrimaryAnnotation(BasicAnnotation.ANNOTATION_NAME, new String[0]);
+ attributeResource.setPrimaryAnnotation(BasicAnnotation.ANNOTATION_NAME, EmptyIterable.<String>instance());
assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getSpecifiedMapping().getKey());
}
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java
index 333216829b..c7e5a1220d 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java
@@ -30,6 +30,7 @@ import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter;
+import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
@@ -598,7 +599,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.setPrimaryAnnotation(EmbeddableAnnotation.ANNOTATION_NAME, new String[0]);
+ typeResource.setPrimaryAnnotation(EmbeddableAnnotation.ANNOTATION_NAME, EmptyIterable.<String>instance());
assertEquals(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
}
@@ -610,7 +611,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
assertEquals(MappingKeys.NULL_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.setPrimaryAnnotation(EntityAnnotation.ANNOTATION_NAME, new String[0]);
+ typeResource.setPrimaryAnnotation(EntityAnnotation.ANNOTATION_NAME, EmptyIterable.<String>instance());
assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
}
@@ -628,7 +629,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
public void testAttributes() throws Exception {
createTestEntityAnnotatedMethod();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
+ Iterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
assertEquals("id", attributes.next().getName());
assertFalse(attributes.hasNext());
@@ -638,7 +639,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
createTestEntityAnnotatedFieldAndMethod();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
+ Iterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
assertEquals("id", attributes.next().getName());
assertEquals("name", attributes.next().getName());
@@ -685,7 +686,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
ICompilationUnit testType = createTestEntityAnnotatedField();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- ListIterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
+ Iterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
JavaPersistentAttribute idAttribute = attributes.next();
JavaPersistentAttribute nameAttribute = attributes.next();
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java
index 646ea24cb6..d9e9120366 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java
@@ -49,6 +49,7 @@ import org.eclipse.jpt.core.resource.java.VersionAnnotation;
import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase;
+import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
@SuppressWarnings("nls")
@@ -724,7 +725,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase
assertSame(basicMapping, persistentAttribute.getSpecifiedMapping());
basic.setOptional(Boolean.FALSE);
- attributeResource.setPrimaryAnnotation(null, new String[0]);
+ attributeResource.setPrimaryAnnotation(null, EmptyIterable.<String>instance());
assertNull(persistentAttribute.getSpecifiedMapping());
assertEquals(true, ((BasicMapping) persistentAttribute.getMapping()).isOptional());
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentAttributeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentAttributeTests.java
index 7e60906d7f..7767b3b873 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentAttributeTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentAttributeTests.java
@@ -10,7 +10,7 @@
package org.eclipse.jpt.core.tests.internal.context.orm;
import java.util.Iterator;
-import java.util.ListIterator;
+
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.MappingKeys;
@@ -117,7 +117,7 @@ public class GenericOrmPersistentAttributeTests extends ContextModelTestCase
assertEquals(0, ormPersistentType.virtualAttributesSize());
assertEquals(2, ormPersistentType.specifiedAttributesSize());
- ListIterator<OrmPersistentAttribute> specifiedAttributes = ormPersistentType.specifiedAttributes();
+ Iterator<OrmPersistentAttribute> specifiedAttributes = ormPersistentType.specifiedAttributes();
specifiedOrmPersistentAttribute = specifiedAttributes.next();
assertEquals("id", specifiedOrmPersistentAttribute.getName());
assertFalse(specifiedOrmPersistentAttribute.isVirtual());
@@ -153,7 +153,7 @@ public class GenericOrmPersistentAttributeTests extends ContextModelTestCase
assertEquals(1, ormPersistentType.virtualAttributesSize());
assertEquals(2, ormPersistentType.specifiedAttributesSize());
- ListIterator<OrmPersistentAttribute> specifiedAttributes = ormPersistentType.specifiedAttributes();
+ Iterator<OrmPersistentAttribute> specifiedAttributes = ormPersistentType.specifiedAttributes();
specifiedOrmPersistentAttribute = specifiedAttributes.next();
assertEquals("id", specifiedOrmPersistentAttribute.getName());
@@ -189,7 +189,7 @@ public class GenericOrmPersistentAttributeTests extends ContextModelTestCase
assertEquals(2, ormPersistentType.virtualAttributesSize());
assertEquals(0, ormPersistentType.specifiedAttributesSize());
- ListIterator<OrmPersistentAttribute> virtualAttributes = ormPersistentType.virtualAttributes();
+ Iterator<OrmPersistentAttribute> virtualAttributes = ormPersistentType.virtualAttributes();
OrmPersistentAttribute virtualAttribute = virtualAttributes.next();
assertEquals("id", virtualAttribute.getName());
virtualAttribute = virtualAttributes.next();
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentTypeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentTypeTests.java
index 777cde1f7b..2c3642dc77 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentTypeTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/GenericOrmPersistentTypeTests.java
@@ -10,7 +10,7 @@
package org.eclipse.jpt.core.tests.internal.context.orm;
import java.util.Iterator;
-import java.util.ListIterator;
+
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.MappingKeys;
import org.eclipse.jpt.core.context.Converter;
@@ -170,34 +170,34 @@ public class GenericOrmPersistentTypeTests extends ContextModelTestCase
public void testAddSpecifiedPersistentAttribute() throws Exception {
OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicAttribute");
+ entityPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicAttribute");
XmlEntity entity = getXmlEntityMappings().getEntities().get(0);
XmlBasic basic = entity.getAttributes().getBasics().get(0);
assertEquals("basicAttribute", basic.getName());
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedAttribute");
+ entityPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedAttribute");
XmlEmbedded embedded = entity.getAttributes().getEmbeddeds().get(0);
assertEquals("embeddedAttribute", embedded.getName());
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientAttribute");
+ entityPersistentType.addSpecifiedAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientAttribute");
XmlTransient transientResource = entity.getAttributes().getTransients().get(0);
assertEquals("transientAttribute", transientResource.getName());
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionAttribute");
+ entityPersistentType.addSpecifiedAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionAttribute");
XmlVersion version = entity.getAttributes().getVersions().get(0);
assertEquals("versionAttribute", version.getName());
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idAttribute");
+ entityPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idAttribute");
XmlId id = entity.getAttributes().getIds().get(0);
assertEquals("idAttribute", id.getName());
- ListIterator<OrmPersistentAttribute> persistentAttributes = entityPersistentType.specifiedAttributes();
+ Iterator<OrmPersistentAttribute> persistentAttributes = entityPersistentType.specifiedAttributes();
assertEquals("idAttribute", persistentAttributes.next().getName());
assertEquals("basicAttribute", persistentAttributes.next().getName());
assertEquals("versionAttribute", persistentAttributes.next().getName());
@@ -209,11 +209,11 @@ public class GenericOrmPersistentTypeTests extends ContextModelTestCase
public void testRemoveSpecifiedPersistentAttribute() throws Exception {
OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicAttribute");
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedAttribute");
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionAttribute");
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idAttribute");
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientAttribute");
+ entityPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicAttribute");
+ entityPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedAttribute");
+ entityPersistentType.addSpecifiedAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionAttribute");
+ entityPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idAttribute");
+ entityPersistentType.addSpecifiedAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientAttribute");
XmlEntity entity = getXmlEntityMappings().getEntities().get(0);
assertEquals("basicAttribute", entity.getAttributes().getBasics().get(0).getName());
@@ -222,25 +222,25 @@ public class GenericOrmPersistentTypeTests extends ContextModelTestCase
assertEquals("idAttribute", entity.getAttributes().getIds().get(0).getName());
assertEquals("transientAttribute", entity.getAttributes().getTransients().get(0).getName());
- entityPersistentType.removeSpecifiedPersistentAttribute(entityPersistentType.getAttributeNamed("basicAttribute"));
+ entityPersistentType.removeSpecifiedAttribute(entityPersistentType.getAttributeNamed("basicAttribute"));
assertEquals("embeddedAttribute", entity.getAttributes().getEmbeddeds().get(0).getName());
assertEquals("versionAttribute", entity.getAttributes().getVersions().get(0).getName());
assertEquals("idAttribute", entity.getAttributes().getIds().get(0).getName());
assertEquals("transientAttribute", entity.getAttributes().getTransients().get(0).getName());
- entityPersistentType.removeSpecifiedPersistentAttribute(entityPersistentType.getAttributeNamed("embeddedAttribute"));
+ entityPersistentType.removeSpecifiedAttribute(entityPersistentType.getAttributeNamed("embeddedAttribute"));
assertEquals("versionAttribute", entity.getAttributes().getVersions().get(0).getName());
assertEquals("idAttribute", entity.getAttributes().getIds().get(0).getName());
assertEquals("transientAttribute", entity.getAttributes().getTransients().get(0).getName());
- entityPersistentType.removeSpecifiedPersistentAttribute(entityPersistentType.getAttributeNamed("versionAttribute"));
+ entityPersistentType.removeSpecifiedAttribute(entityPersistentType.getAttributeNamed("versionAttribute"));
assertEquals("idAttribute", entity.getAttributes().getIds().get(0).getName());
assertEquals("transientAttribute", entity.getAttributes().getTransients().get(0).getName());
- entityPersistentType.removeSpecifiedPersistentAttribute(entityPersistentType.getAttributeNamed("idAttribute"));
+ entityPersistentType.removeSpecifiedAttribute(entityPersistentType.getAttributeNamed("idAttribute"));
assertEquals("transientAttribute", entity.getAttributes().getTransients().get(0).getName());
- entityPersistentType.removeSpecifiedPersistentAttribute(entityPersistentType.getAttributeNamed("transientAttribute"));
+ entityPersistentType.removeSpecifiedAttribute(entityPersistentType.getAttributeNamed("transientAttribute"));
assertNull(entity.getAttributes());
}
@@ -248,10 +248,10 @@ public class GenericOrmPersistentTypeTests extends ContextModelTestCase
OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
XmlEntity entity = getXmlEntityMappings().getEntities().get(0);
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idAttribute");
+ entityPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idAttribute");
assertEquals("idAttribute", entity.getAttributes().getIds().get(0).getName());
- entityPersistentType.removeSpecifiedPersistentAttribute(entityPersistentType.getAttributeNamed("idAttribute"));
+ entityPersistentType.removeSpecifiedAttribute(entityPersistentType.getAttributeNamed("idAttribute"));
assertNull(entity.getAttributes());
}
@@ -259,10 +259,10 @@ public class GenericOrmPersistentTypeTests extends ContextModelTestCase
OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
XmlEntity entity = getXmlEntityMappings().getEntities().get(0);
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicAttribute");
+ entityPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicAttribute");
assertEquals("basicAttribute", entity.getAttributes().getBasics().get(0).getName());
- entityPersistentType.removeSpecifiedPersistentAttribute(entityPersistentType.getAttributeNamed("basicAttribute"));
+ entityPersistentType.removeSpecifiedAttribute(entityPersistentType.getAttributeNamed("basicAttribute"));
assertNull(entity.getAttributes());
}
@@ -270,10 +270,10 @@ public class GenericOrmPersistentTypeTests extends ContextModelTestCase
OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
XmlEntity entity = getXmlEntityMappings().getEntities().get(0);
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionAttribute");
+ entityPersistentType.addSpecifiedAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionAttribute");
assertEquals("versionAttribute", entity.getAttributes().getVersions().get(0).getName());
- entityPersistentType.removeSpecifiedPersistentAttribute(entityPersistentType.getAttributeNamed("versionAttribute"));
+ entityPersistentType.removeSpecifiedAttribute(entityPersistentType.getAttributeNamed("versionAttribute"));
assertNull(entity.getAttributes());
}
@@ -281,10 +281,10 @@ public class GenericOrmPersistentTypeTests extends ContextModelTestCase
OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
XmlEntity entity = getXmlEntityMappings().getEntities().get(0);
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedAttribute");
+ entityPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedAttribute");
assertEquals("embeddedAttribute", entity.getAttributes().getEmbeddeds().get(0).getName());
- entityPersistentType.removeSpecifiedPersistentAttribute(entityPersistentType.getAttributeNamed("embeddedAttribute"));
+ entityPersistentType.removeSpecifiedAttribute(entityPersistentType.getAttributeNamed("embeddedAttribute"));
assertNull(entity.getAttributes());
}
@@ -292,10 +292,10 @@ public class GenericOrmPersistentTypeTests extends ContextModelTestCase
OrmPersistentType entityPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2");
XmlEntity entity = getXmlEntityMappings().getEntities().get(0);
- entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientAttribute");
+ entityPersistentType.addSpecifiedAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientAttribute");
assertEquals("transientAttribute", entity.getAttributes().getTransients().get(0).getName());
- entityPersistentType.removeSpecifiedPersistentAttribute(entityPersistentType.getAttributeNamed("transientAttribute"));
+ entityPersistentType.removeSpecifiedAttribute(entityPersistentType.getAttributeNamed("transientAttribute"));
assertNull(entity.getAttributes());
}
@@ -316,7 +316,7 @@ public class GenericOrmPersistentTypeTests extends ContextModelTestCase
entity.getAttributes().getEmbeddeds().add(embedded);
embedded.setName("embeddedAttribute");
- ListIterator<OrmPersistentAttribute> attributes = entityPersistentType.attributes();
+ Iterator<OrmPersistentAttribute> attributes = entityPersistentType.attributes();
ormPersistentAttribute = attributes.next();
assertEquals("basicAttribute", ormPersistentAttribute.getName());
assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, ormPersistentAttribute.getMapping().getKey());
@@ -561,9 +561,9 @@ public class GenericOrmPersistentTypeTests extends ContextModelTestCase
OrmPersistentType employeePersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_EMPLOYEE_TYPE_NAME);
- employeePersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
- employeePersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "name");
- OrmPersistentAttribute startDateAttribute = employeePersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "startDate");
+ employeePersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
+ employeePersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "name");
+ OrmPersistentAttribute startDateAttribute = employeePersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "startDate");
((OrmBasicMapping) startDateAttribute.getSpecifiedMapping()).setSpecifiedConverter(Converter.TEMPORAL_CONVERTER);
((TemporalConverter) ((OrmBasicMapping) startDateAttribute.getSpecifiedMapping()).getSpecifiedConverter()).setTemporalType(TemporalType.DATE);
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmBasicMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmBasicMappingTests.java
index 15a7d50781..8fee94276c 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmBasicMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmBasicMappingTests.java
@@ -84,7 +84,7 @@ public class OrmBasicMappingTests extends ContextModelTestCase
public void testUpdateName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
XmlBasic basicResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
@@ -104,7 +104,7 @@ public class OrmBasicMappingTests extends ContextModelTestCase
public void testModifyName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
XmlBasic basicResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
@@ -124,7 +124,7 @@ public class OrmBasicMappingTests extends ContextModelTestCase
public void testUpdateSpecifiedFetch() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
XmlBasic basicResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
@@ -148,7 +148,7 @@ public class OrmBasicMappingTests extends ContextModelTestCase
public void testModifySpecifiedFetch() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
XmlBasic basicResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
@@ -172,7 +172,7 @@ public class OrmBasicMappingTests extends ContextModelTestCase
public void testUpdateSpecifiedEnumerated() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
XmlBasic basicResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
@@ -196,7 +196,7 @@ public class OrmBasicMappingTests extends ContextModelTestCase
public void testModifySpecifiedEnumerated() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
XmlBasic basicResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
@@ -221,7 +221,7 @@ public class OrmBasicMappingTests extends ContextModelTestCase
public void testUpdateSpecifiedOptional() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
XmlBasic basicResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
@@ -245,7 +245,7 @@ public class OrmBasicMappingTests extends ContextModelTestCase
public void testModifySpecifiedOptional() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
XmlBasic basicResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
@@ -269,7 +269,7 @@ public class OrmBasicMappingTests extends ContextModelTestCase
public void testUpdateSpecifiedLob() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
XmlBasic basicResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
@@ -289,7 +289,7 @@ public class OrmBasicMappingTests extends ContextModelTestCase
public void testModifySpecifiedLob() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
XmlBasic basicResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
@@ -309,7 +309,7 @@ public class OrmBasicMappingTests extends ContextModelTestCase
public void testUpdateTemporal() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
XmlBasic basicResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
@@ -337,7 +337,7 @@ public class OrmBasicMappingTests extends ContextModelTestCase
public void testModifyTemporal() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
XmlBasic basicResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0);
@@ -372,7 +372,7 @@ public class OrmBasicMappingTests extends ContextModelTestCase
createTestEntityBasicMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "foo");
+ ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "foo");
assertEquals(2, ormPersistentType.virtualAttributesSize());
OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
@@ -473,7 +473,7 @@ public class OrmBasicMappingTests extends ContextModelTestCase
createTestEntityBasicMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "id");
+ ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "id");
assertEquals(1, ormPersistentType.virtualAttributesSize());
OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
@@ -519,7 +519,7 @@ public class OrmBasicMappingTests extends ContextModelTestCase
public void testBasicMorphToIdMapping() throws Exception {
createTestEntityBasicMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
assertFalse(basicMapping.isDefault());
@@ -541,7 +541,7 @@ public class OrmBasicMappingTests extends ContextModelTestCase
public void testBasicMorphToVersionMapping() throws Exception {
createTestEntityBasicMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
assertFalse(basicMapping.isDefault());
@@ -563,7 +563,7 @@ public class OrmBasicMappingTests extends ContextModelTestCase
public void testBasicMorphToTransientMapping() throws Exception {
createTestEntityBasicMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
assertFalse(basicMapping.isDefault());
@@ -584,7 +584,7 @@ public class OrmBasicMappingTests extends ContextModelTestCase
public void testBasicMorphToEmbeddedMapping() throws Exception {
createTestEntityBasicMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
assertFalse(basicMapping.isDefault());
@@ -605,7 +605,7 @@ public class OrmBasicMappingTests extends ContextModelTestCase
public void testBasicMorphToEmbeddedIdMapping() throws Exception {
createTestEntityBasicMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
assertFalse(basicMapping.isDefault());
@@ -626,7 +626,7 @@ public class OrmBasicMappingTests extends ContextModelTestCase
public void testBasicMorphToOneToOneMapping() throws Exception {
createTestEntityBasicMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
assertFalse(basicMapping.isDefault());
@@ -647,7 +647,7 @@ public class OrmBasicMappingTests extends ContextModelTestCase
public void testBasicMorphToOneToManyMapping() throws Exception {
createTestEntityBasicMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
assertFalse(basicMapping.isDefault());
@@ -668,7 +668,7 @@ public class OrmBasicMappingTests extends ContextModelTestCase
public void testBasicMorphToManyToOneMapping() throws Exception {
createTestEntityBasicMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
assertFalse(basicMapping.isDefault());
@@ -689,7 +689,7 @@ public class OrmBasicMappingTests extends ContextModelTestCase
public void testBasicMorphToManyToManyMapping() throws Exception {
createTestEntityBasicMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic");
BasicMapping basicMapping = (BasicMapping) ormPersistentAttribute.getMapping();
assertFalse(basicMapping.isDefault());
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmCascadeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmCascadeTests.java
index d9a7c7b180..25a2ff1d69 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmCascadeTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmCascadeTests.java
@@ -40,7 +40,7 @@ public class OrmCascadeTests extends ContextModelTestCase
public void testUpdateCascadeAll() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
Cascade cascade = ormOneToOneMapping.getCascade();
@@ -66,7 +66,7 @@ public class OrmCascadeTests extends ContextModelTestCase
public void testModifyCascadeAll() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
@@ -88,7 +88,7 @@ public class OrmCascadeTests extends ContextModelTestCase
public void testUpdateCascadePersist() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
Cascade cascade = ormOneToOneMapping.getCascade();
@@ -114,7 +114,7 @@ public class OrmCascadeTests extends ContextModelTestCase
public void testModifyCascadePersist() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
@@ -136,7 +136,7 @@ public class OrmCascadeTests extends ContextModelTestCase
public void testUpdateCascadeMerge() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
Cascade cascade = ormOneToOneMapping.getCascade();
@@ -162,7 +162,7 @@ public class OrmCascadeTests extends ContextModelTestCase
public void testModifyCascadeMerge() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
@@ -184,7 +184,7 @@ public class OrmCascadeTests extends ContextModelTestCase
public void testUpdateCascadeRemove() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
Cascade cascade = ormOneToOneMapping.getCascade();
@@ -210,7 +210,7 @@ public class OrmCascadeTests extends ContextModelTestCase
public void testModifyCascadeRemove() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
@@ -232,7 +232,7 @@ public class OrmCascadeTests extends ContextModelTestCase
public void testUpdateCascadeRefresh() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
Cascade cascade = ormOneToOneMapping.getCascade();
@@ -258,7 +258,7 @@ public class OrmCascadeTests extends ContextModelTestCase
public void testModifyCascadeRefresh() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmColumnTests.java
index 650b93f266..97bdfde12b 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmColumnTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmColumnTests.java
@@ -10,7 +10,7 @@
package org.eclipse.jpt.core.tests.internal.context.orm;
import java.util.Iterator;
-import java.util.ListIterator;
+
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jpt.core.JptCorePlugin;
import org.eclipse.jpt.core.MappingKeys;
@@ -65,7 +65,7 @@ public class OrmColumnTests extends ContextModelTestCase
public void testUpdateSpecifiedName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
OrmColumn ormColumn = ormBasicMapping.getColumn();
@@ -97,7 +97,7 @@ public class OrmColumnTests extends ContextModelTestCase
public void testModifySpecifiedName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
OrmColumn ormColumn = ormBasicMapping.getColumn();
@@ -120,7 +120,7 @@ public class OrmColumnTests extends ContextModelTestCase
public void testUpdateColumnDefinition() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
OrmColumn ormColumn = ormBasicMapping.getColumn();
@@ -152,7 +152,7 @@ public class OrmColumnTests extends ContextModelTestCase
public void testModifyColumnDefinition() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
OrmColumn ormColumn = ormBasicMapping.getColumn();
@@ -175,7 +175,7 @@ public class OrmColumnTests extends ContextModelTestCase
public void testUpdateSpecifiedTable() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
OrmColumn ormColumn = ormBasicMapping.getColumn();
@@ -207,7 +207,7 @@ public class OrmColumnTests extends ContextModelTestCase
public void testModifySpecifiedTable() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
OrmColumn ormColumn = ormBasicMapping.getColumn();
@@ -230,7 +230,7 @@ public class OrmColumnTests extends ContextModelTestCase
public void testUpdateSpecifiedNullable() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
OrmColumn ormColumn = ormBasicMapping.getColumn();
@@ -262,7 +262,7 @@ public class OrmColumnTests extends ContextModelTestCase
public void testModifySpecifiedNullable() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
OrmColumn ormColumn = ormBasicMapping.getColumn();
@@ -285,7 +285,7 @@ public class OrmColumnTests extends ContextModelTestCase
public void testUpdateSpecifiedUpdatable() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
OrmColumn ormColumn = ormBasicMapping.getColumn();
@@ -317,7 +317,7 @@ public class OrmColumnTests extends ContextModelTestCase
public void testModifySpecifiedUpdatable() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
OrmColumn ormColumn = ormBasicMapping.getColumn();
@@ -340,7 +340,7 @@ public class OrmColumnTests extends ContextModelTestCase
public void testUpdateSpecifiedInsertable() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
OrmColumn ormColumn = ormBasicMapping.getColumn();
@@ -372,7 +372,7 @@ public class OrmColumnTests extends ContextModelTestCase
public void testModifySpecifiedInsertable() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
OrmColumn ormColumn = ormBasicMapping.getColumn();
@@ -395,7 +395,7 @@ public class OrmColumnTests extends ContextModelTestCase
public void testUpdateSpecifiedUnique() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
OrmColumn ormColumn = ormBasicMapping.getColumn();
@@ -427,7 +427,7 @@ public class OrmColumnTests extends ContextModelTestCase
public void testModifySpecifiedUnique() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
OrmColumn ormColumn = ormBasicMapping.getColumn();
@@ -450,7 +450,7 @@ public class OrmColumnTests extends ContextModelTestCase
public void testUpdateSpecifiedLength() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
OrmColumn ormColumn = ormBasicMapping.getColumn();
@@ -482,7 +482,7 @@ public class OrmColumnTests extends ContextModelTestCase
public void testModifySpecifiedLength() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
OrmColumn ormColumn = ormBasicMapping.getColumn();
@@ -505,7 +505,7 @@ public class OrmColumnTests extends ContextModelTestCase
public void testUpdateSpecifiedPrecision() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
OrmColumn ormColumn = ormBasicMapping.getColumn();
@@ -537,7 +537,7 @@ public class OrmColumnTests extends ContextModelTestCase
public void testModifySpecifiedPrecision() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
OrmColumn ormColumn = ormBasicMapping.getColumn();
@@ -560,7 +560,7 @@ public class OrmColumnTests extends ContextModelTestCase
public void testUpdateSpecifiedScale() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
OrmColumn ormColumn = ormBasicMapping.getColumn();
@@ -592,7 +592,7 @@ public class OrmColumnTests extends ContextModelTestCase
public void testModifySpecifiedScale() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping");
OrmBasicMapping ormBasicMapping = (OrmBasicMapping) ormPersistentAttribute.getMapping();
OrmColumn ormColumn = ormBasicMapping.getColumn();
@@ -617,7 +617,7 @@ public class OrmColumnTests extends ContextModelTestCase
createTestEntity();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ListIterator<OrmPersistentAttribute> attributes = ormPersistentType.virtualAttributes();
+ Iterator<OrmPersistentAttribute> attributes = ormPersistentType.virtualAttributes();
attributes.next();
//virtual attrubte in orm.xml, java attribute has no Column annotation
@@ -716,7 +716,7 @@ public class OrmColumnTests extends ContextModelTestCase
createTestEntity();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute namePersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "name");
+ OrmPersistentAttribute namePersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "name");
OrmBasicMapping nameVirtualMapping = (OrmBasicMapping) namePersistentAttribute.getMapping();
OrmColumn ormColumn = nameVirtualMapping.getColumn();
@@ -760,7 +760,7 @@ public class OrmColumnTests extends ContextModelTestCase
createTestEntity();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ListIterator<OrmPersistentAttribute> attributes = ormPersistentType.virtualAttributes();
+ Iterator<OrmPersistentAttribute> attributes = ormPersistentType.virtualAttributes();
attributes.next();
//virtual attribute in orm.xml, java attribute has no Column annotation
@@ -779,7 +779,7 @@ public class OrmColumnTests extends ContextModelTestCase
assertEquals("JAVA_TABLE", ormColumn.getSpecifiedTable());
//make name persistent attribute not virtual
- namePersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "name");
+ namePersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "name");
nameVirtualMapping = (OrmBasicMapping) namePersistentAttribute.getMapping();
ormColumn = nameVirtualMapping.getColumn();
assertNull(ormColumn.getSpecifiedTable());
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedIdMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedIdMappingTests.java
index 2f4c7bdb9d..88524737ab 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedIdMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedIdMappingTests.java
@@ -319,7 +319,7 @@ public class OrmEmbeddedIdMappingTests extends ContextModelTestCase
public void testEmbeddedIdMorphToIdMapping() throws Exception {
createTestEntityEmbeddedIdMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) ormPersistentAttribute.getMapping();
assertFalse(embeddedIdMapping.isDefault());
@@ -340,7 +340,7 @@ public class OrmEmbeddedIdMappingTests extends ContextModelTestCase
public void testEmbeddedIdMorphToVersionMapping() throws Exception {
createTestEntityEmbeddedIdMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) ormPersistentAttribute.getMapping();
assertFalse(embeddedIdMapping.isDefault());
@@ -361,7 +361,7 @@ public class OrmEmbeddedIdMappingTests extends ContextModelTestCase
public void testEmbeddedIdMorphToTransientMapping() throws Exception {
createTestEntityEmbeddedIdMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) ormPersistentAttribute.getMapping();
assertFalse(embeddedIdMapping.isDefault());
@@ -382,7 +382,7 @@ public class OrmEmbeddedIdMappingTests extends ContextModelTestCase
public void testEmbeddedIdMorphToBasicMapping() throws Exception {
createTestEntityEmbeddedIdMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) ormPersistentAttribute.getMapping();
assertFalse(embeddedIdMapping.isDefault());
@@ -403,7 +403,7 @@ public class OrmEmbeddedIdMappingTests extends ContextModelTestCase
public void testEmbeddedIdMorphToEmbeddedMapping() throws Exception {
createTestEntityEmbeddedIdMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) ormPersistentAttribute.getMapping();
assertFalse(embeddedIdMapping.isDefault());
@@ -427,7 +427,7 @@ public class OrmEmbeddedIdMappingTests extends ContextModelTestCase
public void testEmbeddedIdMorphToOneToOneMapping() throws Exception {
createTestEntityEmbeddedIdMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) ormPersistentAttribute.getMapping();
assertFalse(embeddedIdMapping.isDefault());
@@ -448,7 +448,7 @@ public class OrmEmbeddedIdMappingTests extends ContextModelTestCase
public void testEmbeddedIdMorphToOneToManyMapping() throws Exception {
createTestEntityEmbeddedIdMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) ormPersistentAttribute.getMapping();
assertFalse(embeddedIdMapping.isDefault());
@@ -469,7 +469,7 @@ public class OrmEmbeddedIdMappingTests extends ContextModelTestCase
public void testEmbeddedIdMorphToManyToOneMapping() throws Exception {
createTestEntityEmbeddedIdMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) ormPersistentAttribute.getMapping();
assertFalse(embeddedIdMapping.isDefault());
@@ -488,7 +488,7 @@ public class OrmEmbeddedIdMappingTests extends ContextModelTestCase
public void testEmbeddedIdMorphToManyToManyMapping() throws Exception {
createTestEntityEmbeddedIdMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId");
EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) ormPersistentAttribute.getMapping();
assertFalse(embeddedIdMapping.isDefault());
@@ -508,7 +508,7 @@ public class OrmEmbeddedIdMappingTests extends ContextModelTestCase
public void testUpdateName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
OrmEmbeddedIdMapping ormEmbeddedMapping = (OrmEmbeddedIdMapping) ormPersistentAttribute.getMapping();
XmlEmbeddedId embeddedResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
@@ -528,7 +528,7 @@ public class OrmEmbeddedIdMappingTests extends ContextModelTestCase
public void testModifyName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
OrmEmbeddedIdMapping ormEmbeddedMapping = (OrmEmbeddedIdMapping) ormPersistentAttribute.getMapping();
XmlEmbeddedId embeddedResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
@@ -548,7 +548,7 @@ public class OrmEmbeddedIdMappingTests extends ContextModelTestCase
public void testMoveSpecifiedAttributeOverride() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
OrmEmbeddedIdMapping ormEmbeddedIdMapping = (OrmEmbeddedIdMapping) ormPersistentAttribute.getMapping();
OrmAttributeOverrideContainer attributeOverrideContainer = ormEmbeddedIdMapping.getAttributeOverrideContainer();
XmlEmbeddedId embeddedIdResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
@@ -587,7 +587,7 @@ public class OrmEmbeddedIdMappingTests extends ContextModelTestCase
public void testUpdateAttributeOverrides() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
OrmEmbeddedIdMapping ormEmbeddedIdMapping = (OrmEmbeddedIdMapping) ormPersistentAttribute.getMapping();
OrmAttributeOverrideContainer attributeOverrideContainer = ormEmbeddedIdMapping.getAttributeOverrideContainer();
XmlEmbeddedId embeddedIdResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0);
@@ -642,7 +642,7 @@ public class OrmEmbeddedIdMappingTests extends ContextModelTestCase
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "foo");
+ ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "foo");
assertEquals(3, ormPersistentType.virtualAttributesSize());
OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
@@ -863,7 +863,7 @@ public class OrmEmbeddedIdMappingTests extends ContextModelTestCase
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "address");
+ ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "address");
assertEquals(2, ormPersistentType.virtualAttributesSize());
OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedMappingTests.java
index feb7a6d840..1b4f4b2543 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmEmbeddedMappingTests.java
@@ -217,7 +217,7 @@ public class OrmEmbeddedMappingTests extends ContextModelTestCase
public void testUpdateName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
OrmEmbeddedMapping ormEmbeddedMapping = (OrmEmbeddedMapping) ormPersistentAttribute.getMapping();
XmlEmbedded embeddedResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0);
@@ -237,7 +237,7 @@ public class OrmEmbeddedMappingTests extends ContextModelTestCase
public void testModifyName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
OrmEmbeddedMapping ormEmbeddedMapping = (OrmEmbeddedMapping) ormPersistentAttribute.getMapping();
XmlEmbedded embeddedResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0);
@@ -317,7 +317,7 @@ public class OrmEmbeddedMappingTests extends ContextModelTestCase
public void testMoveSpecifiedAttributeOverride() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
OrmEmbeddedMapping ormEmbeddedMapping = (OrmEmbeddedMapping) ormPersistentAttribute.getMapping();
OrmAttributeOverrideContainer attributeOverrideContainer = ormEmbeddedMapping.getAttributeOverrideContainer();
XmlEmbedded embeddedResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0);
@@ -356,7 +356,7 @@ public class OrmEmbeddedMappingTests extends ContextModelTestCase
public void testUpdateAttributeOverrides() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping");
OrmEmbeddedMapping ormEmbeddedMapping = (OrmEmbeddedMapping) ormPersistentAttribute.getMapping();
OrmAttributeOverrideContainer attributeOverrideContainer = ormEmbeddedMapping.getAttributeOverrideContainer();
XmlEmbedded embeddedResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0);
@@ -411,7 +411,7 @@ public class OrmEmbeddedMappingTests extends ContextModelTestCase
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "foo");
+ ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "foo");
assertEquals(3, ormPersistentType.virtualAttributesSize());
OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
@@ -632,7 +632,7 @@ public class OrmEmbeddedMappingTests extends ContextModelTestCase
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "address");
+ ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "address");
assertEquals(2, ormPersistentType.virtualAttributesSize());
OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
@@ -679,7 +679,7 @@ public class OrmEmbeddedMappingTests extends ContextModelTestCase
public void testEmbeddedMorphToIdMapping() throws Exception {
createTestEntityEmbeddedMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
EmbeddedMapping embeddedMapping = (EmbeddedMapping) ormPersistentAttribute.getMapping();
assertFalse(embeddedMapping.isDefault());
@@ -700,7 +700,7 @@ public class OrmEmbeddedMappingTests extends ContextModelTestCase
public void testEmbeddedMorphToVersionMapping() throws Exception {
createTestEntityEmbeddedMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
EmbeddedMapping embeddedMapping = (EmbeddedMapping) ormPersistentAttribute.getMapping();
assertFalse(embeddedMapping.isDefault());
@@ -721,7 +721,7 @@ public class OrmEmbeddedMappingTests extends ContextModelTestCase
public void testEmbeddedMorphToTransientMapping() throws Exception {
createTestEntityEmbeddedMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
EmbeddedMapping embeddedMapping = (EmbeddedMapping) ormPersistentAttribute.getMapping();
assertFalse(embeddedMapping.isDefault());
@@ -742,7 +742,7 @@ public class OrmEmbeddedMappingTests extends ContextModelTestCase
public void testEmbeddedMorphToBasicMapping() throws Exception {
createTestEntityEmbeddedMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
EmbeddedMapping embeddedMapping = (EmbeddedMapping) ormPersistentAttribute.getMapping();
assertFalse(embeddedMapping.isDefault());
@@ -763,7 +763,7 @@ public class OrmEmbeddedMappingTests extends ContextModelTestCase
public void testEmbeddedMorphToEmbeddedIdMapping() throws Exception {
createTestEntityEmbeddedMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
EmbeddedMapping embeddedMapping = (EmbeddedMapping) ormPersistentAttribute.getMapping();
assertFalse(embeddedMapping.isDefault());
@@ -787,7 +787,7 @@ public class OrmEmbeddedMappingTests extends ContextModelTestCase
public void testEmbeddedMorphToOneToOneMapping() throws Exception {
createTestEntityEmbeddedMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
EmbeddedMapping embeddedMapping = (EmbeddedMapping) ormPersistentAttribute.getMapping();
assertFalse(embeddedMapping.isDefault());
@@ -808,7 +808,7 @@ public class OrmEmbeddedMappingTests extends ContextModelTestCase
public void testEmbeddedMorphToOneToManyMapping() throws Exception {
createTestEntityEmbeddedMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
EmbeddedMapping embeddedMapping = (EmbeddedMapping) ormPersistentAttribute.getMapping();
assertFalse(embeddedMapping.isDefault());
@@ -829,7 +829,7 @@ public class OrmEmbeddedMappingTests extends ContextModelTestCase
public void testEmbeddedMorphToManyToOneMapping() throws Exception {
createTestEntityEmbeddedMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
EmbeddedMapping embeddedMapping = (EmbeddedMapping) ormPersistentAttribute.getMapping();
assertFalse(embeddedMapping.isDefault());
@@ -850,7 +850,7 @@ public class OrmEmbeddedMappingTests extends ContextModelTestCase
public void testEmbeddedMorphToManyToManyMapping() throws Exception {
createTestEntityEmbeddedMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded");
EmbeddedMapping embeddedMapping = (EmbeddedMapping) ormPersistentAttribute.getMapping();
assertFalse(embeddedMapping.isDefault());
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmGeneratedValueTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmGeneratedValueTests.java
index ebcc7e5a10..7d0fd95fc2 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmGeneratedValueTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmGeneratedValueTests.java
@@ -63,7 +63,7 @@ import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
public void testUpdateSpecifiedName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
OrmGeneratedValue ormGeneratedValue = ormIdMapping.addGeneratedValue();
XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
@@ -82,7 +82,7 @@ import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
public void testModifySpecifiedName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
OrmGeneratedValue ormGeneratedValue = ormIdMapping.addGeneratedValue();
XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmIdMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmIdMappingTests.java
index f731478488..dfee4ad4db 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmIdMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmIdMappingTests.java
@@ -89,7 +89,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
public void testUpdateName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
@@ -109,7 +109,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
public void testModifyName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
@@ -129,7 +129,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
public void testUpdateTemporal() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
@@ -157,7 +157,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
public void testModifyTemporal() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
@@ -190,7 +190,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
public void testAddSequenceGenerator() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
@@ -213,7 +213,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
public void testRemoveSequenceGenerator() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
@@ -240,7 +240,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
public void testUpdateSequenceGenerator() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
@@ -264,7 +264,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
public void testAddTableGenerator() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
@@ -287,7 +287,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
public void testRemoveTableGenerator() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
@@ -314,7 +314,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
public void testUpdateTableGenerator() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
@@ -338,7 +338,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
public void testAddGeneratedValue() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
@@ -361,7 +361,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
public void testRemoveGeneratedValue() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
@@ -388,7 +388,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
public void testUpdateGeneratedValue() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping");
OrmIdMapping ormIdMapping = (OrmIdMapping) ormPersistentAttribute.getMapping();
XmlId idResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getIds().get(0);
@@ -410,7 +410,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
createTestEntityIdMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "foo");
+ ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "foo");
assertEquals(2, ormPersistentType.virtualAttributesSize());
OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
@@ -532,7 +532,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
createTestEntityIdMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
+ ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
assertEquals(1, ormPersistentType.virtualAttributesSize());
OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
@@ -576,7 +576,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
public void testIdMorphToBasicMapping() throws Exception {
createTestEntityIdMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
@@ -596,7 +596,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
public void testIdMorphToVersionMapping() throws Exception {
createTestEntityIdMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
@@ -616,7 +616,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
public void testIdMorphToTransientMapping() throws Exception {
createTestEntityIdMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
@@ -633,7 +633,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
public void testIdMorphToEmbeddedMapping() throws Exception {
createTestEntityIdMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
@@ -652,7 +652,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
public void testIdMorphToEmbeddedIdMapping() throws Exception {
createTestEntityIdMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
@@ -669,7 +669,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
public void testIdMorphToOneToOneMapping() throws Exception {
createTestEntityIdMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
@@ -688,7 +688,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
public void testIdMorphToOneToManyMapping() throws Exception {
createTestEntityIdMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
@@ -707,7 +707,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
public void testIdMorphToManyToOneMapping() throws Exception {
createTestEntityIdMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
@@ -726,7 +726,7 @@ public class OrmIdMappingTests extends ContextModelTestCase
public void testIdMorphToManyToManyMapping() throws Exception {
createTestEntityIdMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id");
IdMapping idMapping = (IdMapping) ormPersistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinColumnTests.java
index b2dc08aaab..b6ba4c7af2 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinColumnTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinColumnTests.java
@@ -41,7 +41,7 @@ public class OrmJoinColumnTests extends ContextModelTestCase
public void testUpdateSpecifiedName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -74,7 +74,7 @@ public class OrmJoinColumnTests extends ContextModelTestCase
public void testModifySpecifiedName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -99,7 +99,7 @@ public class OrmJoinColumnTests extends ContextModelTestCase
public void testUpdateSpecifiedReferencedColumnName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -132,7 +132,7 @@ public class OrmJoinColumnTests extends ContextModelTestCase
public void testModifySpecifiedReferencedColumnName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -157,7 +157,7 @@ public class OrmJoinColumnTests extends ContextModelTestCase
public void testUpdateSpecifiedColumnDefinition() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -190,7 +190,7 @@ public class OrmJoinColumnTests extends ContextModelTestCase
public void testModifySpecifiedColumnDefinition() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -215,7 +215,7 @@ public class OrmJoinColumnTests extends ContextModelTestCase
public void testUpdateSpecifiedTable() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -248,7 +248,7 @@ public class OrmJoinColumnTests extends ContextModelTestCase
public void testModifySpecifiedTable() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -273,7 +273,7 @@ public class OrmJoinColumnTests extends ContextModelTestCase
public void testUpdateSpecifiedNullable() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -306,7 +306,7 @@ public class OrmJoinColumnTests extends ContextModelTestCase
public void testModifySpecifiedNullable() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -331,7 +331,7 @@ public class OrmJoinColumnTests extends ContextModelTestCase
public void testUpdateSpecifiedUpdatable() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -364,7 +364,7 @@ public class OrmJoinColumnTests extends ContextModelTestCase
public void testModifySpecifiedUpdatable() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -389,7 +389,7 @@ public class OrmJoinColumnTests extends ContextModelTestCase
public void testUpdateSpecifiedInsertable() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -422,7 +422,7 @@ public class OrmJoinColumnTests extends ContextModelTestCase
public void testModifySpecifiedInsertable() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -447,7 +447,7 @@ public class OrmJoinColumnTests extends ContextModelTestCase
public void testUpdateSpecifiedUnique() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -480,7 +480,7 @@ public class OrmJoinColumnTests extends ContextModelTestCase
public void testModifySpecifiedUnique() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinTableTests.java
index ec39dcd385..70e258b256 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinTableTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmJoinTableTests.java
@@ -99,7 +99,7 @@ public class OrmJoinTableTests extends ContextModelTestCase
public void testUpdateSpecifiedName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -131,7 +131,7 @@ public class OrmJoinTableTests extends ContextModelTestCase
public void testModifySpecifiedName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -210,7 +210,7 @@ public class OrmJoinTableTests extends ContextModelTestCase
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "projects");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "projects");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
OrmJoinTable ormJoinTable = ormManyToManyMapping.getRelationshipReference().getJoinTableJoiningStrategy().getJoinTable();
@@ -263,7 +263,7 @@ public class OrmJoinTableTests extends ContextModelTestCase
public void testUpdateSpecifiedSchema() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -381,7 +381,7 @@ public class OrmJoinTableTests extends ContextModelTestCase
public void testModifySpecifiedSchema() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -403,7 +403,7 @@ public class OrmJoinTableTests extends ContextModelTestCase
public void testUpdateSpecifiedCatalog() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -434,7 +434,7 @@ public class OrmJoinTableTests extends ContextModelTestCase
public void testModifySpecifiedCatalog() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -566,7 +566,7 @@ public class OrmJoinTableTests extends ContextModelTestCase
public void testAddSpecifiedJoinColumn() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -604,7 +604,7 @@ public class OrmJoinTableTests extends ContextModelTestCase
public void testRemoveSpecifiedJoinColumn() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -632,7 +632,7 @@ public class OrmJoinTableTests extends ContextModelTestCase
public void testMoveSpecifiedJoinColumn() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -670,7 +670,7 @@ public class OrmJoinTableTests extends ContextModelTestCase
public void testUpdateInverseJoinColumns() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -723,7 +723,7 @@ public class OrmJoinTableTests extends ContextModelTestCase
public void testAddSpecifiedInverseJoinColumn() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -761,7 +761,7 @@ public class OrmJoinTableTests extends ContextModelTestCase
public void testRemoveSpecifiedInverseJoinColumn() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -789,7 +789,7 @@ public class OrmJoinTableTests extends ContextModelTestCase
public void testMoveSpecifiedInverseJoinColumn() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -827,7 +827,7 @@ public class OrmJoinTableTests extends ContextModelTestCase
public void testUpdateJoinColumns() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -881,7 +881,7 @@ public class OrmJoinTableTests extends ContextModelTestCase
public void testUniqueConstraints() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -909,7 +909,7 @@ public class OrmJoinTableTests extends ContextModelTestCase
public void testUniqueConstraintsSize() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -932,7 +932,7 @@ public class OrmJoinTableTests extends ContextModelTestCase
public void testAddUniqueConstraint() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -954,7 +954,7 @@ public class OrmJoinTableTests extends ContextModelTestCase
public void testAddUniqueConstraint2() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -976,7 +976,7 @@ public class OrmJoinTableTests extends ContextModelTestCase
public void testRemoveUniqueConstraint() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -1022,7 +1022,7 @@ public class OrmJoinTableTests extends ContextModelTestCase
public void testMoveUniqueConstraint() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -1063,7 +1063,7 @@ public class OrmJoinTableTests extends ContextModelTestCase
public void testUpdateUniqueConstraints() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToManyMappingTests.java
index 457fa85876..c9bec4c9c6 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToManyMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToManyMappingTests.java
@@ -141,7 +141,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
public void testUpdateName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -161,7 +161,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
public void testModifyName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -181,7 +181,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
public void testUpdateTargetEntity() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -201,7 +201,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
public void testModifyTargetEntity() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -221,7 +221,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
public void testUpdateSpecifiedFetch() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToManyResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -245,7 +245,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
public void testModifySpecifiedFetch() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToManyResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -269,7 +269,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
public void testUpdateMappedBy() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
OrmMappedByJoiningStrategy strategy = ormManyToManyMapping.getRelationshipReference().getMappedByJoiningStrategy();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -290,7 +290,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
public void testModifyMappedBy() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
OrmMappedByJoiningStrategy strategy = ormManyToManyMapping.getRelationshipReference().getMappedByJoiningStrategy();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -311,7 +311,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
public void testUpdateMapKey() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -341,7 +341,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
public void testModifyMapKey() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -361,7 +361,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
public void testUpdateOrderBy() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -381,7 +381,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
public void testModifyOrderBy() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
XmlManyToMany manyToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0);
@@ -401,7 +401,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
public void testIsNoOrdering() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
assertTrue(ormManyToManyMapping.getOrderable().isNoOrdering());
@@ -415,7 +415,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
public void testSetNoOrdering() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
assertTrue(ormManyToManyMapping.getOrderable().isNoOrdering());
@@ -438,7 +438,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
public void testIsCustomOrdering() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping");
OrmManyToManyMapping ormManyToManyMapping = (OrmManyToManyMapping) ormPersistentAttribute.getMapping();
assertFalse(ormManyToManyMapping.getOrderable().isCustomOrdering());
@@ -452,7 +452,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
public void testManyToManyMorphToIdMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) ormPersistentAttribute.getMapping();
assertFalse(manyToManyMapping.isDefault());
@@ -471,7 +471,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
public void testManyToManyMorphToVersionMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) ormPersistentAttribute.getMapping();
assertFalse(manyToManyMapping.isDefault());
@@ -490,7 +490,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
public void testManyToManyMorphToTransientMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) ormPersistentAttribute.getMapping();
assertFalse(manyToManyMapping.isDefault());
@@ -509,7 +509,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
public void testManyToManyMorphToEmbeddedMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) ormPersistentAttribute.getMapping();
assertFalse(manyToManyMapping.isDefault());
@@ -528,7 +528,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
public void testManyToManyMorphToEmbeddedIdMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) ormPersistentAttribute.getMapping();
assertFalse(manyToManyMapping.isDefault());
@@ -547,7 +547,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
public void testManyToManyMorphToOneToOneMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) ormPersistentAttribute.getMapping();
assertFalse(manyToManyMapping.isDefault());
@@ -580,7 +580,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
public void testManyToManyMorphToOneToManyMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) ormPersistentAttribute.getMapping();
assertFalse(manyToManyMapping.isDefault());
@@ -624,7 +624,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
public void testManyToManyMorphToManyToOneMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) ormPersistentAttribute.getMapping();
assertFalse(manyToManyMapping.isDefault());
@@ -655,7 +655,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
public void testManyToManyMorphToBasicMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany");
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) ormPersistentAttribute.getMapping();
assertFalse(manyToManyMapping.isDefault());
@@ -685,7 +685,7 @@ public class OrmManyToManyMappingTests extends ContextModelTestCase
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".State");
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "addresses");
+ ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "addresses");
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
addXmlClassRef(PACKAGE_NAME + ".Address");
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToOneMappingTests.java
index 43e25d837a..abdef3938e 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToOneMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmManyToOneMappingTests.java
@@ -105,7 +105,7 @@ public class OrmManyToOneMappingTests extends ContextModelTestCase
public void testUpdateName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
XmlManyToOne manyToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
@@ -125,7 +125,7 @@ public class OrmManyToOneMappingTests extends ContextModelTestCase
public void testModifyName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
XmlManyToOne manyToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
@@ -145,7 +145,7 @@ public class OrmManyToOneMappingTests extends ContextModelTestCase
public void testUpdateTargetEntity() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
XmlManyToOne manyToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
@@ -165,7 +165,7 @@ public class OrmManyToOneMappingTests extends ContextModelTestCase
public void testModifyTargetEntity() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
XmlManyToOne manyToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
@@ -185,7 +185,7 @@ public class OrmManyToOneMappingTests extends ContextModelTestCase
public void testUpdateSpecifiedFetch() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
XmlManyToOne manyToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
@@ -209,7 +209,7 @@ public class OrmManyToOneMappingTests extends ContextModelTestCase
public void testModifySpecifiedFetch() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
XmlManyToOne manyToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
@@ -233,7 +233,7 @@ public class OrmManyToOneMappingTests extends ContextModelTestCase
public void testUpdateSpecifiedOptional() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
XmlManyToOne manyToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
@@ -257,7 +257,7 @@ public class OrmManyToOneMappingTests extends ContextModelTestCase
public void testModifySpecifiedOptional() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
XmlManyToOne manyToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
@@ -281,7 +281,7 @@ public class OrmManyToOneMappingTests extends ContextModelTestCase
public void testAddSpecifiedJoinColumn() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
OrmJoinColumnJoiningStrategy strategy = ormManyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
XmlManyToOne manyToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
@@ -317,7 +317,7 @@ public class OrmManyToOneMappingTests extends ContextModelTestCase
public void testRemoveSpecifiedJoinColumn() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
OrmJoinColumnJoiningStrategy strategy = ormManyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
XmlManyToOne manyToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
@@ -343,7 +343,7 @@ public class OrmManyToOneMappingTests extends ContextModelTestCase
public void testMoveSpecifiedJoinColumn() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping");
OrmManyToOneMapping ormManyToOneMapping = (OrmManyToOneMapping) ormPersistentAttribute.getMapping();
OrmJoinColumnJoiningStrategy strategy = ormManyToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
XmlManyToOne manyToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0);
@@ -384,7 +384,7 @@ public class OrmManyToOneMappingTests extends ContextModelTestCase
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "foo");
+ ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "foo");
assertEquals(3, ormPersistentType.virtualAttributesSize());
OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
@@ -496,7 +496,7 @@ public class OrmManyToOneMappingTests extends ContextModelTestCase
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "address");
+ ormPersistentType.addSpecifiedAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "address");
assertEquals(2, ormPersistentType.virtualAttributesSize());
OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToManyMappingTests.java
index c25fd9d38d..175d992ecf 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToManyMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToManyMappingTests.java
@@ -137,7 +137,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
public void testUpdateName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
XmlOneToMany oneToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
@@ -157,7 +157,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
public void testModifyName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
XmlOneToMany oneToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
@@ -177,7 +177,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
public void testUpdateTargetEntity() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
XmlOneToMany oneToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
@@ -197,7 +197,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
public void testModifyTargetEntity() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
XmlOneToMany oneToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
@@ -217,7 +217,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
public void testUpdateSpecifiedFetch() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
XmlOneToMany oneToManyResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
@@ -241,7 +241,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
public void testModifySpecifiedFetch() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
XmlOneToMany oneToManyResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
@@ -265,7 +265,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
public void testUpdateMappedBy() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
OrmMappedByJoiningStrategy strategy = ormOneToManyMapping.getRelationshipReference().getMappedByJoiningStrategy();
XmlOneToMany oneToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
@@ -286,7 +286,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
public void testModifyMappedBy() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
OrmMappedByJoiningStrategy strategy = ormOneToManyMapping.getRelationshipReference().getMappedByJoiningStrategy();
XmlOneToMany oneToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
@@ -308,7 +308,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
public void testUpdateMapKey() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
XmlOneToMany oneToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
@@ -338,7 +338,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
public void testModifyMapKey() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
XmlOneToMany oneToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
@@ -358,7 +358,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
public void testUpdateOrderBy() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
XmlOneToMany oneToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
@@ -378,7 +378,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
public void testModifyOrderBy() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
XmlOneToMany oneToMany = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0);
@@ -398,7 +398,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
public void testIsNoOrdering() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
assertTrue(ormOneToManyMapping.getOrderable().isNoOrdering());
@@ -412,7 +412,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
public void testSetNoOrdering() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
assertTrue(ormOneToManyMapping.getOrderable().isNoOrdering());
@@ -435,7 +435,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
public void testIsCustomOrdering() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping");
OrmOneToManyMapping ormOneToManyMapping = (OrmOneToManyMapping) ormPersistentAttribute.getMapping();
assertFalse(ormOneToManyMapping.getOrderable().isCustomOrdering());
@@ -449,7 +449,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
public void testOneToManyMorphToIdMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
OneToManyMapping oneToManyMapping = (OneToManyMapping) ormPersistentAttribute.getMapping();
assertFalse(oneToManyMapping.isDefault());
@@ -469,7 +469,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
public void testOneToManyMorphToVersionMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
OneToManyMapping oneToManyMapping = (OneToManyMapping) ormPersistentAttribute.getMapping();
assertFalse(oneToManyMapping.isDefault());
@@ -495,7 +495,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
public void testOneToManyMorphToTransientMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
OneToManyMapping oneToManyMapping = (OneToManyMapping) ormPersistentAttribute.getMapping();
assertFalse(oneToManyMapping.isDefault());
@@ -515,7 +515,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
public void testOneToManyMorphToEmbeddedMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
OneToManyMapping oneToManyMapping = (OneToManyMapping) ormPersistentAttribute.getMapping();
assertFalse(oneToManyMapping.isDefault());
@@ -541,7 +541,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
public void testOneToManyMorphToEmbeddedIdMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
OneToManyMapping oneToManyMapping = (OneToManyMapping) ormPersistentAttribute.getMapping();
assertFalse(oneToManyMapping.isDefault());
@@ -561,7 +561,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
public void testOneToManyMorphToOneToOneMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
OneToManyMapping oneToManyMapping = (OneToManyMapping) ormPersistentAttribute.getMapping();
assertFalse(oneToManyMapping.isDefault());
@@ -594,7 +594,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
public void testOneToManyMorphToManyToManyMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
OneToManyMapping oneToManyMapping = (OneToManyMapping) ormPersistentAttribute.getMapping();
assertFalse(oneToManyMapping.isDefault());
@@ -638,7 +638,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
public void testOneToManyMorphToManyToOneMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
OneToManyMapping oneToManyMapping = (OneToManyMapping) ormPersistentAttribute.getMapping();
assertFalse(oneToManyMapping.isDefault());
@@ -670,7 +670,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
public void testOneToManyMorphToBasicMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany");
OneToManyMapping oneToManyMapping = (OneToManyMapping) ormPersistentAttribute.getMapping();
assertFalse(oneToManyMapping.isDefault());
@@ -701,7 +701,7 @@ public class OrmOneToManyMappingTests extends ContextModelTestCase
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".State");
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "addresses");
+ ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "addresses");
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
addXmlClassRef(PACKAGE_NAME + ".Address");
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToOneMappingTests.java
index 11828a13e6..26549bd0d2 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToOneMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmOneToOneMappingTests.java
@@ -166,7 +166,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
public void testUpdateName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
@@ -186,7 +186,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
public void testModifyName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
@@ -206,7 +206,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
public void testUpdateSpecifiedTargetEntity() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
@@ -226,7 +226,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
public void testModifySpecifiedTargetEntity() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
@@ -246,7 +246,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
public void testUpdateSpecifiedFetch() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
XmlOneToOne oneToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
@@ -270,7 +270,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
public void testModifySpecifiedFetch() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
XmlOneToOne oneToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
@@ -294,7 +294,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
public void testUpdateMappedBy() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
MappedByJoiningStrategy strategy = ormOneToOneMapping.getRelationshipReference().getMappedByJoiningStrategy();
XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
@@ -315,7 +315,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
public void testModifyMappedBy() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
MappedByJoiningStrategy strategy = ormOneToOneMapping.getRelationshipReference().getMappedByJoiningStrategy();
XmlOneToOne oneToOne = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
@@ -337,7 +337,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
public void testUpdateSpecifiedOptional() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
XmlOneToOne oneToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
@@ -361,7 +361,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
public void testModifySpecifiedOptional() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
XmlOneToOne oneToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
@@ -385,7 +385,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
public void testAddSpecifiedJoinColumn() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
OrmJoinColumnJoiningStrategy strategy = ormOneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
XmlOneToOne oneToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
@@ -421,7 +421,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
public void testRemoveSpecifiedJoinColumn() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
OrmJoinColumnJoiningStrategy strategy = ormOneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
XmlOneToOne oneToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
@@ -447,7 +447,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
public void testMoveSpecifiedJoinColumn() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
OrmJoinColumnJoiningStrategy strategy = ormOneToOneMapping.getRelationshipReference().getJoinColumnJoiningStrategy();
XmlOneToOne oneToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
@@ -487,7 +487,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "foo");
+ ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "foo");
assertEquals(3, ormPersistentType.virtualAttributesSize());
OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
@@ -602,7 +602,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "address");
+ ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "address");
assertEquals(2, ormPersistentType.virtualAttributesSize());
OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
@@ -651,7 +651,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
public void testOneToOneMorphToIdMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
OneToOneMapping oneToOneMapping = (OneToOneMapping) ormPersistentAttribute.getMapping();
assertFalse(oneToOneMapping.isDefault());
@@ -677,7 +677,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
public void testOneToOneMorphToVersionMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
OneToOneMapping oneToOneMapping = (OneToOneMapping) ormPersistentAttribute.getMapping();
assertFalse(oneToOneMapping.isDefault());
@@ -703,7 +703,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
public void testOneToOneMorphToTransientMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
OneToOneMapping oneToOneMapping = (OneToOneMapping) ormPersistentAttribute.getMapping();
assertFalse(oneToOneMapping.isDefault());
@@ -729,7 +729,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
public void testOneToOneMorphToEmbeddedMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
OneToOneMapping oneToOneMapping = (OneToOneMapping) ormPersistentAttribute.getMapping();
assertFalse(oneToOneMapping.isDefault());
@@ -755,7 +755,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
public void testOneToOneMorphToEmbeddedIdMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
OneToOneMapping oneToOneMapping = (OneToOneMapping) ormPersistentAttribute.getMapping();
assertFalse(oneToOneMapping.isDefault());
@@ -781,7 +781,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
public void testOneToOneMorphToManyToManyMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
OneToOneMapping oneToOneMapping = (OneToOneMapping) ormPersistentAttribute.getMapping();
assertFalse(oneToOneMapping.isDefault());
@@ -815,7 +815,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
public void testOneToOneMorphToOneToManyMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
OneToOneMapping oneToOneMapping = (OneToOneMapping) ormPersistentAttribute.getMapping();
assertFalse(oneToOneMapping.isDefault());
@@ -849,7 +849,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
public void testOneToOneMorphToManyToOneMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
OneToOneMapping oneToOneMapping = (OneToOneMapping) ormPersistentAttribute.getMapping();
assertFalse(oneToOneMapping.isDefault());
@@ -886,7 +886,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
public void testOneToOneMorphToBasicMapping() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne");
OneToOneMapping oneToOneMapping = (OneToOneMapping) ormPersistentAttribute.getMapping();
assertFalse(oneToOneMapping.isDefault());
@@ -917,7 +917,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
public void testAddPrimaryKeyJoinColumn() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
OrmPrimaryKeyJoinColumnJoiningStrategy strategy = ormOneToOneMapping.getRelationshipReference().getPrimaryKeyJoinColumnJoiningStrategy();
XmlOneToOne oneToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
@@ -953,7 +953,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
public void testRemovePrimaryKeyJoinColumn() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
OrmPrimaryKeyJoinColumnJoiningStrategy strategy = ormOneToOneMapping.getRelationshipReference().getPrimaryKeyJoinColumnJoiningStrategy();
XmlOneToOne oneToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
@@ -979,7 +979,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
public void testMovePrimaryKeyJoinColumn() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping");
OrmOneToOneMapping ormOneToOneMapping = (OrmOneToOneMapping) ormPersistentAttribute.getMapping();
OrmPrimaryKeyJoinColumnJoiningStrategy strategy = ormOneToOneMapping.getRelationshipReference().getPrimaryKeyJoinColumnJoiningStrategy();
XmlOneToOne oneToOneResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0);
@@ -1020,7 +1020,7 @@ public class OrmOneToOneMappingTests extends ContextModelTestCase
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address");
getEntityMappings().addPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".State");
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "address");
+ ormPersistentType.addSpecifiedAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "address");
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
addXmlClassRef(PACKAGE_NAME + ".Address");
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTransientMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTransientMappingTests.java
index 60946a9c1d..e41cd6d9ea 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTransientMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmTransientMappingTests.java
@@ -67,7 +67,7 @@ public class OrmTransientMappingTests extends ContextModelTestCase
}
public void testUpdateName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientMapping");
OrmTransientMapping xmlTransientnMapping = (OrmTransientMapping) ormPersistentAttribute.getMapping();
XmlTransient transientResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getTransients().get(0);
@@ -87,7 +87,7 @@ public class OrmTransientMappingTests extends ContextModelTestCase
public void testModifyName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientMapping");
OrmTransientMapping xmlTransientnMapping = (OrmTransientMapping) ormPersistentAttribute.getMapping();
XmlTransient transientResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getTransients().get(0);
@@ -110,7 +110,7 @@ public class OrmTransientMappingTests extends ContextModelTestCase
createTestEntityTransientMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "foo");
+ ormPersistentType.addSpecifiedAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "foo");
assertEquals(2, ormPersistentType.virtualAttributesSize());
OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
@@ -156,7 +156,7 @@ public class OrmTransientMappingTests extends ContextModelTestCase
createTestEntityTransientMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "id");
+ ormPersistentType.addSpecifiedAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "id");
assertEquals(1, ormPersistentType.virtualAttributesSize());
OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
@@ -168,7 +168,7 @@ public class OrmTransientMappingTests extends ContextModelTestCase
public void testTransientMorphToIdMapping() throws Exception {
createTestEntityTransientMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
TransientMapping transientMapping = (TransientMapping) ormPersistentAttribute.getMapping();
assertFalse(transientMapping.isDefault());
@@ -183,7 +183,7 @@ public class OrmTransientMappingTests extends ContextModelTestCase
public void testTransientMorphToVersionMapping() throws Exception {
createTestEntityTransientMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
TransientMapping transientMapping = (TransientMapping) ormPersistentAttribute.getMapping();
assertFalse(transientMapping.isDefault());
@@ -198,7 +198,7 @@ public class OrmTransientMappingTests extends ContextModelTestCase
public void testTransientMorphToTransientMapping() throws Exception {
createTestEntityTransientMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
TransientMapping transientMapping = (TransientMapping) ormPersistentAttribute.getMapping();
assertFalse(transientMapping.isDefault());
@@ -213,7 +213,7 @@ public class OrmTransientMappingTests extends ContextModelTestCase
public void testTransientMorphToEmbeddedMapping() throws Exception {
createTestEntityTransientMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
TransientMapping transientMapping = (TransientMapping) ormPersistentAttribute.getMapping();
assertFalse(transientMapping.isDefault());
@@ -228,7 +228,7 @@ public class OrmTransientMappingTests extends ContextModelTestCase
public void testTransientMorphToEmbeddedIdMapping() throws Exception {
createTestEntityTransientMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
TransientMapping transientMapping = (TransientMapping) ormPersistentAttribute.getMapping();
assertFalse(transientMapping.isDefault());
@@ -243,7 +243,7 @@ public class OrmTransientMappingTests extends ContextModelTestCase
public void testTransientMorphToOneToOneMapping() throws Exception {
createTestEntityTransientMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
TransientMapping transientMapping = (TransientMapping) ormPersistentAttribute.getMapping();
assertFalse(transientMapping.isDefault());
@@ -258,7 +258,7 @@ public class OrmTransientMappingTests extends ContextModelTestCase
public void testTransientMorphToOneToManyMapping() throws Exception {
createTestEntityTransientMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
TransientMapping transientMapping = (TransientMapping) ormPersistentAttribute.getMapping();
assertFalse(transientMapping.isDefault());
@@ -273,7 +273,7 @@ public class OrmTransientMappingTests extends ContextModelTestCase
public void testTransientMorphToManyToOneMapping() throws Exception {
createTestEntityTransientMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
TransientMapping transientMapping = (TransientMapping) ormPersistentAttribute.getMapping();
assertFalse(transientMapping.isDefault());
@@ -288,7 +288,7 @@ public class OrmTransientMappingTests extends ContextModelTestCase
public void testTransientMorphToManyToManyMapping() throws Exception {
createTestEntityTransientMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient");
TransientMapping transientMapping = (TransientMapping) ormPersistentAttribute.getMapping();
assertFalse(transientMapping.isDefault());
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmVersionMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmVersionMappingTests.java
index 61829a4231..9e5f0c3fc5 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmVersionMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmVersionMappingTests.java
@@ -77,7 +77,7 @@ public class OrmVersionMappingTests extends ContextModelTestCase
public void testUpdateName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionMapping");
OrmVersionMapping ormVersionMapping = (OrmVersionMapping) ormPersistentAttribute.getMapping();
XmlVersion versionResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getVersions().get(0);
@@ -97,7 +97,7 @@ public class OrmVersionMappingTests extends ContextModelTestCase
public void testModifyName() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionMapping");
OrmVersionMapping ormVersionMapping = (OrmVersionMapping) ormPersistentAttribute.getMapping();
XmlVersion versionResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getVersions().get(0);
@@ -117,7 +117,7 @@ public class OrmVersionMappingTests extends ContextModelTestCase
public void testUpdateTemporal() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionMapping");
OrmVersionMapping ormVersionMapping = (OrmVersionMapping) ormPersistentAttribute.getMapping();
XmlVersion versionResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getVersions().get(0);
@@ -145,7 +145,7 @@ public class OrmVersionMappingTests extends ContextModelTestCase
public void testModifyTemporal() throws Exception {
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo");
- OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionMapping");
+ OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.addSpecifiedAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionMapping");
OrmVersionMapping ormVersionMapping = (OrmVersionMapping) ormPersistentAttribute.getMapping();
XmlVersion versionResource = getXmlEntityMappings().getEntities().get(0).getAttributes().getVersions().get(0);
@@ -179,7 +179,7 @@ public class OrmVersionMappingTests extends ContextModelTestCase
createTestEntityVersionMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "foo");
+ ormPersistentType.addSpecifiedAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "foo");
assertEquals(2, ormPersistentType.virtualAttributesSize());
OrmPersistentAttribute ormPersistentAttribute = ormPersistentType.specifiedAttributes().next();
@@ -277,7 +277,7 @@ public class OrmVersionMappingTests extends ContextModelTestCase
createTestEntityVersionMapping();
OrmPersistentType ormPersistentType = getEntityMappings().addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME);
- ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "id");
+ ormPersistentType.addSpecifiedAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "id");
assertEquals(1, ormPersistentType.virtualAttributesSize());
</